Académique Documents
Professionnel Documents
Culture Documents
57
Use Case models
• Actor is an external system-user which directly
communicates with a system but is not a part of
the system.
Ex.: Customer, Repair man and Store-keeper
are actors for a vending machine.
• Object can be related with many actors if they
create different aspects of his behavior.
Ex.: Eva, John and George can be customers of
a vending-machine. John can be also a repair
man.
• Actor has a single well defined purpose. It can
represent objects from different classes if they
act analogically with respect to the system.
• Actor need not be only a person.
• Use Case is a coherent part of functionality
which system provides during its communication
with an actor.
• Besides a system itself, Use case deals with one
or more actors.
• Use case joins all behavior, which is related to a
system functionality, i.e. a basic normal behavior
and its variations, special and error conditions
and requirements.
58
Ex.: use cases for a vending machine: Buy
snakes, Do planned maintenance, Refill
products.
Vending machine
Buy snakes
Customer
Do planned
maintenance
Repair man
Repair
Refill products
Store-keeper
• UML notation:
- System: rectangle with an inscribed name
- Actor: icon „stick man“
- Use Case: ellipse with an inscribed name
inside the system (rectangle)
59
- Connection of actor with the UC: solid line.
• Use cases divide system functionality in a whole
model. They should be at a comparable level of
abstraction.
• Recommendations for building use case models:
- First determine system boundaries.
- Each actor should have a single coherent
purpose (actor is not an independent concept –
it is defined with respect to a system).
- Each use case should provide users with
certain cummulative service; it should not be
defined too narrowly.
- Each use case should have at least one actor
and each actor should participate at least in one
use case.
- Use cases are an informal instrument, attempts
towards an excessive formalization is
counterproductive.
- Use case could be structured.
60
• Relationship include incorporates one use case
into behavior of another use case. It is similar to
sub-program, it represents that behavior which
should be described repeatedly, otherwise.
Do payment «include»
Password check
hesla
Change limit «include»
61
Buying flight ticket Check-in
«extend»
«extend»
«extend»
62
• Parent use case should be abstract (so that it
cannot be used directly).
Sequence models
• There exist 2 kinds of sequence models:
- Scenarios
- Sequence diagrams.
63
• Sequence diagrams show participants of
interactions and messages among them.
64
Caller PhoneLine Callee
Digit (5)
Digit (7)
Digit (2)
Digit (5)
Caller hooks on
Callee hooks on
65
Caller PhoneLine Callee
Busy
Caller hooks on
Devices disconnected
66
Procedural sequence models
They enable to model also behavior of passive and
transient (temporary) objects. It is analogy to a
procedure calling in programing languages.
• Sequence diagram with passive objects
• Majority of objects are passive and they are
activated only by calling. They return control
back to a calling object after completing their
operations and become inactive again.
• „The life-line“is represented by a dashed line for
the time when object exists but it is inactive. In
the time of activity it changes into a bar (narrow
rectangle).
Make
transaction
Customer checking
Ok
Account checking
Fees
Ok
67
• Sequence diagram with transient objects
• In the next example ObjectA is an active
object, which initiates operation. It is active,
thus its „life-line“spans the entire time.
• ObjectB is passive. It exists all the time, but it
is not active during all that time.
• ObjectC is a transient one. It is created and
destroyed by completing its activity, so that the
life-line doesn’t span the whole diagram.
ObjectA ObjectB
operationM(a,b)
createC(arg)
ObjectC
operationM(c,d)
result1
result2
69
• Concurrent activities (after splitting) can be
executed in arbitrary order. Before a merge can
happen, all inputs must first complete.
Verify
order
Execute
order
[failure]
[OK]
Debit acc.
70
• Conditions are tested after completing activity.
• It is convenient to use also [else] condition, in
order to guarantee continuation.
Summary to models
• All three models are needed but various types of
systems put different emphasis to individual
models.
• Models offer to view a system from three
different viewpoints:
• Object model expresses a static structure of
objects in a system, mainly classes, associations
and generalizations (attributes and operations are
secondary).
• State model describes changes of object
properties in time and their mutual stimulation.
State model is a collection of state diagrams.
• Interaction model describes cooperation of
objects in several levels of abstraction:
- top: use case,
- middle: sequence diagram and
- most detailed: activity diagram.
71
• Each model focuses at a certain aspect and leaves
remaining aspects without explanation. All three
models are needed for a full system
understanding.
• Generalization is an „OR“ relationship and it
occurs in all three models. Inheritance holds for
classifiers (classes, signals a use cases).
• All super-classifiers are abstract, leaf classifiers
are concrete.
• UML2 doesnot have inheritance of states.
72