SlideShare a Scribd company logo
1 of 2
Download to read offline
UML REFERENCE CARD
© 1998 Allen I. Holub. All Rights Reserved.
Available from <http://www.holub.com>.
Static Model Diagrams
Packages
• C++ namespace.
• Group together functionally-similar classes.
• Derived classes need not be in the same package.
• Packages can nest. Outer packages are sometimes
called domains. (In the diagram, “Tools” is arguably
an outer package, not a domain).
• Package name is part of the class name (e.g. given the
class fred in the flintstone package, the fully-qualified
class name is flintstone.fred).
• Generally needed when entire static-model won’t fit
on one sheet.
Classes (Box contains three compartments)
1. The name compartment (required) contains the class
name and other documentation-related information:
E.g.:
Some_class «abstract»
{ author: George Jetson
modified: 10/6/2999
checked_out: y
}
• Guillemets identify stereotypes. E.g.: «static»,
«abstract» «JavaBean». Can use graphic instead of
word.
• Access privileges (see below) can precede name.
• Inner (nested) classes identify outer class as prefix
of class name: (Outer.Inner or Outer::Inner).
2. The attributes compartment (optional):
• During Analysis: identify the attributes (i.e. defin-
ing characteristics) of the object.
• During Design: identify a relationship to a stock
class.
This:
is a more compact (and less informative) version of
this:
Everything, here, is private. Always. Period.
3. The operations compartment (optional) contains
method definitions. Use implementation-language
syntax, except for access privileges:
• Abstract operations (C++ virtual, Java non-final)
indicated by italics (or underline).
• Boldface operation names are easier to read.
If attributes and operations are both omitted, a more com-
plete definition is assumed to be on another sheet.
1
Java, unfortunately, defaults to “package” access when no modifier is present. In my
“flavor” of UML, a missing access privilege means “public”.
Associations (relationships between classes)
• Associated classes are connected by lines.
• The relationship is identified, if necessary, with a < or
> to indicate direction (or use solid arrowheads).
• The role that a class plays in the relationship is identi-
fied on that class's side of the line.
• Stereotypes (like «friend») are appropriate.
• Unidirectional message flow can be indicated by an
arrow (but is implicit in situations where there is only
one role):
• Cardinality:
• Example:
class Company
{
private Employee[] peon = new Employee[n];
public void give_me_a_raise( Employee e ) { ... }
}
class Employee
{
private Company employer;
private Employee boss;
private Vector flunkies = new Vector();
public void you_re_fired() { ... }
}
(A Java Vector is a variable-length array. In this case it
will hold Employee objects)
Implementation Inheritance
Outline arrows identify derivation relationships: extends,
implements, is-a, has-properties-of, etc. Variations include:
Interface Inheritance
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.)
My extension to UML: rounded corners identify interfaces.
If the full interface specification is in some other diagram, I
use:
Strict UML uses the «interface» stereotype in the name
compartment of a standard class box:
Interfaces contain no attributes, so the attribute compart-
ment is always empty.
Java.awt
com.hulub
Application
Database
Interfaces
Oracle
Sybase
Tools
Class name
Attributes:
Operations:
+ public
# protected
- private
~ package (my extension to UML)1
Person
String name;
Person String
name
1 Usually omitted if 1:1
n Unknown at compile time, but bound.
0..1 (1..2 1..n)
1..* 1 or more
* 0 or more
1..* 1..*
relationship
A’s role in B B’s role in A
A B
Sender Receiver
Company
give_me_a_raise(Employee e)
Employee
you_re_fired()
1
employer peon
<works for 1..n
boss
1
1..* flunkies
SuperClass
- void concrete();
+ int override();
SubClass
+ int override();
+ int additional();
User
f() { x.operation() }
Iface Name
operation()
Implementer
operation()
relationship
x
User
Name
Implementer
InterfaceName
«interface»
Operations
Aggregation (comprises)
• Destroying the “whole” does not destroy the parts.
• Cardinality is allowed.
Composition (has) relationship
• The parts are destroyed along with the whole.
• Doesn’t really exist in Java.
• In C++:
class Container
{
Obj item1;
Obj *item2;
public:
Whole() { item2 = new Obj; }
~Whole(){ delete item2; }
};
Constraint
• A constrained relationship requires some rule to be
applied (e.g. {ordered}). Often combined with aggre-
gation, composition, etc.
• In the case of {or}, only one of the indicated relation-
ships will exist at any given moment (a C++ union, or
reference to a base class).
• {subset} does the obvious.
• In official UML, put arbitrary constraints that affect
more than one relationship in a “comment” box, as
shown. I usually leave out the box.
Qualified Association
• Hash tables, associative arrays, etc.
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
• Use when a class is required to define a relationship.
• Somewhere, an additional relationship is required to
show ownership. (The one between person and Ticket
in the current example).
Dynamic-Model (Sequence) Diagrams
Objects and Messages (new style)
• Top boxes represent objects, not classes. You may
optionally add “:class” to the name if desired.
• Vertical lines represent the objects “life line”, or exist-
ence.
• Broken lifeline indicates the object is inactive, a rect-
angle indicates the object is active.
• represent messages being sent.
• (optional if synchronous) represent method
return. (May label arrow with name/type of returned
object).
• Sending object’s class must have:
1. An association of some sort with the receiving
objects class.
2. The receiver-side class’s “role” must be the same as
the name of the receiving object.
Object Creation
• The new instance appears at end of creation message
arrow.
• Destruction is accomplished by terminating the lifeline
with a large X:
Conditions
• Message sent only if conditional expression is true.
• The cond_expr is typically expressed in the imple-
mentation language.
Loops (extension to UML)
• Don’t think loops, think what the loop is accomplish-
ing.
• Typically, you need to send some set of messages to
every element in some collection. Do this with every.
• You can get more elaborate (every receiver where x<y)
• The diagram above comes from:
and maps to the following code:
class sender_class
{
receiver_class receiver[n];
public do_it() {
for(int i = 0; i < n; ++i)
receiver[i].message();
}
}
Arrow Styles for Messages
Asynchronous Callbacks
• Callback occurs while Sender is potentially executing
something else.
Part
Whole
Item
Container
role
Container
Item
Identity key()
{ordered}
role
Collection {or}
Container
Container
Comittee Person
{subset}
member-of *
*
*
1 chair-of
Comittee Comittee
{person.employer ==
Person.boss.employer}
0..1 *
boss peon
employee employer
* 0..1
User
add(String key,
Item value)
key Item
bag
Ticket
Person
Airline
Date when;
Seat where;
Airport to;
Airport from;
carrier passenger
<travels on
<buys
Sender Receiver
message()
message()
Sender
Receiver
new
Sender
Receiver
new
message()
Sender Receiver
[cond_expr] message()
Symbol Type Description
Simple Don’t care. Usually read as the
same as synchronous.
Synchronous Sender blocks until return.
Asynchronous Handler returns immediately and
both sender and receiver work
simultaneously.
Sender
Receiver
message()
Every
do_it()
sender_class
void do_it()
receiver_class
void message()
1 n
sender receiver
x
Sender Receiver
message()
callback()

More Related Content

Similar to UML Reference Card.pdf

14_inheritance.ppt
14_inheritance.ppt14_inheritance.ppt
14_inheritance.pptsundas65
 
Principles of functional progrmming in scala
Principles of functional progrmming in scalaPrinciples of functional progrmming in scala
Principles of functional progrmming in scalaehsoon
 
Programming in Java: Combining Objects
Programming in Java: Combining ObjectsProgramming in Java: Combining Objects
Programming in Java: Combining ObjectsMartin Chapman
 
UML Diagram @ Software engineering discussion
UML Diagram @ Software engineering discussionUML Diagram @ Software engineering discussion
UML Diagram @ Software engineering discussionCherryBerry2
 
Classes & objects new
Classes & objects newClasses & objects new
Classes & objects newlykado0dles
 
C++ Programming Course
C++ Programming CourseC++ Programming Course
C++ Programming CourseDennis Chang
 
Ccourse 140618093931-phpapp02
Ccourse 140618093931-phpapp02Ccourse 140618093931-phpapp02
Ccourse 140618093931-phpapp02Getachew Ganfur
 
Unified modeling language
Unified modeling languageUnified modeling language
Unified modeling languageamity2j
 
Ooad lab manual
Ooad  lab manualOoad  lab manual
Ooad lab manualPraseela R
 
Intro to Python (High School) Unit #2
Intro to Python (High School) Unit #2Intro to Python (High School) Unit #2
Intro to Python (High School) Unit #2Jay Coskey
 
06 class diagrams
06 class diagrams06 class diagrams
06 class diagramsBaskarkncet
 
Descriptions of class diagrams in software
Descriptions of class diagrams in softwareDescriptions of class diagrams in software
Descriptions of class diagrams in softwaressuser9d62d6
 
introofUML.pptx
introofUML.pptxintroofUML.pptx
introofUML.pptxRojaPogul1
 
Question and answer Programming
Question and answer ProgrammingQuestion and answer Programming
Question and answer ProgrammingInocentshuja Ahmad
 
Design patterns with Kotlin
Design patterns with KotlinDesign patterns with Kotlin
Design patterns with KotlinAlexey Soshin
 

Similar to UML Reference Card.pdf (20)

Design patterns
Design patternsDesign patterns
Design patterns
 
14_inheritance.ppt
14_inheritance.ppt14_inheritance.ppt
14_inheritance.ppt
 
Claas diagram
Claas diagramClaas diagram
Claas diagram
 
Claas diagram
Claas diagramClaas diagram
Claas diagram
 
Principles of functional progrmming in scala
Principles of functional progrmming in scalaPrinciples of functional progrmming in scala
Principles of functional progrmming in scala
 
Programming in Java: Combining Objects
Programming in Java: Combining ObjectsProgramming in Java: Combining Objects
Programming in Java: Combining Objects
 
UML Diagram @ Software engineering discussion
UML Diagram @ Software engineering discussionUML Diagram @ Software engineering discussion
UML Diagram @ Software engineering discussion
 
Java chapter 5
Java chapter 5Java chapter 5
Java chapter 5
 
Classes & objects new
Classes & objects newClasses & objects new
Classes & objects new
 
C++ Programming Course
C++ Programming CourseC++ Programming Course
C++ Programming Course
 
Ccourse 140618093931-phpapp02
Ccourse 140618093931-phpapp02Ccourse 140618093931-phpapp02
Ccourse 140618093931-phpapp02
 
Unified modeling language
Unified modeling languageUnified modeling language
Unified modeling language
 
Ooad lab manual
Ooad  lab manualOoad  lab manual
Ooad lab manual
 
Intro to Python (High School) Unit #2
Intro to Python (High School) Unit #2Intro to Python (High School) Unit #2
Intro to Python (High School) Unit #2
 
Class and object
Class and objectClass and object
Class and object
 
06 class diagrams
06 class diagrams06 class diagrams
06 class diagrams
 
Descriptions of class diagrams in software
Descriptions of class diagrams in softwareDescriptions of class diagrams in software
Descriptions of class diagrams in software
 
introofUML.pptx
introofUML.pptxintroofUML.pptx
introofUML.pptx
 
Question and answer Programming
Question and answer ProgrammingQuestion and answer Programming
Question and answer Programming
 
Design patterns with Kotlin
Design patterns with KotlinDesign patterns with Kotlin
Design patterns with Kotlin
 

Recently uploaded

2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge GraphsEleniIlkou
 
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋nirzagarg
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查ydyuyu
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...SUHANI PANDEY
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLimonikaupta
 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...SUHANI PANDEY
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Delhi Call girls
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...Neha Pandey
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdfMatthew Sinclair
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableSeo
 
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdfMatthew Sinclair
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceDelhi Call girls
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfJOHNBEBONYAP1
 
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...roncy bisnoi
 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubaikojalkojal131
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC
 
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...SUHANI PANDEY
 

Recently uploaded (20)

2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
 

UML Reference Card.pdf

  • 1. UML REFERENCE CARD © 1998 Allen I. Holub. All Rights Reserved. Available from <http://www.holub.com>. Static Model Diagrams Packages • C++ namespace. • Group together functionally-similar classes. • Derived classes need not be in the same package. • Packages can nest. Outer packages are sometimes called domains. (In the diagram, “Tools” is arguably an outer package, not a domain). • Package name is part of the class name (e.g. given the class fred in the flintstone package, the fully-qualified class name is flintstone.fred). • Generally needed when entire static-model won’t fit on one sheet. Classes (Box contains three compartments) 1. The name compartment (required) contains the class name and other documentation-related information: E.g.: Some_class «abstract» { author: George Jetson modified: 10/6/2999 checked_out: y } • Guillemets identify stereotypes. E.g.: «static», «abstract» «JavaBean». Can use graphic instead of word. • Access privileges (see below) can precede name. • Inner (nested) classes identify outer class as prefix of class name: (Outer.Inner or Outer::Inner). 2. The attributes compartment (optional): • During Analysis: identify the attributes (i.e. defin- ing characteristics) of the object. • During Design: identify a relationship to a stock class. This: is a more compact (and less informative) version of this: Everything, here, is private. Always. Period. 3. The operations compartment (optional) contains method definitions. Use implementation-language syntax, except for access privileges: • Abstract operations (C++ virtual, Java non-final) indicated by italics (or underline). • Boldface operation names are easier to read. If attributes and operations are both omitted, a more com- plete definition is assumed to be on another sheet. 1 Java, unfortunately, defaults to “package” access when no modifier is present. In my “flavor” of UML, a missing access privilege means “public”. Associations (relationships between classes) • Associated classes are connected by lines. • The relationship is identified, if necessary, with a < or > to indicate direction (or use solid arrowheads). • The role that a class plays in the relationship is identi- fied on that class's side of the line. • Stereotypes (like «friend») are appropriate. • Unidirectional message flow can be indicated by an arrow (but is implicit in situations where there is only one role): • Cardinality: • Example: class Company { private Employee[] peon = new Employee[n]; public void give_me_a_raise( Employee e ) { ... } } class Employee { private Company employer; private Employee boss; private Vector flunkies = new Vector(); public void you_re_fired() { ... } } (A Java Vector is a variable-length array. In this case it will hold Employee objects) Implementation Inheritance Outline arrows identify derivation relationships: extends, implements, is-a, has-properties-of, etc. Variations include: Interface Inheritance 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.) My extension to UML: rounded corners identify interfaces. If the full interface specification is in some other diagram, I use: Strict UML uses the «interface» stereotype in the name compartment of a standard class box: Interfaces contain no attributes, so the attribute compart- ment is always empty. Java.awt com.hulub Application Database Interfaces Oracle Sybase Tools Class name Attributes: Operations: + public # protected - private ~ package (my extension to UML)1 Person String name; Person String name 1 Usually omitted if 1:1 n Unknown at compile time, but bound. 0..1 (1..2 1..n) 1..* 1 or more * 0 or more 1..* 1..* relationship A’s role in B B’s role in A A B Sender Receiver Company give_me_a_raise(Employee e) Employee you_re_fired() 1 employer peon <works for 1..n boss 1 1..* flunkies SuperClass - void concrete(); + int override(); SubClass + int override(); + int additional(); User f() { x.operation() } Iface Name operation() Implementer operation() relationship x User Name Implementer InterfaceName «interface» Operations
  • 2. Aggregation (comprises) • Destroying the “whole” does not destroy the parts. • Cardinality is allowed. Composition (has) relationship • The parts are destroyed along with the whole. • Doesn’t really exist in Java. • In C++: class Container { Obj item1; Obj *item2; public: Whole() { item2 = new Obj; } ~Whole(){ delete item2; } }; Constraint • A constrained relationship requires some rule to be applied (e.g. {ordered}). Often combined with aggre- gation, composition, etc. • In the case of {or}, only one of the indicated relation- ships will exist at any given moment (a C++ union, or reference to a base class). • {subset} does the obvious. • In official UML, put arbitrary constraints that affect more than one relationship in a “comment” box, as shown. I usually leave out the box. Qualified Association • Hash tables, associative arrays, etc. 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 • Use when a class is required to define a relationship. • Somewhere, an additional relationship is required to show ownership. (The one between person and Ticket in the current example). Dynamic-Model (Sequence) Diagrams Objects and Messages (new style) • Top boxes represent objects, not classes. You may optionally add “:class” to the name if desired. • Vertical lines represent the objects “life line”, or exist- ence. • Broken lifeline indicates the object is inactive, a rect- angle indicates the object is active. • represent messages being sent. • (optional if synchronous) represent method return. (May label arrow with name/type of returned object). • Sending object’s class must have: 1. An association of some sort with the receiving objects class. 2. The receiver-side class’s “role” must be the same as the name of the receiving object. Object Creation • The new instance appears at end of creation message arrow. • Destruction is accomplished by terminating the lifeline with a large X: Conditions • Message sent only if conditional expression is true. • The cond_expr is typically expressed in the imple- mentation language. Loops (extension to UML) • Don’t think loops, think what the loop is accomplish- ing. • Typically, you need to send some set of messages to every element in some collection. Do this with every. • You can get more elaborate (every receiver where x<y) • The diagram above comes from: and maps to the following code: class sender_class { receiver_class receiver[n]; public do_it() { for(int i = 0; i < n; ++i) receiver[i].message(); } } Arrow Styles for Messages Asynchronous Callbacks • Callback occurs while Sender is potentially executing something else. Part Whole Item Container role Container Item Identity key() {ordered} role Collection {or} Container Container Comittee Person {subset} member-of * * * 1 chair-of Comittee Comittee {person.employer == Person.boss.employer} 0..1 * boss peon employee employer * 0..1 User add(String key, Item value) key Item bag Ticket Person Airline Date when; Seat where; Airport to; Airport from; carrier passenger <travels on <buys Sender Receiver message() message() Sender Receiver new Sender Receiver new message() Sender Receiver [cond_expr] message() Symbol Type Description Simple Don’t care. Usually read as the same as synchronous. Synchronous Sender blocks until return. Asynchronous Handler returns immediately and both sender and receiver work simultaneously. Sender Receiver message() Every do_it() sender_class void do_it() receiver_class void message() 1 n sender receiver x Sender Receiver message() callback()