UML0
UML0
- 1 of 23 -
Within the unified process
Each cycle contains four phases
• Inception
Goal – establish viability of proposed system
Define scope of the system
Outline candidate architecture
Identify critical risks
Determine when and how they will be addressed
Start to make case that project should be done
• Elaboration
Goal – establish ability to build system given all constraints
Capture majority of remaining functional requirements
Expand candidate architecture into full architectural baseline
Finalize business case for project
Elaborate on plans for next phase
• Construction
Goal – build a system capable of operating successfully in beta customer site
Build system iteratively and incrementally
Make certain visibility always evident in executable form
• Transition
Goal – roll out fully functional system to customer
Correct any defects
Modify system to correct any previous unidentified problems
Within process
We identify five workflows that cut across all four phases
Each workflow is set of activities project people perform
• Requirements
Establish requirements for system
These are high-level functional requirements
For system being modeled
These give the what of the design not the how
Allows people to agree on
- 2 of 23 -
Capabilities of system
Conditions to which it must conform
• Analysis
Build analysis model
Used to refine and structure
Functional requirements captured earlier
• Design
Build design model
Describes the physical realization
From requirements and analysis models
• Implementation
Build implementation model
Describes how requirements packaged into software components
• Test
Build test model
Describes how system integration and systems test
Will exercise components from implementation model
Class
Use Case
UML Diagrams Component
Communication
UML uses diagrams and models
State Chart
As a first step towards expressing Timing
Sequence
Static and dynamic relationships amongst objects Activity
- 3 of 23 -
On the user side
Designers who work with UML range from
Those who are putting together a ‘back of the envelop’ sketch
To those who utilize it as a formal (high level) design and programming language
Current standard recognizes thirteen different classes of drawings
As a design evolves
These different perspectives offer a rich set of tools
Whereby we can formulate and analyze potential solutions
Such tools enable one to model several different aspects of a design
It’s rare that all of the types are used in a single design.
- 4 of 23 -
Let's look at several of the
Static and dynamic components and relationships
Static diagrams will be a portion of our work
Dynamic diagrams will be more relevant
To start we will introduce and use the static aspects of UML models
- 5 of 23 -
The use case diagram
Intended to present the main components of the system
How the user interacts with those components
Like many of the diagrams we’ll work with
Use case diagram can be hierarchical in nature
From top level drawing, one can expand each use case
Into sub use cases as necessary
Components
Diagram comprises three components
The system
The actor(s)
The use case(s)
System
Meaning of system is self evident
It’s expressed in the diagram as a box
We’ll often leave this off the diagram
Actors
An actor represents
“A coherent set of roles users of use cases play when interacting with these use
cases."
Booch 1999, pp. 221
Represent any one or any thing that might be using the system
Human
Hardware device
Another system
Drawn as simple stick figures
Viewed as being outside of the system
- 6 of 23 -
Accompanying each use case
Is a textual component fully describing it
Use case diagrams can be a very powerful tool
During the early stages of a project
When trying to identify, define, and capture the requirements for system
drawing Actor0
Actor1
- 7 of 23 -
Use cases in a requirement
Show the static relationship between use cases
Equally important to analyze what a use case means
In terms of the functionality the system must deliver
Associated with each use case is a textual description
Called the use case specification
Such a description can be decomposed into two pieces
Normal activity of the use case
How exceptional conditions are to be handled
- 8 of 23 -
Later when more detail needed
Rectangle subdivided into three areas
• Top area gives the name of the class or object
• Middle section identifies all of the properties of the object
Will generally be declared inside the module implementation
Thereby hidden from the casual user
• Third pane identifies the operations object is intended to perform
These establish the external behavior of the object
Provide the public interface to the object.
For us embedded systems typically implemented as collection of tasks
Task is collection of activities
Having some purpose
Like classes - tasks have
Names
Attributes
Operations
Object diagram or class diagram
Reflects exactly the information we need
To express a task - we have
Function which implements the task
Data which task utilizes
Can then include task and intertask relationships
Intertask Relationships
We can define number of different relationships
Among tasks
Such relationships can be
Static
Dynamic
Both
Static relationships
Will give us the architecture of our design
Dynamic relationships
Will give us behaviour of our system
At runtime
- 9 of 23 -
Static Relationships
We’ll start with static relationships
Relationships
Containment
Containment conveys the idea
One object is made up of several others
Implements a whole – part relationship
Aggregation
Aggregation which expresses a whole – part relationship
In which one object or module
Contains another module
Key characteristic of an aggregation
One or more smaller functions are parts of whole
More complex function decomposed
Into number of smaller functions or modules
Owned module(s) may be shared with other modules
Outside of the aggregation
Linked list represents good example
Under such conditions
Rules must be established
To ensure proper management of the shared module
Diagram illustrates design in which
Graphics display implemented as
Aggregate of windows
Windows can exist
- 10 of 23 -
Outside of display
GraphicsDisplay Window
+update() +update()
+redraw() 1 n +draw()
+draw() +redraw()
Composition
The composition relationship is similar to aggregation
Notion of ownership of the parts by the whole is much stronger
Elements of the composition
Cannot
Be part of another object
Exist outside of the whole object
Idea is loosely analogous to local variables in a function
Once one leaves the scope of the function
Local variables disappear
Schedule Timeline
Consider a schedule
Made up of a number of intervals +newTask()
+update() 1 n
+update()
+setStart()
+modify() +setEnd()
Without the schedule
Intervals have no meaning
We express such a relationship as given
The schedule is composed of 1 to n intervals
Diagram is similar to that for the aggregation
The connecting line now originates in a solid rather than open diamond
We annotate the relationship as a 1 to n composition
- 11 of 23 -
Dynamic Relationships
Dynamic relationships
Provide information about behaviour of system
While performing intended task
Provide information about interaction among tasks
While performing task
Dynamic behaviour
Gives us information about the lifetime of a task
Tells us when that task is active
When it’s using the CPU
Models interactions amongst tasks
Such interaction takes form of messages
- 12 of 23 -
Generally message results in
One or more actions
Such actions are executable functions within the task
Result in change in values of one or more attributes
Begin with only two tasks
:Taski :Taskj
action()
Action
return()
- 13 of 23 -
Create and Destroy
Express create action
Solid arrow from creating object to created class instance
Express destroy action
Solid arrow from destroying object to destroyed class instance
:Taski :Taskj
<<create>>
<<destroy>>
Send
Express send action
Solid arrow with half arrow head
From sending task to receiving task
Sender does not expect response
:Taski :Taskj
action()
Sequence Diagrams
Purpose of sequence diagram
Express time ordering of message exchange
Between objects
Build from components of interaction diagram
- 14 of 23 -
Have 4 key elements
• Objects
Appear along top margin
For our implementation these will be the tasks
• Lifeline
Described earlier
• Focus of control
Thin rectangular box
Straddles task’s lifeline
Indicates time during which object
In control of flow
Executing method or
Creating another task
• Messages
Show actions objects perform
Each other
Self
:loginTask :connectSubtask :validateSubtask
:user
enterIDPassword()
Observe that the loginTask has
sendEnter()
spawned
validate()
loginSubtask
login ok
loginValid()
As the sequence proceeds
The validateSubtask spawned and
Confirms login parameters
- 15 of 23 -
Fork and Join
When we work in multitasking system
Like most embedded applications
Common sequence
Parent process or task to start
Spawn several child tasks
These do the real work
Child tasks complete
Child tasks terminate
Parent class terminates
Activity/Action
Activity/Action Activity/Action
Activity/Action Activity/Action
Activity/Action
- 16 of 23 -
Forks and joins represented by thick black rectangle
Called synchronization bar
Fork occurs after first activity or action completes
Following action
Task spawns subtasks
Suspends itself until subtasks complete
FTP application is good example
Activity 2 Activity 3
- 17 of 23 -
Following completion of activities in right hand path
Flow of control merges back to a single path
At each branch point Initial Node
[guard condition]
Shown in square brackets on the transition Activity 3
Activity Diagram
An activity diagram permits the capture of Activity 7
Events
Any embedded application must interact
With world around it
System will accept inputs and produce outputs
Inputs generally result in some associated action
Actions may or may not lead to an output
- 18 of 23 -
Such inputs outputs and actions
Referred to under various names
- 19 of 23 -
Transitions between states
Reflect change in system from one state to another
Expressed as an arrow directed from State1
event1
State2
Source to destination
Triggered Transition
transition
• We may have a transition to self State7
Self Transition
We see all four types of transition in
Accompanying figure
Guard Conditions
A guard condition
Boolean expression that must evaluate to true
Before transition can fire
- 20 of 23 -
• Guard condition by itself
[guardCondition]
Repeated self transition until met
In following diagram
Solid black circle
Represents initial state
Solid circle with surrounding open circle
Represents final state
State8 State9
event1 [guard1]
event / action
State11 State10
- 21 of 23 -
• Exit action
Action system always performs
Immediately before leaving state
Appears as exit / actionName within state symbol
• Deferred event
Event that is on interest to system
Handling deferred until system reaches another state
Appears as eventName / defer within state symbol
Such events get put into queue
When system changes state
Composite States
Sequential States
History States
- 22 of 23 -
However
Can use history substate to remember
Last state system in before leaving composite state
We see such a state useful when modeling interrupt behaviour
Under interrupt we leave present state
Return to same state following interrupt
State12 H State13
State15 State14
Concurrent Substates
aState
State16 State17
State18 State19
- 23 of 23 -