Professional Documents
Culture Documents
UML Review
UML Review
What is modeling?
What is UML?
Use case diagrams
Class diagrams
Sequence diagrams
Activity diagrams
Statechart diagrams
What is modeling?
TicketSystem
Passenger PurchaseTicket
Cancel NoChange
The <<includes>> Relationship
<<includes>> relationship
represents behavior that is factored
Passenger
out of the use case.
<<includes>> behavior is
factored out for reuse, not because
PurchaseMultiCard it is an exception.
PurchaseSingleTicket The direction of a <<includes>>
<<includes>>
relationship is to the using use
case (unlike <<extends>>
<<includes>> relationships).
CollectMoney
<<extends>> <<extends>>
NoChange Cancel
Use Case Diagrams: Summary
TarifSchedule
Trip
Enumeration getZones() zone:Zone
* * Price: Price
Price getPrice(Zone)
TarifSchedule
zone2price Attributes Signature
getZones()
getPrice()
Operations TarifSchedule
tarif_1974:TarifSchedule
zone2price = {
{‘1’, .20},
{‘2’, .40},
{‘3’, .60}}
TarifSchedule TripLeg
Country capital
name:String name:String
One-to-one association
Point
Polygon
* x: Integer
y: Integer
draw()
One-to-many association
Many-to-Many Associations
Lists
StockExchange * * Company
tickerSymbol
StockExchange * Lists
tickerSymbol
1
SX_ID
Company
qualifier
From Problem Statement To Object Model
Class Diagram:
StockExchange * * Company
Lists
tickerSymbol
From Problem Statement to Code
Class Diagram:
StockExchange * * Company
Lists tickerSymbol
Java Code
public class StockExchange
{
private Vector m_Company = new Vector();
};
public class Company
{
public int m_tickerSymbol;
private Vector m_StockExchange = new Vector();
};
Aggregation
An aggregation is a special case of association denoting a “consists of”
hierarchy.
The aggregate is the parent class, the components are the children class.
1 0..2 1 0..2
Muffler Tailpipe Muffler Tailpipe
TicketMachine
3
ZoneButton
Inheritance
Button
CancelButton ZoneButton
Without qualification
1 * File
Directory
filename
With qualification
1 0…1
Directory filename File
Name
* Amount
* Has Name
AccountId
CustomerId
AccountId
CustomerId
Deposit()
Withdraw()
GetBalance()
selectZone()
lookupPrice(selection)
price
displayPrice(price)
Dataflow
…to be continued...
The source of an arrow indicates the activation which sent the message
An activation is as long as all nested activations
Horizontal dashed arrows indicate data flow
Vertical dashed lines indicate lifelines
Iteration & condition
…continued from previous slide...
*insertChange(coin) lookupCoin(coin)
price
Iteration displayPrice(owedAmount)
[owedAmount<0] returnChange(-owedAmount)
Condition
…to be continued...
ChangeProcessor
Passenger
Creation
createTicket(selection)
Ticket
print()
free()
Destruction
Transition
[button1Pressed]
[button1&2Pressed] [button2Pressed]
BlinkMinutes IncrementMin.
[button1Pressed]
[button1&2Pressed] [button2Pressed]
BlinkSeconds IncrementSec.
StopBlinking
Final state
Triggerless
Completion of activity Transition
causes state transition
Activity Diagram: Modeling Decisions
[lowPriority]
Open Allocate
Incident Resources
Notify
Police Chief
Activity Diagrams: Modeling Concurrency
Allocate
Splitting Resources Synchronization
Document
Incident
Activity Diagrams: Swimlanes
Allocate Dispatcher
Resources
FieldOfficer
Document
Incident
Deployment Diagram Example
:HostMachine
<<database>>
meetingsDB
:Scheduler
:PC
:Planner
UML Summary
Semi-formal
Go directly to the class/objects – a low level.
Not good at express temporal information – StateChart