Design Patterns Java™ Workbook

(Michael S) #1
Appendix C. UML at a Glance

Figure C.2. A MachineComposite object contains either Machine objects or other
composites. The Customer class depends on the LikeMyStuff class without
instantiating it.



  • Show a class name or a method name in italics to indicate that the class or method is
    abstract.

  • Use a closed, hollow arrowhead to point to a class's superclass.

  • Use a line between classes to indicate that instances of the classes are connected. Most
    commonly, a line on a class diagram means that one class has an instance variable that
    refers to the other class. The classes MachineComposite class, for example, uses a
    List variable that contains references to other machine components.

  • Use a diamond to show that instances of a class contain a collection of instances of
    another class.

  • An open arrowhead indicates navigability. Use it to emphasize that one class has a
    reference to another and that the pointed-to class does not have a back reference.

  • A multiplicity indicator, such as 0..1, indicates how many connections may appear
    between objects. Use an asterisk (*) to indicate that zero or more instances of an
    object of a class may be connected to objects of an associated class.

  • To show that a method may throw an exception, use a dashed arrow pointing from the
    method to the exception class. Label the arrow with a «throws» stereotype.

Free download pdf