Professional Documents
Culture Documents
© Telelogic AB 2002
Specifikacija templejta korisnicke funkcije:
PRIMER
© Telelogic AB 2002
Specifikacija templejta korisnicke funkcije:
PRIMER
ALTERNATIVAN NEPONOVLJIV
PRAVAC -ubacen neadekvatan PIN
AKCIJE
1. Korisnik ubacuje karticu
2. Sistem trazi PIN
3. Korisnik ubacuje PIN
4. Sistem prikazuje da je PIN
pogresan I izbacuje karticu
5. Sistem prijavljuje pokusaj tzv.
„ATM System Log“
© Telelogic AB 2002
Relacije: Asocija
• Crta se izmedju izvodzaca i korisnicke funkcije
• Predstavlja neusmerenu komunikaciju izmedju
izvodzaca i sistema
© Telelogic AB 2002
Relacija: Generalizacija
• Crta se izmedju dve korisnicke
funkcije ili izmedju dva izvodzaca
• Oznacava vezu specijalizovane korisne
funkcije/izvodzaca do uopstenije
Administrator User
korisnicke funkcije/izvodzaca
register user • Dete korisnicka funkcija/izvodzac
nasledjuje sve osobine i asocijacije
roditelja a moze imati nove osobine i
asocijacije u odnosu na roditelja, t.j.
register administrator
insertovanjem dodatnih sekvenca
akcije u roditeljsku sekvencu
Oznacava
‚specijalnu vrstu‘-
relacije
© Telelogic AB 2002
Association vs. Generalization
A A
B B
© Telelogic AB 2002
Relationships: Dependency
• Crta se izmedju dve korisnicke
funkcije
• Oznacava semanticku relaciju
izmedju dve korisnicke
funkcije
• Funkcionisanje jednog ili vise
elemenata zahteva prisustvo
jednog ili vise drugih
elemenenata.
• Semantika se moze specificirati
koriscenjem stereotipova
© Telelogic AB 2002
Stereotipi (kategorije) (1)
• UML omogucava programeru da definise nov
simbol baziran na postojecem (t.j. “legalna”
ekstenzija UML-a)
• Oznacava se elementima, na primer, «extend»
• Ukljucuju osobine osnovnih simbola
• Uopsteno govoreci imaju razlicitu upotrebu od
osnovnih simbola, I cesto dodatna ogranicenja
• UML ukljucuje (oko 40) predefinisanih stereotipa
• Programeri koji kreiraju nove stereotipe moraju da
definisu njihovo znacenje i primenu
© Telelogic AB 2002
Stereotipi (2)
• Zavisnost je osnovni simbol
• Koristi se kako za korisnicke
funkcije tako i za ostale elemente
modelovanja
Samo za korisnicke funkcije imamo...
© Telelogic AB 2002
Relacije zavisnosti izmedju
korisnickih funkcija
«extend» prikazuje
opcionalno ATM System
«include»
PrintReceipt
«include»
«include» opisuje
uobicajeno ponasanje, CheckBalance
© Telelogic AB 2002
Proces analize korisnickih funkcija
Iteracija
© Telelogic AB 2002
Use Case Properties
Miscellaneous (Misc)
- Classification: - Primary
- Secondary
Actions (Act)
- Basic course of action
- Alternative courses of action
Conditions (Cond)
- Pre-conditions
- Post-conditions
Documentation (Doc)
- Description
- Triggering event
© Telelogic AB 2002
Actor Properties
Miscellaneous (Misc)
- Initiator
- Actor type
User
System
Documentation (Doc)
- Description
© Telelogic AB 2002
Use Case Dependency Property
Form
Miscellaneous
(Misc)
- Specify
association
stereotype
«extend»
«include»
© Telelogic AB 2002
Report on Use Cases
• To generate a report on use
cases
– From the browser, select
Reports, objects, Use
Cases…
– From the UCD editor, select
© Telelogic AB 2002
Report Formatting Options
• Names may be entered
in two ways
– By typing the use case
name(s) in this field
– By selecting the use
cases on a UCD prior to
choosing the Report
option from the menu
© Telelogic AB 2002
Report Monitoring Window Option
Suggestions
• Options, Font
– Use a monospaced font, like
Courier
• Options, Output Width
– Set to 132
• Options, Clear Screen
– Set to off
• Options, Reuse
– Set to on
© Telelogic AB 2002
Checking a Use Case Diagram
• Invoked from the use case diagram editor or from the the UML Suite
browser
• Check Contents checks the semantics of the selected diagram
– Checking rules:
• A UCD actor must participate in at least one use case.
• An initiating actor must send an event.
• Check Use Case Model checks one or more selected use case
diagrams
– Checking rules:
• Each use case must have only one initiating actor
• Each use case must have a decomposition or a qualifying
sequence diagram
© Telelogic AB 2002
Exercise 1 & 2
• Goal: Create a project hierarchy
• Goal: Create a requirements model
– Create a use case diagram
© Telelogic AB 2002
Review Questions
© Telelogic AB 2002
Use Case Analysis Process
Iterate
Seek
Actors Seek Use Cases Describe the Use Cases
How d
oe s UML
help m
e he r
e?
Analysis Phase
Analyzing the Use Cases
© Telelogic AB 2002
Using Activity Diagrams
• Analyzing and organizing use case
scenarios
• Modeling business workflow (e.g., the picture
of the analysis process used in this course)
• Documenting procedural steps of a single
operation
© Telelogic AB 2002
Activity Diagrams
• Introduction
• UML activity diagram: concepts and
notation
• Drawing activity diagram with the UML
Suite
• Diagram navigation
• Reporting and checking
© Telelogic AB 2002
Base Elements
• Start State s ta te
St art
– Begins the sequence of activities
– At most one
Take order
• Action State st a te
Act ion
– Represent an activity
• Final State
– End the sequence of activities s ta te
Final
– Can appear many times
© Telelogic AB 2002
Activity Diagram: A Development Process
© Telelogic AB 2002
Action/Activity State
• Each state in an activity diagrams is either
– an action state
Action
• atomic, no substructure
• executes “instantaneously”
• can not be interrupted
• runs to completion and transitions out
– or an activity state Activity
• not atomic, has a substructure
• executes a nested activity graph
• is a “hierarchical action”
© Telelogic AB 2002
Transistions in Activity Diagrams
© Telelogic AB 2002
Activity – Run to Completion Semantics
© Telelogic AB 2002
Decision
• A single event trigger leads to more than
one possible outcome
– each has its own guard condition
[product in stock]
[else]
se rved
i s a re
”
“else word
© Telelogic AB 2002
Object Flow and Object-in-State
fl o w-
ct
Obje ty state
i t
activ to objec
Take order
ut puts
o
n- st ate Order
je ct -i [entered]
Ob
fl o w-
b j e ct ides
O o v Order
j e c t pr ivity Allocate stock
ob to ac t [planned]
input
© Telelogic AB 2002
Convenience Features
Partitions are a grouping mechanism.
“Swimlanes” are the notation for partitions.
They do not provide domain-specific semantics.
Used to show allocation of responsibility for the
activities to business units, use cases, classes
Management
Evaluate Revise
Impact Plan
[ priority = 1]
Support
Register Release
Bug Fix
Engineering
Fix Test
Bug Fix
© Telelogic AB 2002
Convenience Features
Signal
Signal
Coffee Done
… translates to a wait state (a state
with no action and a signal trigger
event).
Drink Coffee
© Telelogic AB 2002
Diagram Navigation from a Use
Case
d na me
u al if ie
q
© Telelogic AB 2002
Creating an Activity Diagram
• Create from
– Use case
– Class
– Statechart event
or activity
• Or File, New,
Activity Diagram
© Telelogic AB 2002
Adding Swimlanes
1. Click on the partition symbol
© Telelogic AB 2002
Diagram Navigation Double-
Clicking on...
An operation (shown as signal receipt) “Print” of class CreateReport
Creates an AD called
Create Report:Print.
Creates an STD
called Create
Report:Print.
Object-in-state “Order”
Create an AD, CD or
SD called Order.
Create an STD called
Order:top.
Reports
• Report on Activities
shows:
– Action/activity state
names
– Transitions
(optional)
– Object flows
(optional)
– Connected notes
(optional)
Checking Activity diagrams
• Transitions:
– Each decision must have at least one incoming transition
– Each decision must have at least two outgoing transitions with a
distinct guard condition
– Action state must have at least one outgoing transition and one
incoming transition
– Transitions originating from an action state or decision must not
have an event
– Each signal receipt may not have more than one incoming object
flow
– Each signal send may not have more than one outgoing object
flow
• Names
– All action states must have an entry action
– All signal sends and receipts must have an event label
Why do Activity Diagrams help
me analyze Use Cases?
• The “run-to-completion” semantics helps to
– describe a Use Case as a sequence of exclusive
activities
– define pre- and post-conditions for every Use
Case
– identify common behavior of Use Cases
– restructure the Use Case diagram to realize an
“orthogonal decomposition” of the functional
requirements
Exercise 3
• Goal: Analyze a use case
– Describe different scenarios
– Create an activity diagram for a use case
Review Questions
• Name two uses of an activity diagram
• What is the difference between an action
state and an activity state?
• How are transitions triggered?
Functional Analysis: Summary
Build a Use Case diagram containing ...
– use cases, together with their textual specification (and
maybe analysed with activity diagrams) and
– actors, together with their textual descriptions.
-----------------
-----------------
-----------------
----------------
Insert New
Element In List
Else
Else
Swap Element
Requirements Analysis Process
Iterate Explains
Problem Domain
Object-Oriented Builds
Model
Analysis
(Concept Classes)
Analysis Phase
Finding Concept Classes
When to use Problem Domain
Modeling?
• Starting a project from scratch
• The requirements specification exists only in a very
vague form
• No predefined logical architecture available
• Facilitate the slide-over from a functional analysis to
the object-oriented analysis
The problem domain model
The problem domain model is used to explain
the concepts defined in the Use Case model.
How to do that?
• Find and define entities that have a direct counterpart
in the application environment and the system must
know about. These entities are used for realizing the
Use Cases.
So, what are these entities?
Entities
are the basis of the
object-oriented paradigm!
Now on sale!
Object-oriented
toasters!
Four objects of
the class tree!
Class & Object symbols
Here are
some objects
of the class
Pump
Element
C
1
«covalent» 2..4
Carbon Hydrogen
0..2 C H
1 C
«covalent»
Carbon Chemistry: Instance
View
:H y d ro g e n :H y d ro g e n
:H y d ro g e n :C a rb o n :C a rb o n :H y d ro g e n
:H y d ro g e n :H y d ro g e n
Class Diagram:• Association
*
Associations are drawn
1
Car owns Person between classes, not objects
Owner
1 • It means that objects of these
classes are related with each
1
other in some interesting way
insures Insurance that we want to model.
• Name the association and
Multiplicity: show with an arrow how it
•1: Exactly one. should be read:
•1..3: One to three – ”a person owns zero to many
cars”
•1,5: One or five
• Alternatively you can name
•*: Zero to many roles at the association ends:
•[nothing]: – ”Owner”
unspecified
Notes
1 0..1 CarePlan
Patient
: t h is
Note ote
No care plan exists when a
is a n
patient is initially admitted for
emergency care.
Reflects a
‚is a part of‘-
relationship
Class Diagram: Composition
A whole is responsible for the creation and destruction of its parts
A part can belong to only one whole at a time
When a whole is destroyed, its parts must cease to exist as well
It’s a strong form of aggregation
Window
* 1 1
OpenDoor RegisterUserCard
Door Administrator
RegisterAdminCard
UnRegisterUserCard
Database
Example: Access Control System
Is this a sound
problem
domain model?
1
Card
has
1 Door
-CardId
* *
«actor» may pass through
Employee
+Open
1 +Close
1
1
Code has 1 1 1
1 KeyPad CardReader Display Text
1 1
shows
4
+keyStroke(Key) +EnterCard(aCard) +Display(Text) +Show
Key +RemoveCard()
1
-Value
0..20
Character
-ASCII_Code
+Show
Example: Access Control System
Surely getting down to level of Character and Key is wildly overenthusiastic!
One should rule them out as anything but attributes because
(a) they are fully contained, with existence dependence and
(b) have value but do not represent objects that have identity!
1
Card
has
1 Door
-CardId
* *
«actor» may pass through
Employee
+Open
1 +Close
1
1
Code has 1 1 1
1 KeyPad CardReader Display Text
1 1
shows
4
+keyStroke(Key) +EnterCard(aCard) +Display(Text) +Show
Key +RemoveCard()
1
-Value
0..20
Character
-ASCII_Code
+Show
Example: Access Control System
1
Card
has
1 Door
-CardId
-Code * *
«actor» may pass through
Employee
+Open
+Close
1 1 1
-Key -Text
+Open
+Close
participates in relationships?
1 1 1
Give *
This looks
* Read Press
Press
Give Read
like a
* * * * * *
1 1 1
Card(CardData)
KeyStroke(Key) Open
Close
<operation>
{n=0}
{n=0}
[n. iteration]
PIN
validate PIN
PIN valid
select transaction
type
Example Diagram (2):
Withdraw Cash:InvalidPIN
:Controller :AccountList
Customer ATM System log
Card
PIN
Validate PIN
PIN invalid
reportSituation
ss ag e
Me
situationReport
f el i ne
to r li
A c
Objects
m o us c t o f
no n y Ob je cl ass
b j ect A
t n o wn
O c un k
obje
fel i ne
e ect l i
Activ O b j
t
objec
updateCarePlan f e l i n e
to li
a rr o w s ts
ag e t ex i
Me s s bj e c v e s
tes o a r r i
d i ca ss a g e
in me
ef o re
b
Object Destruction
a ft er
:Controller
n u i n g tes
on ti i ca
li n e c e s i nd
Life ge arriv
a ts
mess still exis
t
objec
:Controller
ct i o n
d es tru t m ay n
l i c i t d o u c ti o
Exp i n a n de stru
a g es p l i ci t
s
Mes pany ex
acc o m
:Controller
Messages
:Controller
ro n ou s
h
sync
f ine d
unde e turn
r
:Controller
no us
c hr o
asyn
Example: Different Arrows
price alarm
dial digit
dial digit
getName ringing tone ringing signal
lift receiver
Message Syntax
d s age ts
guar ion me s me n
it argu
co n d name
:Hospital
e g ion
o p e r on )
c g i
In-s ation re
v
(acti
Branching
:Controller :Controller
io n a l
o p t u s ive
n s are y e x cl
n d i tio u tu all e n c y)
r d c o b e m c u r r
gua n o t c o n
n e e d s h o w
an d m a y
t h e y
( e. g.
Timing Marks and Constraints
m ark
g
timin :Caller :Exchange :Callee
a lift receiver
{b - a < 1 sec}
b dial tone
{c - b < 10 sec}
This call is c dial number
v ig a te
y to na arks
a b ke i ng m
T m
Use d the ti ame
n n
arou essage
m
and
Modeling Loops with Sequence
• There are no quidelines given in the UML standard document,
diagrams?
however one could use this:
Loop modelling in sequence diagrams:
MyObject1 calls MyObject2.findout() with i as input
and will do so within the MyObject1.findresult() scope
until it gets the results it desires
MyObject1:class MyObject2:class
findout(i)
results
Analyzing Use Cases with Sequence
Diagrams: Extend-relation
B «extend» A
B «include» A
include A
B A
start() getStatus()
start()
start()
getStatus()
getStatus()
Object Stereotypes
• Entity object
– Generally passive; often
persistent
• Control object
– Manages interactions
between objects; usually
controls sequencing for one
use case
• Boundary object
– Insulates the rest of the
system from actors; usually
at least one boundary object
per actor-use case pair
Assigning a stereotype to
an object is optional
Diagram Navigation from a
Sequence Diagram