Title: UML Class Diagrams Sequence Diagrams
1UML Class DiagramsSequence Diagrams
2Agenda
- Class Diagrams
- Symbology
- Basic Modeling
- Intermediate Modeling
- Sequence Diagrams
- Symbology
3Class Diagrams
- A class diagram shows
- Classes
- Attributes
- Methods
- Interfaces
- Collaborations
- Dependency, Generalization, Relationships
- A class diagram is a STATIC view of system
4Basic Class Diagrams
5Basic Class Diagrams
public protected - private / derived
static
Abstract ltltabstractgtgt
ltltconstructorgtgt ltltquerygtgt ltltupdategtgt
Class Scope Variable
Visibility Attribute Name MultiplicityType
Initial Value Visibility Method Name (Parameter
List) Return-List
6Basic Class Diagrams
Superclass
Class with parts
Note
Assembly Class
Subclass
Composition (Part-Of)
Association (relationship)
Inheritance (Generalization) (is-a, kind-of)
7Basic Class Diagram (Example)
takes
8Basic Class Diagram (Example)
Person
name String - ssn String birthday
Date / age int
getName String -calculateAge int
9Class Diagrams (Advanced)
Cardinality (Multiplicity) 1 0..1 0..n 1..n
takes
0..n
10Class Diagrams (Advanced)
Important Stereotypes ltltinterfacegtgt specify
collection of operations to specify
services ltlttypegtgt specify structure and
behavior (not implementation) ltltenumerationgtgt
specify discrete values ltltimplementationClassgtgt
helper class created in detail design
ltltenumerationgtgt Status
Idle Working Error
Fundamental Attributes
readImage writeImage
Fundamental behavior
11Class Diagrams (Advanced)
Simple Aggregation (object lifetime)
Composite Aggregation (unique member)
Can have self-relations
Exception handling
ltltsendsgtgt
manager
manages
employee
12Class Diagrams (Advanced)
Association Class
13Class Diagram Hints
- Provide abstraction of problem domain
- Embodies small set of well-defined
responsibilities - Clear separation between specification and
implementation - Understandable and simple
- Show only important properties
14Class Hints
- Organize similar classes into packages
- Beware of cyclical generalization
- Use associations where there are structural
relationships - Associations are NOT comm pipes!!!!!!!
- Start with Analysis, then refine details
15Bitman Class Diagram
16Sequence Diagrams
- AKA Interaction Diagrams Semantically
equivalent to Collaboration Diagrams - Dynamic Model relating use cases and class
diagrams - Shows time ordering of interactions
- Generally a set of messages between collaborating
objects - Ordering of objects not significant
17Sequence Diagrams
- Show only one flow of control
- May need multiple diagrams
- Primary
- Variant
- Exceptions
18Sequence Diagram (Basic)
Swimlane
Object Class or Actor
name
Focus of Control/ Activation
message
Object Destruction/ Termination
X
ltltcreategtgt ltltdestroygtgt
19Sequence Diagram (Basic) Example
aClass Class
Register
adjustRoom
checkRooms
20Sequence Diagrams (Advanced)
Seq Guard Iteration Return-List
Operation-Name (Argument-List)
Conditional Lifeline
transient
21Sequence Diagrams (Advanced) Example
ob1 C1
User
run(v)
ltltcreategtgt
xgt0 foo(x)
doit(w)
xlt0 bar(x)
7doit(z)
ltltdestroygtgt
22Sequence Diagram (Hints)
- Can show either objects or processes
(ltltprocessgtgt) in swimlanes - Use multiple diagrams to show variations
- Use advanced features sparingly to keep diagram
understandable
23Lab 4 Exercise