Previous Section  < Free Open Study >  Next Section

4.10 A Relationship Between Uses and Containment?

Another topic related to the containment relationship involves an interesting intermediate relationship that falls somewhere between uses and containment. I first discovered this distinction while performing a design critique at a process control company that was writing software to control semiconductor chip processing hardware. The hardware looked very much like a restaurant steam table with three robots hanging off of it. The "steam table" was made up of a number of small stainless steel tanks, each containing treatment baths for racks of etched silicon wafers. Some of the baths were acidic treatments, some were alkaline treatments, and some were rinsing water baths. The control software was to run a rack of wafers through a "recipe" whose steps placed the rack in a particular tank for a certain amount of time. The movement of the racks was performed via one of the three robots. To better understand their problem, the system architects used the clever real-world analogy of a traveler. The racks were the travelers, the tanks were hotels, and the robots were airplanes. A discussion quickly divided the design team into two camps. This discussion revolved around the relationship between hotels and their guests, that is, the racks of wafers and the acid, alkaline, and water baths. One camp stated that the relationship between the two is a uses relationship, while the other argued that it is a containment relationship. The camp arguing for containment made the mistake of stating that the relationship was not the uses relationship. This position became impossible to defend since the containment relationship implies the uses relationship. The result was a significant loss of time as the two camps argued.

Since this first discussion, the problem has manifested itself repeatedly in my design courses. If you ask a group of people the relationship between a classroom and its students, over 80 percent will typically say containment. If you ask those people to keep their hands up as long as they agree with containment, and then ask for the relationship between a parking lot and its cars, a few will drop their hands. If you then ask for the relationship between a gas station and its cars, then almost all of the hands will drop. Why? It is clear that these relationships are equivalent. Where does this temporal dependence originate? To make the problem worse, consider the relationship between a car and its engine. Almost all designers agree that this is containment, but the engine can be removed from the car in much the same way that people are removed from classrooms and cars from gas stations.

The solution to these problems requires that designers understand that there are three, and not two, relationships involving uses and containment. The first is clearly a uses relationship and is never confused with containment. A good example is "person uses an alarm clock." There is no hint of containment here. Then there is the car and its engine example. This is clearly containment (which implies uses). However, a third relationship lies between these two extremes. This is the domain of the parking lot and its cars, the classroom and its students, and the gas station and its cars. Some groups simply consider this intermediate category as a uses relationship since it does not exhibit the design-simplifying attribute of a true containment relationship: This relationship does not guarantee that we can ignore the contained objects at some high level of design. The important thing is to understand the three concepts; what we call them is irrelevant. Some groups with which I have dealt refer to them as composition, containment, uses, respectively; others call them containment, uses, uses; others call them containment, containment, uses; and still others have called them strong containment, weak containment, and uses. A good test for knowing whether you have the strong or weak form of containment is to ask yourself the following question: "If I remove the contained object, is the behavior of the containing class modified?" If the answer is yes, then you have the strong form of containment (composition?); if the answer is no, then you have the weak form. If I remove a student from a classroom, is the behavior of the classroom affected? No. If I remove the engine from a car, is the behavior of the car affected? Yes.

    Previous Section  < Free Open Study >  Next Section