Previous Section  < Free Open Study >  Next Section

4.1 Introduction to Class and Object Relationships

An object-oriented design requires that the developer first find some of the key abstractions of the system along with their well-defined public interfaces. The second step consists of describing the relationships between these key abstractions. In the object-oriented paradigm, we discuss these relationships as falling into one of four categories:

  • the uses relationship (object-based);

  • the containment relationship (object-based);

  • the inheritance relationship (class-based);

  • the association relationship (object-based).

The term "object-based versus class-based" does not describe the method in which a relationship is defined, namely, with objects or with classes (respectively). It denotes whether or not all objects of a class have to obey the relationship. We will see that this is not the case with uses, containment, or association, but it is true for inheritance. An object-oriented design is made up of the classes, their protocols, and a description of the four relationships just listed (minimally). Each relationship has its own characteristics and can be dangerous when used in the wrong area of design. With this in consideration, each has its own heuristics governing its correct use.

    Previous Section  < Free Open Study >  Next Section