UML 2 For Dummies


Showing Static Relationships in a Class Diagram

There is a lot more to this world than just objects. Relationships between objects are just as important as the objects. In UML these relationships are defined using associations and links. To give you a concrete sense of these relationships, we use several different examples. Our first example involves a company that rents crash dummies to clients for tests. Consider this the Rent-A-Crash Dummy example. You have to relate the crash dummies to the clients who rent them—and show that a specific crash dummy named MAX was rented to a client named Safety ’R Us.

Remember An instance of a class is an object. We use the words object and instance interchangeably.

Links are instances of associations. Associations relate classes, whereas links relate instances of those classes (objects). So a link would connect an object in the Client class with an object in the CrashDummy class.

You show a simple association by drawing a line between the two classes you want to relate. Likewise, you show a link by drawing a line between two instances of two associated classes.

After you have specified that two classes are associated, think about a few details for depicting the association. Here’s a quick list (which we discuss further later in this chapter):

Well, yes, there are a lot of details here, but the chapter takes you through them. Fortunately, you don’t have to place all these details on each and every association in your diagrams. Usually the name of the association and the multiplicities are all you need.


Категории