Encapsulation, Inheritance and Polymorphism
There are three major features in object-oriented programming: encapsulation, inheritance and polymorphism.
Encapsulation Enforces Modularity
Encapsulation refers to the creation of self-contained modules that bind processing functions to the data. These user-defined data types are called "classes," and one instance of a class is an "object." For example, in a payroll system, a class could be Manager, and Pat and Jan could be two instances (two objects) of the Manager class. Encapsulation ensures good code modularity, which keeps routines separate and less prone to conflict with each other.
Inheritance Passes "Knowledge" Down
Classes are created in hierarchies, and inheritance allows the structure and methods in one class to be passed down the hierarchy. That means less programming is required when adding functions to complex systems. If a step is added at the bottom of a hierarchy, then only the processing and data associated with that unique step needs to be added. Everything else about that step is inherited. The ability to reuse existing objects is considered a major advantage of object technology.
Polymorphism Takes any Shape
Object-oriented programming allows procedures about objects to be created whose exact type is not known until runtime. For example, a screen cursor may change its shape from an arrow to a line depending on the program mode. The routine to move the cursor on screen in response to mouse movement would be written for "cursor," and polymorphism allows that cursor to take on whatever shape is required at runtime. It also allows new shapes to be easily integrated.
OOP Languages
Used for simulating system behavior in the late 1960s, SIMULA was the first object-oriented language. In the 1970s, Xerox's Smalltalk was the first object-oriented programming language and was used to create the graphical user interface (GUI). Today, C++ and Java are the major OOP languages, while C#, Visual Basic.NET, Python and JavaScript are also popular. ACTOR and Eiffel were earlier OOP languages. The following list compares some basic OOP terms with traditional programming. See object technology and object-oriented DBMS.
OOP Traditional Programming
class description of data +
processing
object (instance) actual data + processing
attribute actual data (a field)
method function that processes a
particular structure
message function call
instantiate allocate a structure
Object Modeling
When information systems are modeled as objects, they can employ the powerful inheritance capability. Instead of building a table of employees with department and job information in separate tables, the type of employee is modeled. The employee class contains the data and the processing for all employees. Each subclass (manager, secretary, etc.) contains the data and processing unique to that person's job. Changes can be made globally or individually by modifying the class in question.
![]() | Reproduced with permission from Computer Desktop Encyclopedia. Copyright (c) 1981-2008 The Computer Language Company Inc. All rights reserved. |
Additional Resources
- Should political postings stay or go? A survey.
- I've been blogging for ZD Net for several years, writing for ZD publications for almost 20 years. I've always found readers to be intelligent and thoughtful, which is why I continue to do this while doing other things as "work." My posting, A virus in your genes, think about that,...
- Blog posts 2008-09-04
- Are we "done" with rich Internet applications?
- This week I've been putting together slides and preparing for my talk at Web 2.0 Expo New York City. I'm doing one titled "Making Sense of Rich Internet Applications" so it's more of a general talk covering everything from Adobe's stuff, to Microsoft Silverlight, to the mobile world, and now...
- Blog posts 2008-09-04
- Analyst: Google Chrome 'SOA ready'
- There's been plenty of excellent commentary about Google's new Chrome browser provided by my colleagues here in the ZDNet community, so I'm not going to go into any nitty-gritty here. But to look at it from an enterprise perspective, Chrome may help lay the groundwork for a...
- Blog posts 2008-09-04
- Who wins with Google Chrome
- Who wins with Google ChromeChrome adds a lot. By about any measure, Chrome will be way ahead of IE8.If there was nothing new here, there would be no excitement.Chrome Adds Nothing NewAt this point in time, Chrome adds effectively nothing new. It's little more than a late attempt to...
- Discussion threads 2008-09-03
- Five reasons Chrome will take over the world
- Five reasons Chrome will take over the worldFive reasons Chrome will take over the worldYou know what ZDNet needs? More articles about Chrome! 12 over the last 24 hours just isn't enough so why not add to that number.Chrome isn't taking over anything because its terribly broken. It doesn't render...
- Discussion threads 2008-09-03
- FlashDemo Studio (exe)
- Record your PC screen activity in real time to create interactive demonstrations, tutorials, and e-learning material. Key features: Record, edit, and share; Create stunning demo with ease. No programming skill required; Publish as Flash movie in extremely small file size. Perfect for Web distribution; Custom capture area; Record mouse and...
- Software downloads 2008-09-03
- 2008 Acura MDX
- Photo gallery:2008 Acura MDXThe 2008 Acura MDX remains largely unchanged from the 2007 model, when we reviewed the then-new redesign and found it chock full of tech options inherited from Acura's sedans, and with improved handling courtesy of similarly upgraded four-wheel-drive management. Back in 2006, the first-generation MDX had some...
- Product reviews 2008-09-02
- Dish Network TR-40 CRA
- Editors' note: This review is nearly identical to our review of the Dish Network DTVPal, as both products offer exactly the same functionality. However, since the TR-40 CRA costs less, CNET advises all buyers to go with the cheaper TR-40 CRA.Back at CES 2008, Dish Network promised to deliver a...
- Product reviews 2008-09-02
- StatusHQ: another Twitter clone for enterprise
- Twitter clones are starting to come out the woodwork. The latest candidate is StatusHQ, which surfaced last Friday and which my pal Luis Suarez describes as: "What Twitter could have been." Maybe, maybe not. The central premise behind StatusHQ is that individuals can...
- Blog posts 2008-09-01
- iClippy InetClipboard (exe)
- iClippy enhances Windows clipboard by automatically uploading clipboard contents to their Internet server and making it available for pasting into an Online application or chat. iClippy provides 5 different ways to copy the image from your PC, including free region and screen object captures. The images are saved Online into...
- Software downloads 2008-09-01
- Another view: WOA vs. SOA debate a distraction?
- Another view: WOA vs. SOA debate a distraction?WOA vs. ROA vs. SOARealistically, people have been using using RESTful services as part of SOA initiatives even if they didn't realize it for a few years already. You could even make the argument that Resource Oriented Architecture is going to subsume SOA,...
- Discussion threads 2008-08-31
- JavaScript 2.0: Why Give Programmers Crutches?
- JavaScript 2.0: Why Give Programmers Crutches?Crutches have their placeMy biggest complaint against C has always been that it makes it too easy to write buggy code.That said, given what JS is used for, what you describe appears to be severely overwrought.RE: JavaScript 2.0: Why Give Programmers Crutches?I disagree, having classes...
- Discussion threads 2008-08-29
- JavaScript 2.0: Why Give Programmers Crutches?
- [Guest Comment from Shane Steinert-Threlkeld] A new spec on which JavaScript 2.0 will be based , should be finalized by the end of the fall. Yet most of the proposed changes do close to nothing to actually improve the language. A lot of...
- Blog posts 2008-08-29
- Inside India's CAPTCHA solving economy
- No CAPTCHA can survive a human that's receiving financial incentives for solving it, and with an army of low-waged human CAPTCHA solvers officially in the business of "data processing" while earning a mere $2 for solving a thousand CAPTCHA's, I'm already starting to see evidence of consolidation between India's major...
- Blog posts 2008-08-29
- GXDeviceEditor (msi)
- Create a device profile of the protocol and parameters of any physical device. The profile is a device template, containing protocols, settings and messages understood by the device. Then create one or more user interfaces for the profile. New device types can be used immediately, without any upgrading. No programming...
- Software downloads 2008-08-29
- How do we address the have-nots?
- How do we address the have-nots?It's the NetThe problem is no longer the availability of hardware: many computers are being dumped that can easily be made productive again, by installing a lean Linux on it like Xubuntu. So poor people can have a fine computer for free. That's easy to...
- Discussion threads 2008-08-28
- Towerball (zip)
- Towerball is an entry for LD12 (www.ludumdare.com), a 48 hour game programming competition. The goal of the game is to guide two balls connected by a string to a yellow target. Set your trajectory and speed using the mouse, then left-click to fire and right-click to dampen your shot.Climb the...
- Software downloads 2008-08-28
- SOA adoption down from 2006: if so, why?
- SOA adoption down from 2006: if so, why?The SOA Problem has moved elsewhereMy comments here.http://www.gandalf-lab.com/blog/2008/08/soa-adoption-down-from-2006-are-you.htmlI think the problem SOA tried to solve has moved elsewhere. With WOA ,SaaS and crowd sourcing the notion of a central body managing all enterprise services has diluted and hence you see a lot of...
- Discussion threads 2008-08-27
- Internet Explorer 8 beta 2
- With the public release of its second beta, Microsoft said it intends for the Internet Explorer 8 browser to be more customer-oriented than previous versions of its browser. Our initial impression of Internet Explorer 8 Beta 2 is positive: we think Microsoft has not only caught up with Opera, Safari,...
- Product reviews 2008-08-27
- Internet Explorer 8 Beta 2 vs. Firefox 3.0.1
- Internet Explorer 8 Beta 2 vs. Firefox 3.0.1All part of the MS plan to keep browsers dumbded down. If we had reallygood browsers, how would they get people to use MS proprietary solutions for rich internet applications.RE: Internet Explorer 8 Beta 2 vs. Firefox 3.0.1The title says Firefox 3.0.1The graph...
- Discussion threads 2008-08-27
Neighboring Terms
Premier Vendor Content Whitepapers, webcasts & resources from our Power Center Sponsors
- Which solar technology will survive?
-
At the Cleantech Forum in San Francisco, Todd Glass of Heller Ehrman moderates a discussion, among tech execs, on the various solar technologies making a difference in the green movement.
- Watch the video >>
- Access the latest Intel and industry best practices
-
Designed specifically to address the concerns of senior IT managers at organizations with more than 100 employees, the Intel Premier IT Professional Program provides best practices via local and e-Seminars and a members-only Web site.
- View the Intel Premier IT Professional web-site tour >>
Ultraportables
- Understanding Ultraportable Laptops (BNET)
- Five steps to protect mobile devices anywhere, anytime (TechRepublic)
- View all ZDNet Toshiba laptop reviews
- From our sponsors
- Toshiba Satellite® U400 Series
-
- The ultra-portable, ultra-stylish Satellite® U405 is a smart choice for you and your small business. Only from the laptop expert, Toshiba. Explore the complete laptop lineup »



