|
UML Reference Card
Allen I. Holub
|
|
|
Comments. Any kind of information that isn't easily representable in UML, including comments, implementation-level code, etc. Also used for a long constraint. | ||||||||||||||||||||||
|
Design Patterns
|
||||||||||||||||||||||
|
Packages
|
||||||||||||||||||||||
|
Classes. Box contains three compartments:
1 Java, unfortunately, defaults to "package" access when no modifier is present. In my flavor of UML, a missing access privilege means "public." You could reasonable argue that "private" would be a better default, but most methods that appear in the class box are public. |
||||||||||||||||||||||
|
Associations (relationships between classes).
|
||||||||||||||||||||||
|
Implementation Inheritance (Generalize/Specialize)
|
||||||||||||||||||||||
![]() |
Interface Inheritance (Specifies/Refines).
A contract that specifies a set of methods that must be implemented by the derived class. In C++, an interface is a class containing nothing but pure virtual methods. Java supports them directly. (c.f.. "abstract class," which can contain method and field definitions in addition to the abstract declarations.) Interfaces contain no attributes, so the "attributes" compartment is always empty. The "inheritance" relationship line is dashed if the base class is an interface.
My extensions to UML:
|
||||||||||||||||||||||
|
Dependency. User uses Resource, but Resource is not a member of the User class. If Resource is modified, some method of User might need to be modified. Resource is typically a local variable or argument of some method in User. | ||||||||||||||||||||||
|
Aggregation (comprises) relationship. Destroying the "whole" does not destroy the parts. | ||||||||||||||||||||||
|
Composition (has) relationship.
The parts are destroyed along with the "whole."
Doesn't really exist in Java. In C++:
class Container { Item item1; // both of these are Item *item2; // "composition" public: Container() { item2 = new Item; } ~Container(){ delete item2; } } |
||||||||||||||||||||||
|
Navigability Messages flow in direction of arrow (only). Implicit when no role present: if an object doesn't have a role in some relationship, then there's no way to send messages to it. | ||||||||||||||||||||||
|
Constraint
A constrained relationship
requires some rule to be applied.
(e.g. {ordered})
Often combined with aggregation, composition, etc. |
||||||||||||||||||||||
|
Complex Constraint Comments
|
||||||||||||||||||||||
|
Qualified Association (hash-table, associative array, "dictionary").
class User { // A Hashtable is an associative array, indexed // by some key and containing some value. private Hashtable bag = new HashTable(); private void add(String key, Item value) { bag.put( key, value ); } } |
||||||||||||||||||||||
|
Association Class
|
New Style (UML):
Old Style (Booch):
|
Objects and Messages
|
|
Object Creation
|
|
Conditions, Loops, Grouping
|
|
Loops, Alternative (My own extension to UML.)
|
|
Asynchronous Messages
|
|
Callbacks, Recursion
|
Arrow Heads for Asynchronous Messages
| Symbol | Message Type |
Description |
|
Simple | Don't care how it's handled. Usually asynchronous. |
|
Synchronous | The sender effectively blocks until the handler completes. This is a normal function call in a single-threaded application. |
|
Asynchronous | The handler returns immediately, but the actual work is done in the background and the sender can move on to other tasks while processing goes on. |
|
Balking | The receiving object can refuse to accept the message request. This could happen if an "active" object's message queue fills, for example. |
|
Timeout | The message handler typically blocks, but will return after a predetermined amount of time, even if the work of the handler is not complete. |
|
Starting and Stopping. |
|
Synchronization. When several activities can go on in parallel, indicates when all activities must be finished in order to continue. |
|
Guards (tests). This path is used only if the text in the brackets is true. |
|
Decision. A decision activity, the guard labels the decision that was made. |
|
Swim Lanes. Activities are arranged into vertical zones delimited with dashed lines. Each zone represents the responsibilities of a particular class or actor. |
|
|
|
|