Object-oriented programs have two kinds of structure. One can be seen in the inheritance hierarchy of class definitions. The other is evident in the pattern of message passing as the program runs. These messages reveal a network of object connections.
The inheritance hierarchy explains how objects are related by type. For example, in the program that models water use, it might turn out that Faucets and Pipes are the same kind of object, except that Faucets can be turned on and off and Pipes can have multiple connections to other Pipes. This similarity would be captured in the program design if the Faucet and Pipe classes inherit from a common superclass.
The network of object connections explains how the program works. For example, Appliance objects might send messages requesting water to Valves, and Valves to Pipes. Pipes might communicate with the Building object, and the Building object with all the Valves, Faucets, and Pipes, but not directly with Appliances. To communicate with each other in this way, objects must know about each other. An Appliance would need a connection to a Valve, and a Valve to a Pipe, and so on. These connections define a program structure.
Object-oriented programs are designed by laying out the network of objects with their behaviors and patterns of interaction and by arranging the hierarchy of classes. There’s structure both in the program’s activity and in its definition.
Outlet Connections
Aggregation and Decomposition
Models and Frameworks
Last updated: 2007-12-11