Also available in Advanced Object-Oriented Analysis and Design Using UML
Journal Of Object-Oriented Programming Vol 5, No 8. January 1994
Copyright © 1994 SIG Publications, Inc, New York, NY
by James J. Odell, Cambridge University Press, 1998
Also available in Advanced Object-Oriented Analysis and Design Using UML
Linguistics, logic, and cognitive psychology have focused on understanding the nature of relationships. One important type of relationship is the association between the parts of things and the wholes they make up. In a joint paper, Morton Winston, Roger Chaffin, and Douglas Herrmann [Winston, 1987] discuss various expressions of the whole-part association:
Component-integral object composition
The most common form of composition is the component-integral object relationship.
However, when a component ceases to support the overall pattern of an object, a different kind of association results. For example, if a handle were ripped from the door of a car, the handle would no longer be considered part of the car. It could, however, be considered a piece of the car. Unlike components, pieces do not participate in the overall pattern of the object. They provide no functional support for the whole and typically have arbitrary boundaries.
In component-integral object relationships, parts can be removed. In material-object composition they can not.
The word partly is not a requirement of the material-object relationship. For instance, a windshield could be made entirely of glass--not just partly. Other material-object relationships require a subjective judgment. For example, can the ceramics (of the spark plugs) be removed from a car? If so, ceramics is a component-integral object relationship, instead.
The relationships presented above define a configuration of parts that are different from each other and the whole they compose. In the portion-object relationship, the parts are homeomeric, that is, the parts are the same kind of thing as the whole.
Portions of objects can be divided by means of standard measures, such as inches, millimeters, liters, hours, parsecs, and so on. Therefore, a meter is part of a kilometer or an hour is part of a day. In this way, the portion-object relationship is important for the arithmetic operations of addition, subtraction, multiplication, and division.
The similarity, then, between a portion and its whole permits us to use a form of selective inheritance of properties during implementation. For example, the kinds of ingredients in a loaf of bread are the same as its portions. However, the quantity of ingredients for the loaf is not identical for each portion. The component-integral object relationship also permits certain properties of the whole to apply to the parts. For instance, the velocity of a car can also be implied as the velocity of its parts. However, since portions are similar to the whole, many more implications can be made.
Other terms that are often used in place of portion are slice, helping, segment, lump, or drop. The word piece is also used. However, care must be taken to ensure that all of the pieces are similar in nature. While the pieces of a splattered tomato are tomato, the pieces of an exploded car are not car.
In the portion-object relationship, each homeomeric piece is removable. In the place-area composition, the pieces cannot be removed.
In the composition relationships above, the parts bear a particular functional or structural relationship to one another or to the object they comprise. Member-bunch composition has no such requirement. The only requirement is that the parts are a member of a collection.
Members in a partnership define an invariant form of member-bunch composition.
Composition relationships and their properties
The following table illustrates the properties that apply to each of the six kinds of composition discussed above.
In the section above, six kinds of relationships were presented that express composition. Composition, however, is easily confused with many other kinds of relationships, such as spatial inclusion, classification inclusion, attribution, attachment, and possession. These noncompositional forms are discussed in this section.
Composition is often confused with containment or topological inclusion. Topological inclusion is the relationship between a container, area, or temporal duration and that which is contained. A few examples are:
Topological inclusion is most commonly confused with place-area composition. An example of a place-area composition is San Francisco is part of California. San Francisco is surrounded by California, just as Monument Valley is surrounded by Arizona and Utah. However, San Francisco is also part of California, because of an additional connection between the two--every part of San Francisco is also California. In contrast, no part of Monument Valley is Arizona or Utah, because it is part of the Navaho Indian Reservation.
The extension of a concept is defined as the set of objects to which a concept applies. Therefore, we can say that Gone with the Wind is part of the set of objects to which the Book concept applies. However, we would not say that Gone with the Wind is part of a Book. Instead, we would say that Gone with the Wind is an instance of a Book. Therefore, Gone with the Wind has a classification relationship with Book, not a member-bunch relationship.
Classification relationships can be easily confused with member-bunch relationships. Both involve the membership of objects in a set of objects. However, the member-bunch relationship is determined by spatial, temporal, or social connection. In contrast, the classification relationship is based on the idea that a common concept applies to each.
The properties ascribed to an object can be confused with composition. For instance, a Lighthouse has such properties as height and weight. Therefore, height and weight can be considered as part of the properties of each Lighthouse. However, properties are not components of the object itself. Instead, they are mappings from the object to other objects. While each Lighthouse has height as a property, height is not part of a Lighthouse.
Attachment of one object to another does not guarantee composition. For example, Toes are attached to Feet and they are also part of feet. However, while Earrings are attached to ears, they are not part of Ears. For attachment to specify a component-object relationship, the component must provide functional support for the whole. While Toes provide functional support for the Foot, Earrings do not provide functional support for the Ear.
Finally, ownership is often confused with composition. For example, it is true that a Bicycle has Wheels and that the Wheels are part of the Bicycle. However, while it may be true to say that the Girl Betty has a Bicycle, saying that the Bicycle is part of Betty is not true.
THE TRANSITIVITY PROBLEM IN COMPOSITION
A relationship is considered transitive if: whenever A relates to B and B relates to C, then A relates to C in the same manner. When relationships are transitive, valid syllogistic inferences can be made. An example of a syllogism is
premise 1b- All men are mortal
conclusion 1- Socrates is mortal
premise 2b- The pistons are part of the engine (component-integral object)
conclusion 2- The pistons are part of the car
premise 3b- Bob is a member of the Math Department (member-bunch)
conclusion 3?- Bob's arm is component/member of the Math Department
premise 4a- The refrigerator is part of the kitchen (component- integral object)
premise 4b- The kitchen is part of the house (place-area)
conclusion 4?- The refrigerator is part of the house
premise 5a- The loaf is partly flour (material-object)
premise 5b- A slice of bread is part of a loaf of bread (portion-object)
conclusion 5- A slice of bread is partly flour
However, when the same kind of relationship is used, the conclusion is always correct. Composition is a transitive relationship. However, it is transitive only when the same kind of composition is used by the premises.
Knowing this fact is very useful when propagating operations on composition relationships. For instance, in a CAD/CAM application the user can request that a particular image of a car be rotated. Since the car is made up of many components, the rotation operation can be propagated to all parts of a car, as well. Since each component in the car can also have component-object relationships with other parts, these parts, too, can be rotated--and so on.
Another way of explaining this is by referring to premises 2a and 2b, above. Since both premises employ the same kind of composition relationship, the conclusion is correct. Therefore, since the pistons are truly part of the car, any operation applied to the car can be propagated to the pistons. However, with premises 3a and 3b this is not necessarily true. For example, giving a ten-percent pay raise to the Math Department could result in Bob getting a ten-percent raise.[*] However, since premise 3a is a different kind of composition relationship, Bob's arm is probably not a reasonable candidate for receiving a pay raise. Therefore, the number of composition levels that can be reliably propagated is based on whether the kind of composition relationship is the same. As long as this is true, the propagation can be inferred. If the kind of relationship is different, the application of propagation at each level must be examined for validity.
Composition (also referred to as aggregation) is a mechanism for forming an object whole using other objects as its parts. It reduces complexity by treating many objects as one object. This column examines six ways in which we form these whole-part associations. The six kinds of relationships are determined by combinations of three basic properties: configuration, homeomerism, and invariance.
These six kinds provide a reasonable guide to how we employ whole-part relationships. However, they also help us to identify where composition is truly transitive and where it is not. As long as the kind of composition relationship remains the same, transitivity exists and propagation of operations can be inferred. If the kind of relationship is different, the application of propagation at each level is not guaranteed and must be examined for validity.
Winston, Morton E., Roger Chaffin, and Douglas Herrmann, "A Taxonomy of Part-Whole Relations," Cognitive Science, 11, 1987, pp. 417-444.
The author would like to acknowledge Conrad Bock of IntelliCorp for providing the material on which this column is based. Additionally, I would like to thank Conrad Bock and Stevan Mrdalj for their kind and helpful comments while producing this column.
James Odell is a consultant, educator, and author. He works with Kabira, IntelliCorp, James Martin & Co., and Quoin, Inc., and can be reached by telephone at (734) 994-0833 or by email at mailbox at jamesodell dot com.