Categories
- Arts & Entertainment
- Business
- Communications
- Computers
- Culture & Society
- Disease & Illness
- Fashion
- Finance
- Food & Beverage
- Health & Fitness
- Hobbies
- Home & Family
- Home Based Business
- Internet Business
- Legal
- Pets & Animals
- Politics
- Product Reviews
- Recreation & Sports
- Reference & Education
- Religion
- Self Improvement
- Shopping
- Travel & Leisure
- Vehicles
- Writing & Speaking
Information
A Common Misconception About Object-Oriented Programming
Submitted: 2007-01-17 15:53:45
Print this article | Tell a friend | For publisher |
I’ve seen it time and again. A computer programmer proudly proclaims, “Yeah, my code is object-oriented. See? My data members are all private, and they can only be reached through public member functions. That’s what being object-oriented is all about.” I’ve even heard this kind of drivel come from the mouths of Computer Science graduates—people who have presumably studied object-orientation in the classroom, or who would have had ample opportunity to educate themselves.
Scholars may quibble about the fine points of object orientation; however, one thing is for certain: merely having private data and public functions does not constitute a proper object-oriented design. Rather, proper object orientation entails much more.
One of the most basic elements is information hiding. This means that objects should only present the information that needs to be seen; that is, it should present a coherent and well-selected interface of functions—one that does not betray the data contents and internal workings of the class. In other words, the manner in which the functions are implemented remains hidden from the user, allowing the developer to alter the implementation as needed. (Some also refer to this as “encapsulation,” whereas others state that encapsulation is merely a means for hiding information. I lean toward the latter view; however, for the purposes of this article, this distinction is unimportant. Suffice to say that information hiding is a key element of object-oriented design.)
When a programmer declares that his code is object-oriented by virtue of having private data and public functions, he is placing the cart before the proverbial horse. Using private data and public functions is merely a means of achieving information hiding; it is not a goal in itself. For example, consider a design in which every single data member has corresponding “get” and “set” accessors (e.g. a data member “x” would have matching “getx()” and “setx()” functions). In this example, information is poorly hidden, since the choice of functions (indeed, their very names!) betrays the manner in which the data has been implemented.
Inheritance is another key element; that is, specific classes are to be derived from more general ones. Inheritance is a means of implementing abstraction; that is, it allows the user to identify objects with common characteristics, and which should therefore use common code (or at the very least, common interfaces). This is part and parcel of thinking in terms of objects, as opposed to thinking primarily in terms of functions and procedures.
Yet another key characteristic is polymorphism, which allows a descendant object to override its parent’s member functions. With polymorphism, a descendent object does not have to respond to a message exactly as its ancestor does; rather, it can have its own implementation. Note that the descendant objects do not have to override these functions; rather, they should simply be allowed to do so, as needed.There is much more that can be said about the nature of object orientation; indeed, scholars often contend over its precise definition and its principal ideas. Whatever the case though, the point remains: merely keeping private data and a set of public functions does not constitute an object-oriented design—not in any meaningful sense of the term.
About the author:
V. Berba Velasco Jr., Ph.D. is a senior electrical and software engineer at Cellular Technology Ltd, a biotech company that provides ELISPOT analysers, human PBMCs and serum-free cell culture media.
Article source: Expert Articles
Most Recent Articles in Software category
- Excel's Relative and Absolute Cell Referencing - By: Carl Nixon
A newbie's guide to Excels absolute and relative cell referencing techniques. This simple, easy to read guy will let you know which technique to use and when. It also explains the strengths and weaknesses of each. - Sales Tracker - Find Out Why You Need Sales Tracker Software Today - By: Noeal Sean
Today if you are not able to have a good sales tracker on your side, you'll end up missing many opportunities and sales, and you just can't afford to do that today. It's important that you learn about sales tracker software and how you can use it to help improve and enhance your business today. - Benefits of the Citrix Resource Manager - By: Mark Waltzer
The advantages, configurations and how to use Citrix Resource Manager during system administration. - Software Application - An Essential Part of Every Business - By: Harminder Kaur
Contact Management Software are useful in ensuring that calls promised to customers are made, enquiry calls are returned providing the necessary information asked by the customer, call to check if goods are delivered as promised, makes sure that customer relationship executive has access to the data if a customer calls etc - Designing Interfaces for Exchanging Data with Learning Management System Implementations - By: Dana Fine
When a company purchases and implements a learning management system (LMS), they often need an interface to connect it to other systems used by the organization such as SAP, PeopleSoft, and others. Interfaces from one system to another are created so data can be updated, imported, or exported depending upon the individual business case. This article is a primer on HRIS (Human Resources Information System) and Active Directory using LDAP (Lightweight Directory Access Protocol) Interfaces, which are often required when implementing the exchange of relevant user/employee data with the Learning Management System. This article will supply guidelines to consider when preparing to work with a company or an internal team that will design and implement these interfaces (custom programming services). - Create Digital Photo Albums with PowerPoint 2007 - By: May White White
You may have precious photographs or important business pictures from time to time. A PowerPoint photo album is just a presentation that helps you store and display these photos in a digital way. - About 3 Popular Process Managers - By: Dan Jones
A large number of computer users don't realize that they are probably running a number of unnecessary programs in the background that tie up system resources and slow down the system. Process mangers will help you to administrate your running process, release your system resources and speed up your PC at the same time. - Using Avidian for Your Sales Software Management - By: Noeal Sean
Sales software manage is one of the most powerful tools available to companies today. By using an effective and powerful program you can increase the productivity of your sales force, thereby increasing the profit your company brings in: simple math, simple concept but a not so simple thing to execute. - Benifits of Anti-virus, anti-spyware and registry cleaning - By: Alexis Martin
If you use the internet you have probably come across a virus or spyware of some type. Even the most savvy internet users fall victim to this at least once or twice. This article will explain what anti-virus, anti-spyware, and registry cleaning software do for your computer and why they are important for the health of your computer. - Communicate in an extraordinary way - By: Victor Cambell
An efficient flash based web chat application that supports major flash servers like Red5 and FMS. Provides a feature rich user friendly interface for flash text chat with audio and video conference.
