Beware Of Using Get And Set Codes New York

There is no doubt computer code writing is a tough job, you need to be careful when doing that job. Read the article below to learn tips for using"get" And "set".

Local Companies

Roth Controls
(585) 872-0220
841 Holt Rd
Rochester, NY
CompareTechProviders.com
518-207-3445
5 Washington Place
Troy, NY
American Micro, Inc.
(716) 861-1412
1659 North Forest Rd.
Buffalo, NY
Software Solutions Group
(716) 568-2040
6465 Transit Rd.
East Amherst, NY
IT HealthTrack, Inc.
(716) 630-0063
6500 Main St., Ste. 3
Williamsville, NY
COMAND Solutions
(800) 598-0869 ext. 88
110 Elmwood Ave.
Buffalo, NY
Globalquest Solutions, Inc.
(716) 601-3524
435 Lawrence Bell Dr., Ste. 7
Williamsville, NY
Viewpoint Software Solutions Inc
(585) 475-9555
800 W Metro Park
Rochester, NY
KIC Chemicals Inc.
(845) 883-5306 ext. 301
87 South Ohioville Road
New Paltz, NY
Angus MacDonald
(845) 527-9792
27D Colonial Drive
New Paltz, NY

It’s an all-too-common pitfall. Programmers who attempt to write object-oriented code decide to make all of their data variables private, while creating public get() and set() function pairs for each one. “See?” they declare, as they pat themselves on their backs. “The data is private, but it can be accessed through these functions. I’ve encapsulated my data. That’s what object-oriented design requires.”

I think this betrays a fundamental (and exceedingly common) misunderstanding of what constitutes encapsulation and information hiding. Ideally, in an object-oriented design, the user of a software class should have no idea what type of data the class contains. As far as he’s concerned, the class should simply provide the required services, and its internal details should be invisible. However, when we provide get() and set() function pairs for each member variable, we are basically announcing the existence of this data to the world. The information hiding provided by this class is weak—and arguably non-existent. One might change the name, data type or implementation of this member variable, but its existence remains painfully obvious to everyone.

(Note that I say that the user should “ideally” be oblivious to the type of data contained within the class. In practice, this is not always feasible. If we were to implement a BankAccount class, for example, most programmers would immediately guess that this class would have the account balance as one of its data members. They would also guess—rightfully so—that the owner of this account is likely to be data member as well. Nevertheless, we should avoid needlessly divulging such details, especially when the contents of a class are not so easily discerned.)

In effect, these get() and set() member functions are almost as bad as having public data. Sure, they may provide some useful services; for example, the set() function could validate the data, ensuring that it is within the proper range of values. Nevertheless, they tend to violate the spirit of information hiding, at least to some degree.

Using get() and set() functions is not always a bad idea; in fact, sometimes they make perfect sense. Their frequent use, however, is a pretty good indication of a poorly abstracted software design—one that does not adhere well to the principle of information hiding. When designing software classes, we need to think primarily in terms of the services they provide (i.e. their public functions), rather than the data they contain. Ideally, their data implementations should proceed from the required services, rather than other way around.

To illustrate this concept, let us revisit the BankAccount class mentioned earlier. It is clear that the BankAccount object will need to keep track of its balance, so let’s make that a data member. A novice programmer (or one with a poor grasp of object orientation) may choose to provide both GetBalance() and SetBalance() functions for this class… but does this make sense?

What happens when a user attempts to make a deposit? The user would have to call GetBalance(), add the deposit amount, and then set the new value using GetBalance(). That’s not how real users operate, though; in the real world, there is no need for the depositor to know how much money is in the account. This class design gives the user too much information and requires too many steps.

Similarly, to perform a withdrawal, the user would need to call GetBalance(), subtract the withdrawal amount, and then call SetBalance() to update the account. This also requires too much work on the user’s part. In the real world, the user should not always be required to know exactly how much money is in the account. This person might want to know that there are sufficient funds, but he wouldn’t necessarily need to know the precise balance, and this information should not be a constant requirement.

A sensibly written class should provide the following services instead: DepositAmount(), WithdrawAmount() and GetBalance(). With this design, the data member—the account balance—is logically implied by the services provided, rather than the other way around. (We could define other services, such as AccrueInterest() and TransferFunds(), but let’s keep it simple for now. Note that these services might suggest additional data members; for example, AccrueInterest() would suggest that a data member would be needed for the interest rate.)

In summary, get() and set() function pairs are not inherently bad, but their preponderance could suggest a poorly abstracted software design. There’s nothing inherently wrong with using get() and set() functions when they form part of a sensibly designed set of services. Nor is there anything wrong with using a data member to reflect these functions. When one proceeds in the opposite direction, though—when one starts with the data members, then adds corresponding get() and set() pairs—that’s a strong indication of a poorly conceived software design.

About the Author:

V. Berba Velasco Jr., Ph.D. is a senior electrical and software engineer at CTL (http://www.elispot-analyzers.de, http://www.immunospot.com, http://www.elispot.cn, http://www.elispot.co.jp), a biotech firm that provides ELISPOT technology, cryopreserved PBMCs and serum-free media.






Article Source:

thePhantomWriters Article Submission Service

Featured Local Company

Roth Controls

(585) 872-0220
841 Holt Rd
Rochester, NY
http://www.leojroth.com

Regional Articles
- Beware Of Using Get And Set Codes Albany NY
- Beware Of Using Get And Set Codes Amityville NY
- Beware Of Using Get And Set Codes Amsterdam NY
- Beware Of Using Get And Set Codes Arverne NY
- Beware Of Using Get And Set Codes Astoria NY
- Beware Of Using Get And Set Codes Auburn NY
- Beware Of Using Get And Set Codes Babylon NY
- Beware Of Using Get And Set Codes Baldwin NY
- Beware Of Using Get And Set Codes Baldwinsville NY
- Beware Of Using Get And Set Codes Ballston Spa NY
- Beware Of Using Get And Set Codes Bay Shore NY
- Beware Of Using Get And Set Codes Bayside NY
- Beware Of Using Get And Set Codes Beacon NY
- Beware Of Using Get And Set Codes Bellerose NY
- Beware Of Using Get And Set Codes Bellmore NY
- Beware Of Using Get And Set Codes Bethpage NY
- Beware Of Using Get And Set Codes Binghamton NY
- Beware Of Using Get And Set Codes Brentwood NY
- Beware Of Using Get And Set Codes Brewster NY
- Beware Of Using Get And Set Codes Brockport NY
- Beware Of Using Get And Set Codes Bronx NY
- Beware Of Using Get And Set Codes Bronxville NY
- Beware Of Using Get And Set Codes Brooklyn NY
- Beware Of Using Get And Set Codes Buffalo NY
- Beware Of Using Get And Set Codes Cambria Heights NY
- Beware Of Using Get And Set Codes Camillus NY
- Beware Of Using Get And Set Codes Canandaigua NY
- Beware Of Using Get And Set Codes Centereach NY
- Beware Of Using Get And Set Codes Central Islip NY
- Beware Of Using Get And Set Codes Clifton Park NY
- Beware Of Using Get And Set Codes Cohoes NY
- Beware Of Using Get And Set Codes College Point NY
- Beware Of Using Get And Set Codes Commack NY
- Beware Of Using Get And Set Codes Copiague NY
- Beware Of Using Get And Set Codes Coram NY
- Beware Of Using Get And Set Codes Corning NY
- Beware Of Using Get And Set Codes Corona NY
- Beware Of Using Get And Set Codes Cortland NY
- Beware Of Using Get And Set Codes Cortlandt Manor NY
- Beware Of Using Get And Set Codes Deer Park NY
- Beware Of Using Get And Set Codes Delmar NY
- Beware Of Using Get And Set Codes Depew NY
- Beware Of Using Get And Set Codes Dunkirk NY
- Beware Of Using Get And Set Codes East Amherst NY
- Beware Of Using Get And Set Codes East Aurora NY
- Beware Of Using Get And Set Codes East Elmhurst NY
- Beware Of Using Get And Set Codes East Islip NY
- Beware Of Using Get And Set Codes East Meadow NY
- Beware Of Using Get And Set Codes East Northport NY
- Beware Of Using Get And Set Codes East Setauket NY
- Beware Of Using Get And Set Codes East Syracuse NY
- Beware Of Using Get And Set Codes Elmhurst NY
- Beware Of Using Get And Set Codes Elmira NY
- Beware Of Using Get And Set Codes Elmont NY
- Beware Of Using Get And Set Codes Endicott NY
- Beware Of Using Get And Set Codes Fairport NY
- Beware Of Using Get And Set Codes Far Rockaway NY
- Beware Of Using Get And Set Codes Farmingdale NY
- Beware Of Using Get And Set Codes Farmingville NY
- Beware Of Using Get And Set Codes Floral Park NY
- Beware Of Using Get And Set Codes Flushing NY
- Beware Of Using Get And Set Codes Forest Hills NY
- Beware Of Using Get And Set Codes Franklin Square NY
- Beware Of Using Get And Set Codes Fredonia NY
- Beware Of Using Get And Set Codes Freeport NY
- Beware Of Using Get And Set Codes Fresh Meadows NY
- Beware Of Using Get And Set Codes Fulton NY
- Beware Of Using Get And Set Codes Garden City NY
- Beware Of Using Get And Set Codes Glen Cove NY
- Beware Of Using Get And Set Codes Glen Oaks NY
- Beware Of Using Get And Set Codes Glens Falls NY
- Beware Of Using Get And Set Codes Gloversville NY
- Beware Of Using Get And Set Codes Great Neck NY
- Beware Of Using Get And Set Codes Hamburg NY
- Beware Of Using Get And Set Codes Hauppauge NY
- Beware Of Using Get And Set Codes Hempstead NY
- Beware Of Using Get And Set Codes Hicksville NY
- Beware Of Using Get And Set Codes Hilton NY
- Beware Of Using Get And Set Codes Holbrook NY
- Beware Of Using Get And Set Codes Hollis NY
- Beware Of Using Get And Set Codes Hopewell Junction NY
- Beware Of Using Get And Set Codes Horseheads NY
- Beware Of Using Get And Set Codes Howard Beach NY
- Beware Of Using Get And Set Codes Huntington NY
- Beware Of Using Get And Set Codes Huntington Station NY
- Beware Of Using Get And Set Codes Islip NY
- Beware Of Using Get And Set Codes Ithaca NY
- Beware Of Using Get And Set Codes Jackson Heights NY
- Beware Of Using Get And Set Codes Jamaica NY
- Beware Of Using Get And Set Codes Jamestown NY
- Beware Of Using Get And Set Codes Kew Gardens NY
- Beware Of Using Get And Set Codes Kings Park NY
- Beware Of Using Get And Set Codes Kingston NY
- Beware Of Using Get And Set Codes Lancaster NY
- Beware Of Using Get And Set Codes Larchmont NY
- Beware Of Using Get And Set Codes Latham NY
- Beware Of Using Get And Set Codes Levittown NY
- Beware Of Using Get And Set Codes Lindenhurst NY
- Beware Of Using Get And Set Codes Little Neck NY
- Beware Of Using Get And Set Codes Liverpool NY
- Beware Of Using Get And Set Codes Lockport NY
- Beware Of Using Get And Set Codes Long Beach NY
- Beware Of Using Get And Set Codes Long Island City NY
- Beware Of Using Get And Set Codes Lynbrook NY
- Beware Of Using Get And Set Codes Mahopac NY
- Beware Of Using Get And Set Codes Malone NY
- Beware Of Using Get And Set Codes Mamaroneck NY
- Beware Of Using Get And Set Codes Manhasset NY
- Beware Of Using Get And Set Codes Manlius NY
- Beware Of Using Get And Set Codes Maspeth NY
- Beware Of Using Get And Set Codes Massapequa NY
- Beware Of Using Get And Set Codes Massapequa Park NY
- Beware Of Using Get And Set Codes Massena NY
- Beware Of Using Get And Set Codes Mastic NY
- Beware Of Using Get And Set Codes Melville NY
- Beware Of Using Get And Set Codes Merrick NY
- Beware Of Using Get And Set Codes Middle Village NY
- Beware Of Using Get And Set Codes Middletown NY
- Beware Of Using Get And Set Codes Mineola NY
- Beware Of Using Get And Set Codes Monroe NY
- Beware Of Using Get And Set Codes Monsey NY
- Beware Of Using Get And Set Codes Mount Kisco NY
- Beware Of Using Get And Set Codes Mount Vernon NY
- Beware Of Using Get And Set Codes Nanuet NY
- Beware Of Using Get And Set Codes New City NY
- Beware Of Using Get And Set Codes New Hartford NY
- Beware Of Using Get And Set Codes New Hyde Park NY
- Beware Of Using Get And Set Codes New Paltz NY
- Beware Of Using Get And Set Codes New Rochelle NY
- Beware Of Using Get And Set Codes New Windsor NY
- Beware Of Using Get And Set Codes New York NY
- Beware Of Using Get And Set Codes Newburgh NY
- Beware Of Using Get And Set Codes Niagara Falls NY
- Beware Of Using Get And Set Codes North Babylon NY
- Beware Of Using Get And Set Codes North Tonawanda NY
- Beware Of Using Get And Set Codes Nyack NY
- Beware Of Using Get And Set Codes Oakland Gardens NY
- Beware Of Using Get And Set Codes Oceanside NY
- Beware Of Using Get And Set Codes Ogdensburg NY
- Beware Of Using Get And Set Codes Olean NY
- Beware Of Using Get And Set Codes Oneonta NY
- Beware Of Using Get And Set Codes Orchard Park NY
- Beware Of Using Get And Set Codes Ossining NY
- Beware Of Using Get And Set Codes Oswego NY
- Beware Of Using Get And Set Codes Ozone Park NY
- Beware Of Using Get And Set Codes Patchogue NY
- Beware Of Using Get And Set Codes Pearl River NY
- Beware Of Using Get And Set Codes Peekskill NY
- Beware Of Using Get And Set Codes Penfield NY
- Beware Of Using Get And Set Codes Pittsford NY
- Beware Of Using Get And Set Codes Plainview NY
- Beware Of Using Get And Set Codes Plattsburgh NY
- Beware Of Using Get And Set Codes Port Chester NY
- Beware Of Using Get And Set Codes Port Jefferson Station NY
- Beware Of Using Get And Set Codes Port Washington NY
- Beware Of Using Get And Set Codes Potsdam NY
- Beware Of Using Get And Set Codes Poughkeepsie NY
- Beware Of Using Get And Set Codes Queens Village NY
- Beware Of Using Get And Set Codes Queensbury NY
- Beware Of Using Get And Set Codes Rego Park NY
- Beware Of Using Get And Set Codes Rensselaer NY
- Beware Of Using Get And Set Codes Richmond Hill NY
- Beware Of Using Get And Set Codes Ridgewood NY
- Beware Of Using Get And Set Codes Riverhead NY
- Beware Of Using Get And Set Codes Rochester NY
- Beware Of Using Get And Set Codes Rockaway Park NY
- Beware Of Using Get And Set Codes Rockville Centre NY
- Beware Of Using Get And Set Codes Rome NY
- Beware Of Using Get And Set Codes Ronkonkoma NY
- Beware Of Using Get And Set Codes Roosevelt NY
- Beware Of Using Get And Set Codes Rosedale NY
- Beware Of Using Get And Set Codes Rye NY
- Beware Of Using Get And Set Codes Saint Albans NY
- Beware Of Using Get And Set Codes Saint James NY
- Beware Of Using Get And Set Codes Saratoga Springs NY
- Beware Of Using Get And Set Codes Saugerties NY
- Beware Of Using Get And Set Codes Sayville NY
- Beware Of Using Get And Set Codes Scarsdale NY
- Beware Of Using Get And Set Codes Schenectady NY
- Beware Of Using Get And Set Codes Selden NY
- Beware Of Using Get And Set Codes Shirley NY
- Beware Of Using Get And Set Codes Smithtown NY
- Beware Of Using Get And Set Codes South Ozone Park NY
- Beware Of Using Get And Set Codes South Richmond Hill NY
- Beware Of Using Get And Set Codes Spencerport NY
- Beware Of Using Get And Set Codes Spring Valley NY
- Beware Of Using Get And Set Codes Springfield Gardens NY
- Beware Of Using Get And Set Codes Staten Island NY
- Beware Of Using Get And Set Codes Stony Brook NY
- Beware Of Using Get And Set Codes Suffern NY
- Beware Of Using Get And Set Codes Sunnyside NY
- Beware Of Using Get And Set Codes Syosset NY
- Beware Of Using Get And Set Codes Syracuse NY
- Beware Of Using Get And Set Codes Tarrytown NY
- Beware Of Using Get And Set Codes Tonawanda NY
- Beware Of Using Get And Set Codes Troy NY
- Beware Of Using Get And Set Codes Uniondale NY
- Beware Of Using Get And Set Codes Utica NY
- Beware Of Using Get And Set Codes Valley Stream NY
- Beware Of Using Get And Set Codes Vestal NY
- Beware Of Using Get And Set Codes Wantagh NY
- Beware Of Using Get And Set Codes Wappingers Falls NY
- Beware Of Using Get And Set Codes Watertown NY
- Beware Of Using Get And Set Codes Watervliet NY
- Beware Of Using Get And Set Codes Webster NY
- Beware Of Using Get And Set Codes West Babylon NY
- Beware Of Using Get And Set Codes West Hempstead NY
- Beware Of Using Get And Set Codes West Islip NY
- Beware Of Using Get And Set Codes Westbury NY
- Beware Of Using Get And Set Codes White Plains NY
- Beware Of Using Get And Set Codes Whitestone NY
- Beware Of Using Get And Set Codes Woodhaven NY
- Beware Of Using Get And Set Codes Woodside NY
- Beware Of Using Get And Set Codes Wyandanch NY
- Beware Of Using Get And Set Codes Yonkers NY
- Beware Of Using Get And Set Codes Yorktown Heights NY
Related Articles
- Bioinformatics Introduction New York
Bioinformatics is a discipline which combines computer technology and biology to handle the immense biological data, mainly genetic information which has been produced over the years. It involves creating, managing and updating the databases which are warehouse of the biological information and the development of the tools used for analyzing and using this data.
- Win PC Defender New York
- How To Build A Flash Game New York
- CMMS Implementation New York
- Printing Software in Business New York
- Beating Spyware New York
- DVD ripping FAQ New York
- Using Lookup Tables in AppleWorks New York
- Antivirus And Security New York
- Regarding dumb Smart Folders New York
Related Local Events
I.T. Committee Meeting
Dates: 12/17/2009 - 12/17/2009
Location: Queens Chamber Board Room
Jackson Heights, NY
View Details

BIO CEO & INVESTOR CONFERENCE 2010
Dates: 2/8/2010 - 2/8/2010
Location: Waldorf-Astoria
New York, NY
View Details

TradeTech USA
Dates: 3/1/2010 - 3/3/2010
Location: Marriott Marquis New York
New York, NY
View Details

Biotechnica America
Dates: 4/20/2010 - 4/22/2010
Location: Jacob K. Javits Convention Center
New York, NY
View Details

I.T. Committee Meeting
Dates: 11/19/2009 - 11/19/2009
Location: Queens Chamber Board Room
Jackson Heights, NY
View Details

Rss   Delicious   Digg   Add To My Yahoo   Add To My Google   Bookmark   Search Plugin

Topics:
Advertising Family Home Services Real Estate Resources
Business Services Fashion Industrial Goods & Services Retail & Consumer Services
Career Financial Services Insurance Software
Cars Food & Beverage Internet Technology
Computer Hardware Franchise Legal Telecommunications
Construction Health Miscellaneous Trade Shows
Education Holidays Nightlife Travel
Entertainment Home Appliances Online Database Weddings
Environmental Home Electronics Pets World History