Beware Of Using Get And Set Codes New Jersey

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

Power Vision
(973) 623-8000
24 Commerce St
Newark, NJ
iCIMS
800-889-4422
1301 State Route 36
Hazlet, NJ
Mantra Information Services
973-270-0995
10 North Park Place, Suite 210
Morristown, NJ
TAKE Enterprise Services, Inc.
609-275-8384
502 Carnegie Center
Princeton, NJ
Language Success
(973) 648-0236
1 Newark Airport
Newark, NJ
Shelko Consulting LLC
201-478-7170
214 State St
Hackensack, NJ
Shelko Consulting LLC
201-478-7170
214 State Street
Hackensack, NJ
Accession Technology Accounting & CRM Software Consulting
888-808-1117
PO Box 400
Ridgewood, NJ
Bon Trade Solutions
(973) 623-0093
744 Broad St
Newark, NJ
Popkin Software & Systems Inc
(212) 269-3062
55 Broadway
Newark, NJ

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

Power Vision

(973) 623-8000
24 Commerce St
Newark, NJ

Regional Articles
- Beware Of Using Get And Set Codes Absecon NJ
- Beware Of Using Get And Set Codes Asbury Park NJ
- Beware Of Using Get And Set Codes Atlantic City NJ
- Beware Of Using Get And Set Codes Barnegat NJ
- Beware Of Using Get And Set Codes Basking Ridge NJ
- Beware Of Using Get And Set Codes Bayonne NJ
- Beware Of Using Get And Set Codes Bayville NJ
- Beware Of Using Get And Set Codes Belle Mead NJ
- Beware Of Using Get And Set Codes Belleville NJ
- Beware Of Using Get And Set Codes Belmar NJ
- Beware Of Using Get And Set Codes Bergenfield NJ
- Beware Of Using Get And Set Codes Blackwood NJ
- Beware Of Using Get And Set Codes Bloomfield NJ
- Beware Of Using Get And Set Codes Boonton NJ
- Beware Of Using Get And Set Codes Bordentown NJ
- Beware Of Using Get And Set Codes Brick NJ
- Beware Of Using Get And Set Codes Bridgeton NJ
- Beware Of Using Get And Set Codes Bridgewater NJ
- Beware Of Using Get And Set Codes Browns Mills NJ
- Beware Of Using Get And Set Codes Burlington NJ
- Beware Of Using Get And Set Codes Caldwell NJ
- Beware Of Using Get And Set Codes Camden NJ
- Beware Of Using Get And Set Codes Cape May Court House NJ
- Beware Of Using Get And Set Codes Cape May NJ
- Beware Of Using Get And Set Codes Carteret NJ
- Beware Of Using Get And Set Codes Cherry Hill NJ
- Beware Of Using Get And Set Codes Clark NJ
- Beware Of Using Get And Set Codes Clementon NJ
- Beware Of Using Get And Set Codes Cliffside Park NJ
- Beware Of Using Get And Set Codes Clifton NJ
- Beware Of Using Get And Set Codes Collingswood NJ
- Beware Of Using Get And Set Codes Colonia NJ
- Beware Of Using Get And Set Codes Cranford NJ
- Beware Of Using Get And Set Codes Denville NJ
- Beware Of Using Get And Set Codes Deptford NJ
- Beware Of Using Get And Set Codes Dumont NJ
- Beware Of Using Get And Set Codes East Brunswick NJ
- Beware Of Using Get And Set Codes East Orange NJ
- Beware Of Using Get And Set Codes Eatontown NJ
- Beware Of Using Get And Set Codes Edison NJ
- Beware Of Using Get And Set Codes Egg Harbor Township NJ
- Beware Of Using Get And Set Codes Elizabeth NJ
- Beware Of Using Get And Set Codes Englewood NJ
- Beware Of Using Get And Set Codes Englishtown NJ
- Beware Of Using Get And Set Codes Ewing NJ
- Beware Of Using Get And Set Codes Fair Lawn NJ
- Beware Of Using Get And Set Codes Flemington NJ
- Beware Of Using Get And Set Codes Forked River NJ
- Beware Of Using Get And Set Codes Fort Lee NJ
- Beware Of Using Get And Set Codes Freehold NJ
- Beware Of Using Get And Set Codes Garfield NJ
- Beware Of Using Get And Set Codes Glassboro NJ
- Beware Of Using Get And Set Codes Hackensack NJ
- Beware Of Using Get And Set Codes Hackettstown NJ
- Beware Of Using Get And Set Codes Haddon Township NJ
- Beware Of Using Get And Set Codes Haddonfield NJ
- Beware Of Using Get And Set Codes Haledon NJ
- Beware Of Using Get And Set Codes Hammonton NJ
- Beware Of Using Get And Set Codes Hazlet NJ
- Beware Of Using Get And Set Codes Hightstown NJ
- Beware Of Using Get And Set Codes Hillside NJ
- Beware Of Using Get And Set Codes Hoboken NJ
- Beware Of Using Get And Set Codes Holmdel NJ
- Beware Of Using Get And Set Codes Howell NJ
- Beware Of Using Get And Set Codes Irvington NJ
- Beware Of Using Get And Set Codes Iselin NJ
- Beware Of Using Get And Set Codes Jackson NJ
- Beware Of Using Get And Set Codes Jersey City NJ
- Beware Of Using Get And Set Codes Kearny NJ
- Beware Of Using Get And Set Codes Keyport NJ
- Beware Of Using Get And Set Codes Lakehurst NJ
- Beware Of Using Get And Set Codes Lakewood NJ
- Beware Of Using Get And Set Codes Linden NJ
- Beware Of Using Get And Set Codes Livingston NJ
- Beware Of Using Get And Set Codes Long Branch NJ
- Beware Of Using Get And Set Codes Lyndhurst NJ
- Beware Of Using Get And Set Codes Madison NJ
- Beware Of Using Get And Set Codes Mahwah NJ
- Beware Of Using Get And Set Codes Manahawkin NJ
- Beware Of Using Get And Set Codes Manchester Township NJ
- Beware Of Using Get And Set Codes Maple Shade NJ
- Beware Of Using Get And Set Codes Maplewood NJ
- Beware Of Using Get And Set Codes Marlboro NJ
- Beware Of Using Get And Set Codes Marlton NJ
- Beware Of Using Get And Set Codes Matawan NJ
- Beware Of Using Get And Set Codes Mays Landing NJ
- Beware Of Using Get And Set Codes Medford NJ
- Beware Of Using Get And Set Codes Merchantville NJ
- Beware Of Using Get And Set Codes Metuchen NJ
- Beware Of Using Get And Set Codes Middletown NJ
- Beware Of Using Get And Set Codes Millville NJ
- Beware Of Using Get And Set Codes Monroe Township NJ
- Beware Of Using Get And Set Codes Montclair NJ
- Beware Of Using Get And Set Codes Moorestown NJ
- Beware Of Using Get And Set Codes Morganville NJ
- Beware Of Using Get And Set Codes Morris Plains NJ
- Beware Of Using Get And Set Codes Morristown NJ
- Beware Of Using Get And Set Codes Mount Holly NJ
- Beware Of Using Get And Set Codes Mount Laurel NJ
- Beware Of Using Get And Set Codes Neptune NJ
- Beware Of Using Get And Set Codes New Brunswick NJ
- Beware Of Using Get And Set Codes Newark NJ
- Beware Of Using Get And Set Codes Newton NJ
- Beware Of Using Get And Set Codes North Arlington NJ
- Beware Of Using Get And Set Codes North Bergen NJ
- Beware Of Using Get And Set Codes North Brunswick NJ
- Beware Of Using Get And Set Codes Nutley NJ
- Beware Of Using Get And Set Codes Ocean City NJ
- Beware Of Using Get And Set Codes Old Bridge NJ
- Beware Of Using Get And Set Codes Orange NJ
- Beware Of Using Get And Set Codes Palisades Park NJ
- Beware Of Using Get And Set Codes Paramus NJ
- Beware Of Using Get And Set Codes Parlin NJ
- Beware Of Using Get And Set Codes Parsippany NJ
- Beware Of Using Get And Set Codes Passaic NJ
- Beware Of Using Get And Set Codes Paterson NJ
- Beware Of Using Get And Set Codes Pennsauken NJ
- Beware Of Using Get And Set Codes Perth Amboy NJ
- Beware Of Using Get And Set Codes Phillipsburg NJ
- Beware Of Using Get And Set Codes Piscataway NJ
- Beware Of Using Get And Set Codes Plainfield NJ
- Beware Of Using Get And Set Codes Plainsboro NJ
- Beware Of Using Get And Set Codes Pleasantville NJ
- Beware Of Using Get And Set Codes Point Pleasant Beach NJ
- Beware Of Using Get And Set Codes Princeton Junction NJ
- Beware Of Using Get And Set Codes Princeton NJ
- Beware Of Using Get And Set Codes Rahway NJ
- Beware Of Using Get And Set Codes Ramsey NJ
- Beware Of Using Get And Set Codes Red Bank NJ
- Beware Of Using Get And Set Codes Rockaway NJ
- Beware Of Using Get And Set Codes Rutherford NJ
- Beware Of Using Get And Set Codes Sayreville NJ
- Beware Of Using Get And Set Codes Scotch Plains NJ
- Beware Of Using Get And Set Codes Secaucus NJ
- Beware Of Using Get And Set Codes Sewell NJ
- Beware Of Using Get And Set Codes Sicklerville NJ
- Beware Of Using Get And Set Codes Somerset NJ
- Beware Of Using Get And Set Codes Somerville NJ
- Beware Of Using Get And Set Codes South Amboy NJ
- Beware Of Using Get And Set Codes South Orange NJ
- Beware Of Using Get And Set Codes South Plainfield NJ
- Beware Of Using Get And Set Codes South River NJ
- Beware Of Using Get And Set Codes Summit NJ
- Beware Of Using Get And Set Codes Teaneck NJ
- Beware Of Using Get And Set Codes Toms River NJ
- Beware Of Using Get And Set Codes Trenton NJ
- Beware Of Using Get And Set Codes Tuckerton NJ
- Beware Of Using Get And Set Codes Union City NJ
- Beware Of Using Get And Set Codes Union NJ
- Beware Of Using Get And Set Codes Vincentown NJ
- Beware Of Using Get And Set Codes Vineland NJ
- Beware Of Using Get And Set Codes Voorhees NJ
- Beware Of Using Get And Set Codes Wayne NJ
- Beware Of Using Get And Set Codes West Milford NJ
- Beware Of Using Get And Set Codes West New York NJ
- Beware Of Using Get And Set Codes West Orange NJ
- Beware Of Using Get And Set Codes Westfield NJ
- Beware Of Using Get And Set Codes Westwood NJ
- Beware Of Using Get And Set Codes Williamstown NJ
- Beware Of Using Get And Set Codes Willingboro NJ
- Beware Of Using Get And Set Codes Wyckoff NJ
Related Articles
- Bioinformatics Introduction New Jersey
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 Jersey
- Regarding dumb Smart Folders New Jersey
- CMMS Implementation New Jersey
- Printing Software in Business New Jersey
- Beating Spyware New Jersey
- How To Build A Flash Game New Jersey
- DVD ripping FAQ New Jersey
- Using Lookup Tables in AppleWorks New Jersey
- Antivirus And Security New Jersey
Related Local Event
Computer Technology Expo
Dates: 7/21/2009 - 7/23/2009
Location: Atlantic City Convention Center
Atlantic City, NJ
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