Previous Section  < Free Open Study >  Next Section

4.2 The Uses Relationship

The first relationship in our list, as well as the first relationship that most developers come across, is called the uses relationship. Simply stated, if an object of one class sends a message to an object of another class, the first class is said to have a uses relationship with the second class. For example, consider Figure 4.1, in which an object of class Person is sending a message to an object of class AlarmClock to set its time to 10:30. The Person class is said to use the AlarmClock class. Does this imply that all objects of class Person send messages to objects of class AlarmClock? Of course not. This is why we claim that the uses relationship is object-based, that is, not all objects of the class are required to obey the relationship.

Figure 4.1. A person using an alarm clock.

graphics/04fig01.gif

    Previous Section  < Free Open Study >  Next Section