1.1 Basic Concepts


Object-Oriented Strategies

Object-oriented programming embodies in software structures a number of powerful design strategies that are based on practical and proven software engineering techniques. By incorporating support for these strategies in software structures, object-oriented programming enables the manageable construction of more complex software systems than was previously possible. The nature of these software structures has been shaped by decades of software engineering experience. The basic design strategies that are embodied in object-oriented programming, which are presented in the table below, evolved as techniques for dealing with complex natural and man-made systems. These strategies are fundamental and pervasive; they are encountered in numerous design and problem-solving contexts and, in computer science, they are commonly found in the study of data structures, operting systems, and other programming language forms. What is stressed here is the relationship of these strategies to the design and construction of object-oriented software.

The design strategies in object-oriented programming languages are effective for constructing entities of the problem domain in software models. In fact, some have argued that software design is largely about constructing a software model of the "real world," where each "real" entity is represented in the program by a corresponding software component; the software component simulates the actions and conditions of its real-world counterpart. The programming-as-modeling philosophy is most evident in three-dimensional virtual environments, where the visual and auditory characteristics of the real world are simulated within the virtual world.

Design Strategies Embodied in
Object-Oriented Programming
abstraction simplifying the description of a
real-world entity to its essentials
separation treating "what" an entity does and
"how" it does it independently of
each other
composition

building complex "whole" systems by
assembling simpler "parts" in one of
two basic ways:

  • association, or
  • aggregation.
generalization

identifying common elements among
different entities in one of four ways:

  • hierarchy,
  • genericity,
  • polymorphism, or
  • patterns.

 

These strategies are widely supported by existing object-oriented languages though different languages may present them in different ways and some languages do not support all of the variations of each one. For example, some object-oriented languages may not support all of the types of generalization.

To master object-oriented programming one must understand the connections among the design strategies, the software structures supporting the strategies, and the software engineering goals that the strategies and structures are meant to achieve. Some of the principal connections are shown in the figure below. Understanding these connections enables the construction of useful and well-designed systems that solve important problems. The relationships depicted in the figure will be understood more deeply as the exploration of object-oriented programming unfolds.


Connections Among Strategies, Structures, and Goals

At this point most of the terms given as design strategies, object-oriented software structures, and software engineering goals are undefined. While these terms will be explained (see the Starting Points ), two observations can be made:

  • the structures of objects and classes relate to three of the four design strategies and one of the most important software engineering goals, reusability
  • the various forms of generalization relate to all of the software engineering goals, indicating the importance of understanding how to exploit these structures in creating quality software systems


A Plan of Study


The study of a body of material often depends on the learning style of the individual and is often iterative in progression. Some people learn more efficiently by understanding the overall concepts first, before proceeding to more concrete details. Other people learn more efficiently by intermixing the abstract concepts and the concrete examples. Regardless of the preference for a breadth-first approach or a depth-first approach, there are necessarily some ideas that must be learned before others, because the ideas build on one another and are not independent. In either style, a single reading is usually not sufficient. Backtracking and revisiting earlier concepts often enriches understanding and allows the formation of deeper insights into the material.

The overall structure of the material presented here is shown in the figure below; the design strategies are shown at the left. It is possible to read about these design strategies top-to-bottom and obtain a broad overview of object-oriented concepts and ideas, while at any point it is also possible to follow one of the arrows to the right: following an arrow in this direction leads to a more concrete presentation of the concept and its eventual description in C++.


Guide to Material

There are seven major milestones shown in the overall guide. Each milestone falls into one of three roles that are shown at the bottom of the figure. Each milestone is associated with a major design concept and represents a significant step forward in the practical skill of developing object-oriented software systems. The milestones, however, are ordered. It is not possible to proceed to a later one (one lower and more to the right in the figure) before all of the earlier ones (ones higher and to the left) have been completed.

The milestones form a progression of roles as shown along the bottom of the figure. The simplest role is that of a programmer using a single class or several classes that has already been developed. Simple, but interesting systems will be constructed in this first role. Initially, a single class will be used to explore and master basic issues of creating and manipulating objects. Several more classes are then added, allowing the construction of simple systems of interacting objects. Learning how to use existing classes to create and manipulate objects is the first step in learning about object-oriented programming. This first role is important not only because it establishes the foundation for the basic concepts of object-oriented programming, but also because this is the prefered role in developing real systems. As a user, you are able to benefit from the hard work already done by the designer and implementor of the existing classes. This opportunity to reuse existing classes is one of the major benefits of software reuse in general and object-oriented programming in particular. The second role is that of a developer creating one or more new classes. Initially, each class captures an independent abstraction. More difficult, but more powerful, is the development of collections of related classes using one of the forms of generalization. These first two roles will be extensively explored. The third role involves pattern - general organizations of classes and objects that have proven useful in solving commonly occurring design problems. This role will be explored, but only minimally. Mastery of the use of patterns requires considerable experience in building systems in one or more application domains.


Getting Started

The left column of the guide is repeated below. The entries in this table are the highest-level starting point for the study of object-oriented programming. Backtracking to this level and following new paths may happen often.

 

Let's get to it!

Additional C++ Topics

Tasks

One topic that is an interesting language feature supported in C++ but not supported in some other object-oriented languages is operator overloading. Using operator overloading, the designer of a class may provide his or her own application-specific meaning for most of the built-in operators ( +, -, *, /, =, ==, !=, <, >, etc.). Operator overloading is a useful means of providing an appealing, intuitive, and natural way to perform common operations on user-defined objects. Starting points for this topic are shown in the following box.

  1. Search the World Wide Web to find references to different object-oriented languages. How many can you find? Can you recognize in their descriptions any of the basic strategies identified in this section?

  2. Search the World Wide Web to find locations of other courses on object-oriented programming. What topics do these courses have in common? Save these links for reference during your study.

  3. Look at the Free On-Line Dictionary of Computing . Find definitions for the following terms:
    • abstraction
    • aggregation
    • encapsulation
    • hierarchy
    • genericity
    • polymorphism

    Save this link for future reference.

  4. Look at the C++ Virtual Library. Browse this library for ten minutes and report on three interesting things that you find. Keep this link for reference.



©1998 Prentice-Hall, Inc.
A Simon & Schuster Company
Upper Saddle River, New Jersey 07458

Legal Statement