April 90 - HOW TO DESIGN AN OBJECT-BASED APPLICATION
HOW TO DESIGN AN OBJECT-BASED APPLICATION
BRIAN WILKERSON
The object-based approach promises to make software easier to reuse, refine, test,
maintain, and extend. 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. This article presents a
process for creating such a design.
As every programmer knows, software applications are becoming increasingly
complex, and as a result, increasingly expensive to build and maintain. The good news
is that if you are willing to spend the time to carefully develop an object-based design
for your software, implementation can proceed smoothly and quickly, and the resulting
software will be relatively easy to reuse, refine, test, maintain, and extend. This
article gives an overview of the object-based approach and then describes step by step
a two-phase process for designing an object-based application.
BASIC CONCEPTS OF THE OBJECT-BASED APPROACH
Programmers familiar with non-object-based languages are used to dividing
information into two distinct kinds: functions and data. Procedural programming,
based on this division of information, focuses on how to accomplish the goals of the
program. It begins by identifying the high-level tasks that need to be performed, and
then decomposing each task into smaller tasks until the level of the language statement
is reached. Procedural programming concerns itself almost immediately with the
implementation of the program: the steps that compose each function, and the
particulars of the data to be operated upon.
By contrast, the focus of the object-based approach is more abstract. It asks first
about the intention of the program: asking what, not how. It views the programming
process as one of modeling the world. It begins by identifying the things inhabiting the
part of the world being modeled, and the behavior of those things, both as individuals
and with respect to the other things in the world.
The object-based approach uses abstraction to manage the complexity inherent in
real-world problems. An abstraction is a simplified picture of the world, arrived at
by generalizing about details. The object-based approach relies on abstraction
mechanisms such as encapsulation, information hiding, polymorphism, and
inheritance.
ENCAPSULATION
Encapsulation is the enclosing of a number of separate related things within a single
physical or conceptual capsule. For example, a telephone number encapsulates
individual digits at a higher, abstract level at which the numbers form a single entity.
When you think of your telephone number, you don't think of it as seven separate