Professional Documents
Culture Documents
Package
SimpleWatch
Actor
ReadTime
SetTime
WatchUser
Use case
WatchRepairPerson
ChangeBattery
Usecasediagramsrepresentthefunctionalityofthesystem
fromuserspointofview
BerndBruegge&AllenDutoit
ObjectOrientedSoftwareEngineering:ConqueringComplexandChangingSystems
16
UMLFirstPass:ClassDiagrams
Class
Multiplicity
Association
SimpleWatch
1
1
2
PushButton
state
push()
release()
LCDDisplay
blinkIdx
blinkSeconds(
)
blinkMinutes(
)
blinkHours()
stopBlinking(
)
referesh()
1
2
Battery
load()
Time
now()
Attributes
Operations
Classdiagramsrepresentthestructureofthesystem
BerndBruegge&AllenDutoit
ObjectOrientedSoftwareEngineering:ConqueringComplexandChangingSystems
17
UMLFirstPass:SequenceDiagram
Object
:SimpleWatch
:WatchUser
:LCDDisplay
pressButton1()
blinkHours()
pressButton1()
blinkMinutes()
pressButton2()
:Time
incrementMinutes()
refresh()
pressButtons1And2()
commitNewTime()
stopBlinking()
Activation
Message
Sequencediagramsrepresentthebehaviorasinteractions
BerndBruegge&AllenDutoit
ObjectOrientedSoftwareEngineering:ConqueringComplexandChangingSystems
18
UMLFirstPass:StatechartDiagrams
Initial state
Event
button1&2Pressed
Blink
Hours
Transition
button2Pressed
State
Increment
Hours
button1Pressed
button1&2Pressed
Blink
Minutes
button2Pressed
Increment
Minutes
button1Pressed
Blink
Seconds
Stop
Blinking
button2Pressed
Increment
Seconds
button1&2Pressed
Final state
BerndBruegge&AllenDutoit
ObjectOrientedSoftwareEngineering:ConqueringComplexandChangingSystems
19
UMLSecondPass:UseCaseDiagrams
Usedduringrequirementselicitationto
representexternalbehavior
Passenger
Actorsrepresentroles,thatis,atype
ofuserofthesystem
Usecasesrepresentasequenceof
interactionforatypeoffunctionality
Theusecasemodelisthesetofall
usecases.Itisacompletedescription
ofthefunctionalityofthesystemand
itsenvironment
PurchaseTicket
BerndBruegge&AllenDutoit
ObjectOrientedSoftwareEngineering:ConqueringComplexandChangingSystems
22
UseCase
Ausecaserepresentsaclassof
functionalityprovidedbythesystemas
aneventflow.
PurchaseTicket
BerndBruegge&AllenDutoit
Ausecaseconsistsof:
Uniquename
Participatingactors
Entryconditions
Flowofevents
Exitconditions
Specialrequirements
ObjectOrientedSoftwareEngineering:ConqueringComplexandChangingSystems
24
UseCaseExample
Name:Purchase ticket
Participatingactor:Passenger
Entrycondition:
Passengerstandinginfront
ofticketdistributor.
Passengerhassufficient
moneytopurchaseticket.
Anything missing?
Exitcondition:
Passengerhasticket.
BerndBruegge&AllenDutoit
Eventflow:
1.Passengerselectsthenumber
ofzonestobetraveled.
2.Distributordisplaystheamount
due.
3.Passengerinsertsmoney,of
atleasttheamountdue.
4.Distributorreturnschange.
5.Distributorissuesticket.
Exceptional cases!
ObjectOrientedSoftwareEngineering:ConqueringComplexandChangingSystems
25
The<<extend>> Relationship
Passenger
PurchaseTicket
<<extend>>
<<extend>>
OutOfOrder
exceptionalorseldominvokedcases.
Theexceptionaleventflowsare
factoredoutofthemaineventflow
forclarity.
Usecasesrepresentingexceptional
flowscanextendmorethanoneuse
case.
Thedirectionofa<<extend>>
relationshipistotheextendeduse
case
<<extend>>
<<extend>>
Cancel
BerndBruegge&AllenDutoit
<<extend>>relationshipsrepresent
TimeOut
NoChange
ObjectOrientedSoftwareEngineering:ConqueringComplexandChangingSystems
26
The<<include>>Relationship
Passenger
PurchaseMultiCard
PurchaseSingleTicket
<<include>>
<<include>>
<<extend>>
CollectMoney
<<extend>>
NoChange
BerndBruegge&AllenDutoit
An<<include>>
relationshiprepresents
behaviorthatisfactoredout
oftheusecase.
An<<include>>represents
behaviorthatisfactoredout
forreuse,notbecauseitisan
exception.
Thedirectionofa
<<include>>relationshipis
totheusingusecase(unlike
<<extend>>relationships).
Cancel
ObjectOrientedSoftwareEngineering:ConqueringComplexandChangingSystems
27
Classes
Name
TariffSchedule
zone2price
getZones()
getPrice()
Attributes
Operations
TariffSchedule
Table zone2price
Enumeration getZones()
Price getPrice(Zone)
Signature
TariffSchedule
Aclassrepresentaconcept.
Aclassencapsulatesstate(attributes)andbehavior(operations).
Eachattributehasatype.
Eachoperationhasasignature.
Theclassnameistheonlymandatoryinformation.
BerndBruegge&AllenDutoit
ObjectOrientedSoftwareEngineering:ConqueringComplexandChangingSystems
29
Aggregation
Anaggregationisaspecialcaseofassociationdenotinga
consistsofhierarchy.
Theaggregateistheparentclass,thecomponentsarethe
childrenclass.
Exhaust System
1
Muffler
BerndBruegge&AllenDutoit
0..2
Tailpipe
ObjectOrientedSoftwareEngineering:ConqueringComplexandChangingSystems
34
Composition
Asoliddiamonddenotecomposition,astrongformof
aggregationwherecomponentscannotexistwithoutthe
aggregate.
TicketMachine
3
ZoneButton
BerndBruegge&AllenDutoit
ObjectOrientedSoftwareEngineering:ConqueringComplexandChangingSystems
35
Generalization
Button
CancelButton
ZoneButton
Generalizationrelationshipsdenoteinheritancebetweenclasses.
Thechildrenclassesinherittheattributesandoperationsofthe
parentclass.
Generalizationsimplifiesthemodelbyeliminatingredundancy.
BerndBruegge&AllenDutoit
ObjectOrientedSoftwareEngineering:ConqueringComplexandChangingSystems
36
UMLSequenceDiagrams
Torefineusecasedescriptions
tofindadditionalobjects
(participatingobjects)
TicketMachine
Passenger
Usedduringrequirementsanalysis
selectZone()
Usedduringsystemdesign
torefinesubsysteminterfaces
insertCoins()
pickupChange()
pickUpTicket()
BerndBruegge&AllenDutoit
Classesarerepresentedby
columns
Messagesarerepresentedby
arrows
Activationsarerepresentedby
narrowrectangles
Lifelinesarerepresentedby
dashedlines
ObjectOrientedSoftwareEngineering:ConqueringComplexandChangingSystems
38
UMLSequenceDiagrams:NestedMessages
ZoneButton
Passenger
selectZone()
TarifSchedule
Display
lookupPrice(selection)
price
Dataflow
displayPrice(price)
to be continued...
Thesourceofanarrowindicatestheactivationwhichsentthe
message
Anactivationisaslongasallnestedactivations
BerndBruegge&AllenDutoit
ObjectOrientedSoftwareEngineering:ConqueringComplexandChangingSystems
39