John's Tractor Bob's Tractor

Figure 2-1. Examples of classification and instantiation.

The second abstraction principle is aggregation. Aggregation refers to the principle that considers things in terms of part-whole hierarchies. Concepts in a problem domain can be treated as aggregates (i.e., composed of other concepts/parts). A part itself can be considered as composed of other parts of smaller granularity. Decomposition is the reverse operation of aggregation; it consists of identifying parts of an aggregation. Object-oriented languages provide support for aggregation/decomposition by allowing objects to have attributes that are objects themselves. Thus, complex structures can be obtained by using the principle of aggregation. Note that some authors use the term composition instead of aggregation.

Figure 2-2 shows an example of aggregation and decomposition. Concept Tractor can be considered as an aggregation/composition of other concepts such as Chassis, Body, and Engine. Concept Body can be considered as one of the parts composing a more complex concept such as Tractor.

Aggregation and Decomposition


0 0

Post a comment