Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
CSE
USC - Center for Software Engineering
UML Overview
Based in parts on ‘UML Distilled’ from Martin Fowler
Alexander Egyed
CSCI 612
March, 1999
USC
CSE Outline
USC - Center for Software Engineering
• UML Views
• Diagrams
– Use Case Diagrams
– Class Diagrams
– Interaction Diagrams
– Package Diagrams
– State Diagrams
– Activity Diagrams
– Deployment Diagrams
• Some Conclusions
1
USC
CSE Modeling and UML
USC - Center for Software Engineering
Why Modeling?
- Programs become more complex
- Failures more costly
- Edit-and-Compile cycle not very efficient
USC
CSE UML History
USC - Center for Software Engineering
Booch
OOSE UML
(Jacobson and 1.3
others) (beta)
1999
2
USC
CSE UML 1.1 OMG Standard
USC - Center for Software Engineering
USC
CSE UML 1.1 OMG Standard
USC - Center for Software Engineering
However, ...
- Semantics often ambiguous (only the UML Notation
Meta-Model well defined)
- As of yet there is no tool that supports all of UML (not
even Rational Rose)
- Uses both OO and functional development concepts
Nevertheless, ...
- Common model eases communication and interaction
- More precise meaning (semantics) can be added
(customized)
3
USC
CSE Views in UML
USC - Center for Software Engineering
Requirements
Classes and
Deployment Physical Data
Objects
Architecting and
High-Level Design
Analysis State Transition Implementation
USC
CSE Components and Connectors
USC - Center for Software Engineering
Components:
- Classes, Objects, and Packages
- States and Activities
- Actors and Use-Cases
Connectors:
- Basically three types: Communication (control and data),
Containment, Attachment
- Restricted in what types of components they link
- First class citizens
4
USC
CSE Outline
USC - Center for Software Engineering
• UML Views
• Diagrams
– Use Case Diagrams
– Class Diagrams
– Interaction Diagrams
– Package Diagrams
– State Diagrams
– Activity Diagrams
– Deployment Diagrams
• Some Conclusions
USC
CSE Use-Case Diagrams
USC - Center for Software Engineering
5
USC
CSE Use-Case Diagram Stereotype
(between guillemots)
USC - Center for Software Engineering
<<uses>>
administrative staff
Discharge Patient
patient database
Human
Actor
doctor System
Prescribe Treatment
Actor
<<extends>>
Procedure Fails
nurse
Track Treatment Procedures
USC
CSE Outline
USC - Center for Software Engineering
• UML Views
• Diagrams
– Use Case Diagrams
– Class Diagrams
– Interaction Diagrams
– Package Diagrams
– State Diagrams
– Activity Diagrams
– Deployment Diagrams
• Some Conclusions
6
USC
CSE Class Diagrams
USC - Center for Software Engineering
USC
CSE Class Diagram
USC - Center for Software Engineering
Association
Trans action 1..* 1 Cus tom er
1..* 1..* 1
1..* Posts has
Is at
1 1..*
1 Is at 0..1
Area Branch Accoun t BankCard
1..*
1..* 1 0..* 1..*
CollegeAccount
PBAAccount
CurrentAccount
Class
7
USC
CSE Class Diagrams
USC - Center for Software Engineering
USC
CSE Domain Classes
USC - Center for Software Engineering
P a tie n t
Do m a in Mo d e ls s h o w re a l-wo rld na m e
o b je cts a n d th e re la tio n s h ip s a d d re s s
b e twe e n th e m Ho s p ita l S S NO
in s u ra n ce in fo
S ta ff a d m it p a tie n t()
Vis it R e co rd d is ch a rg e p a tie n t()
a d m is s io n d a te
re le a s e d a te
ro o m n u m b e r
m e d ica tio n s
te s ts s ch e d u le d
Op e ra tin g R o o m
La b o ra to ry
P h a rm a cy
Em e rg e n cy R o o m
Kitch e n
8
USC
CSE Design Classes
USC - Center for Software Engineering
Patient
Visit Record
name
admission date
address
release date
SSNO
room number
insurance info
medications 1..1 1..1
tests scheduled
admit patient()
0..* discharge patient()
Account
status Medical History
1..1 1..1 amount diagnostic info
Bill
test results
0..* create() X-rays
modify()
Hospital delete()
Access
Pre:{amount=0}
USC
CSE Implementation Classes
USC - Center for Software Engineering
nvo_SystemManager
nvo_SecurityManager
dso_Exception
CheckAccess()
GetSubSystem() -iu_SecurityManager CheckAccess()
CheckConnectionStatus() +idso_
SetSubSystem() nvo_WindowManager
RaiseException()
HandleException() CheckUnsavedData()
-iu_ExceptionManager
nvo_ExceptionManager OpenWindow()
-iu_SessionManager nvo_SessionManager
RaiseException()
GetUserID()
LogException()
GetSubSystem()
CheckConnectionStatus()
w_Logon
Account
Patient Medical History Open()
status
name diagnostic info cb_OK-Click()
amount
address test results
create() SSNO X-rays
modify() insurance info
delete()
admit patient()
discharge patient()
1..1
Visit Record w_ExceptionHandling
admission date 1..1
w_HospitalWindow
release date ExceptionHandlingSelection()
room number
medications Open()
tests scheduled SetAccess()
CheckUnsavedData()
9
USC
CSE Advanced Concepts in Classes
USC - Center for Software Engineering
Fe m a le
P e rs o n Th e ra p is t Do cto r
Ma le sex
{mandatory}
ro le
p a tie n t
Nu r s e
P a tie nt
USC
CSE Advanced Concepts in Classes
USC - Center for Software Engineering
Ma n a g e r
- Dynamic Classifications
Fe m a le <<dynamic>>
Job
En g in e e r
P e rs o n
Ma le sex
<<static>> S a le s m a n
10
USC
CSE Advanced Concepts in Classes
USC - Center for Software Engineering
Person
- Derived Associations and Attributes date-of-birth
/ age
- Interfaces and Abstract Classes
PC W indow
(generalization vs. realization)
<<abstract>>
W indow X11
MyApp
toFront()
toBack() Mac
realize
USC
CSE Advanced Concepts in Classes
USC - Center for Software Engineering
Is categorized by
- Association Classes
Pe rson empl oyer Comp any Person Skills
0..* 0..1 0..* 0..*
11
USC
CSE Advanced Concepts in Classes
USC - Center for Software Engineering
T
- Parameterized Class Set
insert()
rem ove()
<Employee>
<<bind>>
Employee EmployeeSet
- Object Diagrams?
USC
CSE Outline
USC - Center for Software Engineering
• UML Views
• Diagrams
– Use Case Diagrams
– Class Diagrams
– Interaction Diagrams
– Package Diagrams
– State Diagrams
– Activity Diagrams
– Deployment Diagrams
• Some Conclusions
12
USC
CSE Interaction Diagrams
USC - Center for Software Engineering
USC
CSE Sequence Diagram
USC - Center for Software Engineering
: Section
Object
: Building Owner
Message/Call
add zone to section
search
Object is Born
Create Lease : Lease
: Set Point Schedule
* [for all points] Item
Schedule In Effect
...
[lease exists] Delete Lease
Iteration
13
USC
CSE Concurrent Processes and Activations
USC - Center for Software Engineering
new a Transaction
Synchronous
Message Other Processing
a Transaction
new
Coordinator Suppressed
a first Transaction
new
Checker
a second
new Transaction Checker
all done?
ok
all done?
Asynchronous
Message
ok
beValid
Object deletes
itself
USC
CSE Concurrent Processes and Activations
USC - Center for Software Engineering
new a Transaction
a Transaction
new
Coordinator
a first Transaction
new
Checker
a second
new Transaction Checker
all done?
fails
beInvalid
Object is killed
14
USC
CSE Collaboration Diagram
USC - Center for Software Engineering
Order
5 : needsReord er := needToR eorder()
2: * [for all order lines]: prepare()
3: hasStock := check()
4: [hasStock]: remove()
Macal lan l in e : O rder Line Macallan stock : Stock Item
USC
CSE Interactions Diagrams
USC - Center for Software Engineering
Sequence Diagrams:
-> easy to see the sequence of event happening
Collaboration Diagrams:
-> easy to see static connection (configuration) of objects
15
USC
CSE Outline
USC - Center for Software Engineering
• UML Views
• Diagrams
– Use Case Diagrams
– Class Diagrams
– Interaction Diagrams
– Package Diagrams
– State Diagrams
– Activity Diagrams
– Deployment Diagrams
• Some Conclusions
USC
CSE Package Diagrams
USC - Center for Software Engineering
16
USC
CSE Package Diagram
USC - Center for Software Engineering
Package
(like Modules)
Order Capture Mai ling L ist
Appli cation Dependency
Applicat ion
Orders Customers
USC
CSE Package Diagram
USC -Orde
Center for Software Engineering
r Capture AW T Mailing List UI
UI
Oracle Interface
Comm on M oney
DateRange
<<abstract>> Generalization
Database
Interface
Sybase
Interface
17
USC
CSE Outline
USC - Center for Software Engineering
• UML Views
• Diagrams
– Use Case Diagrams
– Class Diagrams
– Interaction Diagrams
– Package Diagrams
– State Diagrams
– Activity Diagrams
– Deployment Diagrams
• Some Conclusions
USC
CSE State Diagrams
USC - Center for Software Engineering
18
USC
CSE State Diagram
USC - Center for Software Engineering
Self-Transition
Transition
Start [ Not all items checked ] / get next
Activity
State
USC
CSE State Diagram and Superstate
USC - Center for Software Engineering
Superstate
State Diagram for Order Class
Active
[ Not all items checked ] / get next
cancelled
Cancelled Delivered
19
USC
CSE Another State Diagram
USC - Center for Software Engineering
[ payment OK ]
Rejected
Aut horized
Delivered
USC
CSE Concurrent State Diagram
USC - Center for Software Engineering
Cancelled
W aiting
Deli vered
Authorizing Authorized
Rejected
20
USC
CSE Outline
USC - Center for Software Engineering
• UML Views
• Diagrams
– Use Case Diagrams
– Class Diagrams
– Interaction Diagrams
– Package Diagrams
– State Diagrams
– Activity Diagrams
– Deployment Diagrams
• Some Conclusions
USC
CSE Activity Diagrams
USC - Center for Software Engineering
21
USC
CSE Activity Diagram
USC - Center for Software Engineering
Receive
Order
Synchronization
Activity
* [for each line
item on order]
[succeeded] Assign to
Condition Order
[need to reorder]
[stock assignment to
all line items and
payment authorized] Reorder
Item
Dispatch
Order
USC
CSE Categorized Activity Diagram
USC - Center for Software Engineering
Receive
Order Order Receive
Finance Supply
Processing
* [for each line
item on order]
Stock
Choose
Outstanding
Manager
[failed] Check Line Order Items
Authorize Cancel Item
* [for each
Payment Order [in stock] chosen order
item]
Assign
Assign to
Goods to
[succeeded] Order
Order
[all outstanding
[stock assignment to order items filled]
all line items and
payment authorized] [need to reorder]
Reorder
Item Add
Dispatch
Remainder
Order
to Stock
22
USC
CSE Outline
USC - Center for Software Engineering
• UML Views
• Diagrams
– Use Case Diagrams
– Class Diagrams
– Interaction Diagrams
– Package Diagrams
– State Diagrams
– Activity Diagrams
– Deployment Diagrams
• Some Conclusions
USC
CSE Deployment Diagrams
USC - Center for Software Engineering
23
USC
CSE Deployment Diagram
USC - Center for Software Engineering
Windows PC
s cre e n us e r
Unit Server
DB In te r fa ce
fid s
a p p fra m e
d b c on n e c t
Ora cle
as s ay
r e p o rting
USC
CSE Outline
USC - Center for Software Engineering
• UML Views
• Diagrams
– Use Case Diagrams
– Class Diagrams
– Interaction Diagrams
– Package Diagrams
– State Diagrams
– Activity Diagrams
– Deployment Diagrams
• Some Conclusions
24
USC
CSE Extending UML
USC - Center for Software Engineering
Use Stereotypes to
- extend the notation of UML
- specialize the meaning of modeling elements
USC
CSE The UML Meta-Model
USC - Center for Software Engineering
Objects
User Objects Dynamic Structure
Sequence Calls
25
USC
CSE Simplified UML Meta-Model
USC - Center for Software Engineering
USC
CSE Conclusions
USC - Center for Software Engineering
26