Strengths and weaknesses of objects
By Joel Orr
"Software engineering" was an oxymoron for many years; programming was more of a black art than an engineering practice.
However, in the 1960s, a new paradigm appeared that has quietly transformed that world and influenced measurement, control, and automation ever more: Object-oriented programming (OOP).
OOP is bringing us the long-sought elusive promise of re-usable code, and of truly extensible systems-programs that can be scaled without multiplying their complexity. That means higher software reliability, greater maintainability, and lower costs.
Programming before objects was procedural; it was like building an apartment building. Object-oriented programming resembles the construction of houses in a field.
Think about the differences between a 10-story apartment building with 10 apartments on each floor, and a development with 100 individual houses. The development is more expensive to construct than the apartment building, because each house has its own utilities and more walls per dwelling unit. In the apartment building, units share walls, and the ceiling of one level is the floor of the next.
On the other hand, adding a dwelling unit to the apartment building is difficult and expensive, while an additional house in the development costs no more, in principle, than any of the first hundred.
A short course in object-oriented programming: Objects group into classes and have methods associated with them; we say an object belonging to a class is an instance of that class.
For the experts to formally consider a programming environment object-oriented, it must support four behaviors:
- Inheritance means new objects in a class "inherit" the characteristics of the class, although those characteristics can be individually modified by the programmer.
- Encapsulation means objects contain data and methods-behaviors that are triggered under certain conditions.
- Information hiding refers to an encapsulation in which certain details are not visible; for example, when you think of a car you do not think of all its components, nor necessarily of how it works.
- Polymorphism refers to the ability of a single message to "mean" different things to different objects.
Programming in an object-oriented environment consists of the creation of classes of objects that will collaborate to produce the desired effects. Debugging object-oriented programs can be very simple, or terrifyingly complex, depending on how well written they are.
"The object-based approach promises to make software easier to reuse, refine, test, maintain, and extend," said Brian Wilkerson of Apple. "But simply implementing an application in an object-based language does not guarantee these benefits. They can only be achieved if the implementation is based on a sound object-based design."
Adding capabilities to properly designed object-oriented programs is much easier than enhancing procedural programs, just as it is easier to add another house to a development than to add an apartment to an apartment building. Houses and objects are largely self-contained; the original plans of the apartment buildings and procedural programs completely determine and define them.
The qualities of object-oriented programs make possible the creation of "software components"-pieces of code that work in many programs with little integration effort. It is this promise more than any other that has attracted adherents to OOP.
The power of objects is in their robustness, extensibility, flexibility, and modularity. Their principal weakness, for now, is performance, which varies widely.
Actually, I wish engineers did not have to know about objects; except as interesting metaphors, they are not useful to anyone but computer professionals.
ABOUT THE AUTHOR
Dr. Joel Orr (Joel.firstname.lastname@example.org) is vice president and chief visionary at Cyon Research Corp. He will be at ISA EXPO 2006 as a panelist at "Dick's Last Retort".