Uml Fundamentals: Adopted From Dr. Ernest
Uml Fundamentals: Adopted From Dr. Ernest
Addis Ts.
Adopted from Dr. Ernest
UML
Unified Modelling Language
Visualising and documenting analysis and
design effort.
• Unified because it …
– Combines main preceding OO methods (Booch by Grady
Booch, OMT by Jim Rumbaugh and OOSE by Ivar Jacobson)
• Modelling because it is …
– Primarily used for visually modelling systems. Many system
views are supported by appropriate models
• Language because …
– It offers a syntax through which to express modelled knowledge
UML Ancestry (visual)
y
Fragmentar
Booch '91 OMT-1 Other OOSE
Unification
UM 0.8 1995
Standardisation
Public UML 0.9/0.91 June to Oct 1996
feedback
Jun-Oct'96 UML 1.0 Jan 1997 Partner's
expertise
UML 2.0
2002 Superstructur e
Editorial revision
1998 UML 1.2 without significant
technical changes.
Views
Diagrams
9 diagrams
(see further on)
Model Elements
Symbology /
notation
General
Mechanisms
Use-Case
Static Structure
Object Class
Interaction
Sequence Collaboration
State
Activity
Implementation
Component Deployment
UML Diagrams (comparative slide)
Use-Case (relation of actors to system functions)
Class (static class structure)
Object (same as class - only using class instances
– i.e. objects)
State (states of objects in a particular class)
Sequence (Object message passing structure)
Collaboration (same as sequence but also shows
context - i.e. objects and their relationships)
Activity (sequential flow of activities i.e. action
states)
Component (code structure)
Deployment (mapping of software to hardware)
UML Diagram Philosophy
Any UML diagram:
• Depicts concepts
– as symbols
• Depicts relationships between concepts
– as directed or undirected arcs (lines)
• Depicts names
– as labels within or next to symbols and lines
The Main 4 UML Diagrams
• Use-Case
• Class
• Sequence
• State
Requirements Gathering
Analysis
Design
Development
Deployment
• Interaction analysis
– Tool: Internal experience (Use-Case + refined Class + State)
– Product: Sequence and Collaboration diagrams
• Coding
– Tool: Programmers using class, object, activity and component
diagrams
– Product: Code
• Testing
– Tool: Back-and-forth from the coding activity using the test cases
designed in the design phase
– Product: Test results
Development (2/2)
Use-case symbol
Actor symbol UseCase1
System boundary
Use-case characteristics:
Always initiated by an actor (voluntarily or
involuntarily);
Must provide discernible value to an actor;
Must form a complete conceptual function.
(conceptual completion is when the end observable value is produced)
UC Description Criteria
Use-Case Number (ID) and Name
– actors
– pre- and post-conditions
– invariants
Use-case
– non-functional requirements
– Behaviour modelled as:
- activity diagram/s
- decomposition in smaller UC
Described by diagrams
– error-handling and exceptions
– Rules modelled as:
- activity diagram/s
– services
– examples, prototypes, etc.
– open questions and contacts
– other diagrams
UC Description Example
UC: Login authentication
User
Disable access - Enable access
Logged in user = valid user
Login delay; line security
Behaviour modelled as:
- activity diagram/s
- decomposition in smaller UC
diagrams
Invalid login name; interrupt entry
Rules modelled as:
- activity diagram/s
Log, pass prompts; authenticate
examples, prototypes, etc.
open questions and contacts
other diagrams (realisations)
Activity Diagram from previous
Sub-UCs to Login Example
Rules Activity Diagram Example
Consolidating UC Descriptions
Ask yourself these questions:
Do all actors interacting with a given UC have
communication association to it?
Are there common roles amongst actors?
Are there UC similarities?
Are there special cases of a UC?
Are all system functions catered for by UCs?
UCD Relationships (1/2)
Association relationship
Extend relationship
«extend»
Include relationship
«include»
Generalisation relationship
UCD Relationships (2/2)
• Associations
• Links actors to their UCs
• Use (or include)
• Drawn from base UC to used UC, it shows inclusion of
functionality of one UC in another (used in base)
• Extend
• Drawn from extension to base UC, it extends the
meaning of UC to include optional behaviour
• Generalisation
• Drawn from specialised UC to base UC, it shows the
link of a specialised UC to a more generalised one
UCD Definition Summary
Use-Case diagrams:
• show use-cases and actors
• connected by “associations”
• refined by inheritance stereotypes
– “uses”
• re-use of a set of activities (use-cases)
• partitioning of activities
• points to the re-used use-case
– “extends”
• variation of a use-case
• points to the standard use-case
UCD Relationship Example
(1/2)
UCD Relationship Example
(2/2)
produce a
SRS
What a UCD is - and what it isn’t
Attention focuser on the part of the business
process that is going to be supported by the IS.
It is the end-user perspective model.
It is goal driven
Helps to identify system services.
Are not used as DFDs.
Sequences, branching, loops, rules, etc. cannot
(and should not) be directly expressed.
Are often combined with activity diagrams, which
serve as their refinement.
UCD Case Study (1/3)
Vending Machine
• After client interview the following system
scenarios were identified:
• A customer buys a product
• The supplier restocks the machine
• The supplier collects money from the machine
• On the basis of these scenarios, the following
three actors can be identified:
• Customer; Supplier; Collector
UCD Case Study (2/3)
UCD Case Study (3/3)
Introducing annotations (notes) and constraints.
Testing UCs
Verification
– Confirmation of correct development according to
system requirements.
Validation (only when working parts become
available)
– Confirmation of correct system functionality
according to end-user needs.
Walking the UC
– This is basically, interchangeable role play by the
system developers.
Workshop Activity -9-
Create a simple UCD (i.e. no “uses” or “extends”
relationships) for a course registration system described
as follows:
“The course registration system should
allow students to register for and drop
courses. The system’s administrator should
be able to add and delete courses from the
system as well as to cancel planned
courses. If a planned course is cancelled
the relevant instructor should be notified
through the system.”
(Loosely adapted from Lee, 2002)
Workshop Activity -10-
Create a UCD showing UC relationships (i.e. with
“uses” or “extends” relationships and any actor
generalisations) for an automated medical
appointment system described as follows:
“The appointment system should allow new
or existing patients to make medical
appointments according to doctor-
controlled availability schedules.
Medical Centre management should be able
to view current schedule information.”
(Loosely adapted from Dennis, 2002)
The UML Class Diagram
• Is a static diagram (describes system
structure)
– Combines a number of model elements:
• Classes
• Attributes
• Operations (methods)
• Associations
• Aggregations
• Compositions
• Generalisations
A UML Class
Name
Attributes
Operations
Attribute syntax:
Visibility name:type=init_value{property_string}
UML Class Attribute Examples
UNIXaccount UNIXaccount
+ username : string + username : string
+ groupname : string + groupname : string = “staff"
+ filesystem_size : integer + filesystem_size : integer
+ creation_date : date + creation_date : date
- password : string - password : string
Invoice
Invoice + amount : real
+ amount : real + date : date = current date
+ date : date = current date + customer : string
+ customer : string + specification : string
+ specification : string - administrator : string = "unspecified"
- administrator : string = "unspecified" - number_of_invoices : integer
- number_of_invoices : integer + status : status = unpaid { unpaid, paid }
UML Class-to-Java Example
Public class UNIXaccount UNIXaccount
{ + username : string
public string username; + groupname : string = “staff"
public string groupname = "csai"; + filesystem_size : integer
public int filesystem_size; + creation_date : date
public date creation_date;
private string password; - password : string
static private integer no_of_accounts = 0 - no_of_accounts : integer = 0
public UNIXaccount()
{
//Other initialisation
no_of_accounts++;
}
//Methods go here
};
Operations (Methods)
Public class Figure Figure
{ - x : integer = 0
private int x = 0; - y : integer = 0
private int y = 0; + draw()
public void draw()
{
//Java code for drawing figure
}
};
Figure fig1 = new Figure();
Figure fig2 = new Figure();
fig1.draw();
fig2.draw();
Constraints on Operations
PoliceStation
alert (Alarm)
1 station
BurglarAlarm
report () { if isTripped
then station.alert(self)}
Association Examples
Person * Drives
* Car
Driver Company
car
Person * 1
Employee
1 Drives
* Car
Adult Driver Driver Company
car
Married to
Person Person
Husband Wife
1 ..*
{ordered by surname}
* No qualified or aggregation
associations allowed in ternary.
Member
season
Team Player
team goalkeeper
Record
goals for
goals against
wins
losses
ties
Association Classes
Host
* Computer
Network adapter
Adapter Queue
Print spooler
1
1..*
Network 1 Printer
Notary
Purchaser Real-estate
Client Contract
Association by Aggregation
Alternative Notation for
Composition Association
Car
*
Wheels
Body
*
*
Engine
My family
Ernest: Family member
Fiona: Family member
Ernest
Fiona
Zoo Family
member
Zoo
Monkey[0..*]: Mammal
Giraffe[0..*]: Mammal
Monkey
Human[1..*]: Mammal
Human
Giraffe
Falcon[0..*]: Bird
0..* 0..* 1..* Falcon 0..* Cage 1..*
Cage[1..*]: Equipment
Mammal Bird Equipment
Abstract Classes
Abstract Classes and
Generalisation Example
Aircraft
{abstract}
Make
Seats
Engine type
Start() {abstract}
land() {abstract}
Make Make
Seats Seats
Engine type Engine type
Start() Start()
land() land()
Start jet engines Start blades
Consists of *
Radio Monitor
Amplifier unit
receiver
TV set
Complete Generalisation
University
faculty
component
{complete}
University University
department institute
Person
{complete}
Man Woman
Expressing Rules in UML
• Rules are expressed using constraints and
derivations
●Constraints were mentioned earlier (e.g. or-
associations, ordered associations, inheritance
constraints, etc.)
Is on
/1 class passenger /1 class passenger
Passenger
Passenger
Name
Surname
Age
Nationality
Destination Turbo-prop Jet-turbine
Ticket price aircraft aircraft
/1 class passenger
Supplies Processes
Wholesaler Shop Order
Shop
Places
Name
Address
Owner
Category /bulk-buying customer
Date of registration Customer
Area
/Supermarket
Maintains
Entry in
Organisation
{subset}
Project manager of
Member of Employee
«call» ClassC
«refine»
ClassC combines
two logical classes
ClassD ClassE
Concrete Dependency Example
Controller
«access»
«access»
«access» Diagram
Elements
«access»
«access»
Domain Graphics
Elements Core
Class Diagram Example
Element
C <<covalent>>
Carbon Hydrogen
C H
<<covalent>> C
Instantiation of Class Diagram
(in previous slide)
:H ydrogen :H ydrogen
:H ydrogen :H ydrogen
Another Class Diagram Example
CreditCard
{abstract} MyCreditCard
OrderBean
<<interface>> {abstract}
EntityBean
+getOrderStatus
+setOrderStatus MyOrder
+getLineItems
+setLineItems
order +getCreditApproved
+setCreditApproved
* ...
1 order
buyer 1 * item
Customer LineItem
{abstract} MyLineItem
*
* item
1 commodity
Product
Try This Yourselves…
• Create a class diagram to represent a
arbitrary interconnection of computers
Vote
Pedestal
Lobby
«interface» «interface»
Support Work
{abstract} {abstract} Politician
Representation
Work
Donate() {abstract} Report() {abstract}
Canvass() {abstract}
UML Interface Specialisation
• Interfaces are subject to inheritance in the same
way as classes are. Interface inheritance can be
shown on a class diagram.
Voter For class specifications
Support see next slide.
Subsystem A
Expanded view of "Subsystem A"
showing that it groups together
Subsystem C
three other packages named
Subsystem B "Subsystem B/C/D". Note, that
the name of an expanded
package is indicated in the
Subsystem D
package tab. This is another way
of showing composed
aggregation.
Examples of Relationships between
UML Packages
Subsystem A
Subsystem D
Subsystem B is dependent on C
while Subsystem D is dependent
on both B and G. Subsystems E
and F are specialised from the
generalisation Subsystem D. All
Subsystem E Subsystem F
packages are within Subsystem A
except for Subsystem G.
Examples of UML Package
Importation
C
D E
B C::D
B
A
B C
Packaging Steps
1. Set the context
2. Cluster classes together based on
shared relationships
3. Model clustered classes as a package
4. Identify dependency relationships
amongst packages
5. Place dependency relationships between
packages
Workshop Activity -12-
Package and dependency-link the classes in the
following system:
Assuming that an automated medical appointment system is to
be partitioned as:
• HCI layer
• Problem Definition layer
• Data Management layer
Furthermore, system classes are identified as:
• Patient UI
• Appointment UI
• Patient management
• Appointment management
• Patient data management
• Appointment data management
• Patient DB
• Appointment DB
Workshop Activity -13-
External
impact
Life time Bulb
exceeded discarded
Broken
Details
correct Writing
Registering
Ballot paper
Booth issued
Ballot paper
free
complete
Polling station Decision taken
open
Waiting Call
On the Arrive
Deciding Casting
move at booth
Ballot cast
“Compartments” of a UML State
Name
State variables
(optional)
Activities
Standard Events in “Activity
Compartment”
• Entry
• Specify actions to be taken on entry into the
given state (e.g. Assignment to an attribute or
sending a message, etc.)
• Exit
• Specify actions to be taken on exit from the
given state (e.g. Run housekeeping program or
send message informing of termination, etc.)
• Do
• Specify actions to be taken while in the given
state (e.g. Processing data, polling, etc.)
Example of Activity Syntax
login
Login_time = current_time
entry/type "login"
exit/send (username, password)
do/get username
do/get password
help/display help
Note, that actions while in a state, are an on-going process, while events
associated with a transition are stimuli to the triggering of that transition.
Therefore, it is possible that events on transitions act as interrupts to
on-going processes in any given state.
Auto-Triggering of Transitions
• Events can be associated to UML transitions
• UML transitions can be left "event-less"
• If "event-less", then transition triggering in
UML becomes dependent on internal state
actions
• An "event-less" UML transition will auto-
trigger when all its associated internal
actions get executed.
Auto-Triggering Examples
Boot Starting OS Starting
applications
do/run bios do/load OS do/load
program applications
event-
name'('parameter',',...')'
parameter-name':'type-expression,...
destination-expression'.'destination-event-name'('argument','...')'
draw(f:figure, c:colour)
redraw
message_received
go_up(floor)
ready
reach_end(section:text_part)
Event-Signature Usage Example
Moving up
Arrived
Moving down
Go_up (floor)
Arrived
do/moving to floor
Moving to
first floor
Arrived
Idle
Go_down (floor)
Time-out
UML Guard-Conditions
Is a Boolean expression
Is associated with a UML transition
Is 'AND-ed' with the event-signature (if
present)
Control whether a given transition will trigger
or not
Examples include:
[t = 15s]
[retries > 3]
withdrawal(amount) [balance >= amount]
read (buff:char) [buff_elements > 0]
Guard-Condition Usage Example
Moving up
Arrived
Arrived
Moving down Go_up (floor)
do/increase timer
Go_down (floor)
[timer = time-out]
UML Action-Expressions
• Action-expressions execute when a transition
happens
• Not to be confused with internal activities in the
activity compartment of a UML state
• Must use parameters existing within the object
being modelled by the given state diagram or
parameters existing within the associated event-
signature
• Zero, one or more action-expressions can be listed
per transition using the "/" symbol as delimiter. In
the case of more than one, execution is from left to
right.
Action-Expression Usage Example
Moving up
Arrived
Moving down Go_up (floor)
Go_down (floor)
ok_packet_cnt ++
entry/init arrays
do/fill data array
do/fill header array
Receiving packet
exit/send ok Inc() / separate_parts(data) / length (data)
packet_cnt ++
entry/init buffer
do/get packet
do/send ack
exit/send ok
The Send-Clause
• Also a form of action(-expression)
• Explicitly designed syntax to show
message passing
• The destination of the message could be
an object or a set of objects
• The destination object can be the object
described by the state-diagram itself
Send-Clause Examples
Idle
timer = 0
[timer = time-out] / go_down(first_floor)
On first floor
do/increase timer
Equivalent transitions
Idle
timer = 0
[timer = time-out] ^ self.go_down(first_floor)
On first floor
do/increase timer
Other examples:
out_of_paper() ^indicator.light()
request_withdrawal(amount) / show_amount() ^account.debit(amount)
left_mouse_btn_down(location) / colour := pick_colour(location)
^pen.set(colour)
UML Events
UML defines four categories of events:
• A condition becoming true (i.e. A Boolean
condition and shown as guard-condition)
• Receipt of an explicit signal, itself an object, from
another object (i.e. A message and shown as an
event-signature)
• Receipt of a call on an operation by another
object (or by the object itself) (i.e. Also a form of
message and also shown as an event-signature)
• Passage of a designated period of time (i.e. Time
calculation and shown as a time-expression)
Relationship of Events to Class
Operations
Class Digita l_wa tch
Activa te ()
De -a ctiva te ()
mode _btn()
inc()
State Diagram
Inc / hours := hours + 1 Inc / hours := minute s + 1
mode _btn
Example of Signal Class
Structuring and Polymorphism
«signal»
Input
{abstract}
Device : Device
Send
Time : Time Input
Idle
do/send(input)
mode _btn
«frie nd»
mode_btn
State Watch
Inc
Us e d only to «frie nd»
hold s ta te va lue s Digital_display Watch Me thods
Java implementation of a UML
State Diagram (2/3)
Public class State
{
public final int Display = 1;
public final int Set_hours = 2;
public final int Set_minutes = 3;
public int value; Ple as e no te , tha t the cla s s Digita l_dis pla y
} is omitte d to ke e p the e xa mple 's code
public class Watch
{ s horte r a nd more to the point.
private State state = new State();
private Digital_display LCD = new Digital_display();
public Watch()
{
state.value = State.Display;
LCD.display_time();
}
public void mode_btn()
{
// Cycle through actions depending on current state (see next slide)
}
public void inc()
{
// Update corresponding LCD segments (see next slide)
}
Java implementation of a UML
State Diagram (3/3)
// Cycle through actions depending on // Update corresponding LCD segments
// current state (from previous slide) // (from previous slide)
Public void mode_btn() Public void inc()
{ {
switch (state.value) switch (state.value)
{ {
case State.Display : case State.Display :
LCD.display_time(); ;
state.value = State.Set_hours; break;
break; case State.Set_hours :
case State.Set_hours : LCD.inc_hours();
LCD.display_hours(); break;
state.value = State.Set_minutes; case State.minutes :
break; LCD.inc_minutes();
case State.minutes : break;
LCD.display_minutes(); }
state.value = State.Display; }
break;
}
}
Messaging between UML State
Diagrams
• Used to communicate operations or
messages between state diagrams
• Can be implemented by action-expressions
(as described earlier) or by dashed arrows
• The Dashed arrows can originate from
either a specific state diagram transition or
from the state diagram as a whole
• The target state diagram MUST contain the
appropriate event-signatures to "catch" any
sent messages
Examples of UML State Diagram
Messaging (1/2)
Network adapter
Ack() Ack()
Re ce iving Re ce iving a nd Dumping
dire ct no_a ck() buffe ring no_a ck() buffe r
Empty_s ig()
I/O Processor
S ig() / Ack()
Idle Intr() / no_a ck()
P roce s s ing
Examples of UML State Diagram
Messaging (2/2)
CD Player
Off() P la y()
Off On()
Idle P la ying
S top()
Off()
Remote Control
S top()
Off()
Off On()
On
P la y()
UML Sub-States
A mechanism for nesting states
Take the form of "and-sub-states" or "or-sub-states
Tape_winding
Re-winding Fast-forward
Example of an
or-sub-state
Examples of "or" and "and" sub-
states
Flight_mode
Example of an
or-sub-state
Video_playback
Forward Backward
Normal Fast
Example of an
and-sub-state
Usage Example of the UML History
Indicator (1/2)
Civil-service_career
Executive Administrative
Clerk
officer assistant
H Administrative
officer
Restart()
OS Restart_OS
Create()
Start install Restart() Install
shield entry/Ask install self.Restart()
questions
[alternative = try_again]
H do/Install software
Disk_error Low_memory
entry/Fix disk [alternative = stop]
do/Show question dialog entry/Show question dialog
do/Ask alternative do/Ask alternative
[alternative = stop]
Workshop Activity -14-
A class named “campaign” is textually described as
follows:
“Once a campaign is established, it is assigned a manager and
staff. Authorisation in the form of a signed contract and an
authorisation code is required to kick-off an established campaign.
Once a campaign is started it is noted as active. On completion of
an active campaign, accountability is carried out in the form of
preparation of final statements. Once payment is received in full, a
campaign is considered paid, is archived and any assigned
personnel is released. If payment is only effected in part, the
campaign is not considered paid but rather simply completed. If any
payments were effected in advance of campaign completion and
are in excess of the final payment request, a refund should be
issued.
Draw a UML state diagram for the above system.
Workshop Activity -15-
Invalid_data(data)
Button_press(ok)
Button_press(help)
Time flow
Button_press(ok)
Guidelines for Building a UML
Sequence Diagram
1. Set the context (i.e. scope the system)
2. Identify participating objects
3. Draw arbitrary lifelines for each class
4. Draw the duration of the objects on the
class lifeline
5. Insert the object messages from top to
bottom of diagram (time-based)
6. Check the diagram for completeness
Iteration Conditions in UML
Sequence Diagrams
Iteration condition controlled message syntax:
[continuationCondition]*operation(parameter)
An example…
:loginSession :poller :host
[host1NotFree]reqStatusHost2()
[host2NotFree]reqStatusHost3()
Recursion Modelling in UML
Sequence Diagrams
Recursion is always carried out by call
(synchronous) messaging and is represented in UML
sequence diagrams as follows:
getFractal()
:Formatter :Fractaliser
calcFract(int)
[for all integers in range]*calcFract(int)
Recursion Example in UML
Sequence Diagrams
loadFile(file)
:Computer :drillController :Driller
Drill(coord)
initSeq()
move(offset)
finalSeq()
getClientName()
listCampaigns()
listAdverts()
addNewAdvert()
Advert()
new Ad:Advert
Try this too…
Create a sequence diagram modelling the
behaviour of a PCB drilling machine. The
machine will drill holes in a PCB of given
dimensions at a set of given co-ordinates.
Co-ordinates are given as a list, which
must contain at least one set of co-
ordinates. Drilling stops when the end of
the list is reached or when a user
interrupts the process.
A Solution to Previous Slide
loadFile(file)
:Computer :drillController :Driller
Drill(coord)
initSeq()
move(offset)
finalSeq()
listAdverts()
removeAdvert()
delete()
X
Using Labels in UML Sequence
Diagrams (1/2)
Activate()
:Computer :BootManager :OS1
Boot()
a
{max a-b = 8s}
Load()
b
Req()
Send message Req() to
port until status() from
printer is “data_ready” Query()
Status()
initInputSeq()
initProc()
start Farm()
st artGet1()
st artGet2()
startGet 3()
startGet 4()
Some Points to Ponder
1. Compare the following term-pairs:
State – Behaviour
Class – Object
Action – Activity
Use-case – Scenario
Method – Message
2. Do lifelines always continue down the entire page of a
sequence diagram? Explain.
3. What is meant by focus of control in sequence diagrams?
4. What are the essential parts of a sequence diagram
message? Give one concrete example.
5. How do synchronous and asynchronous messages
differ? Give one concrete example of each case.
Workshop Activity -16-
Assuming that a microwave oven is analysed as the following
objects:
• Oven
• Light
• Emission tube
• Timer
The main actions associated with the microwave oven are as
follows:
• Opening the door
• Closing the door
• Using the control button
• Completion of the prescribed cooking interval
Create a sequence diagram for the following scenario:
– Open the door, insert the food, close the door set the 1-minute timer,
wait for cooking to complete, open the door and retrieve the food.
Create a state diagram for the above scenario.
UML Collaboration Diagram
• Show interactions between collaborating
(interacting) objects.
• A bit like a cross between a class and a
sequence diagram (object diagram with msgs)
• Are mainly a design tool
• Collaboration diagrams are not time-ordered
• Can serve as basis for a sequence diagram
• Like sequence diagrams, collaboration
diagrams employ message passing.
Basic Components of a UML
Collaboration Diagram
service
Object1:ClassA
Service:
Sequence-number:[condition]:message(parameter)
Print(ps_file)
:Computer
1:Print(ps_file)
[printerFree]1.1:Print(ps_file)
:printServer :Printer
UML Collaboration Diagram
Example with Return-Value
calcPrime(n)
:Calculator
1*[z:=1..n]:Prim:=nextPrime(prim)
:primModule
Try This Yourself…
• Explain in plain English, what the following
collaboration diagram depicts:
3:Show(customer)
2:Create()
:customerWindow
{transient} 3.1:Update(data)
…and This One Too Please…
Push() 1:getElevator(floor_id)
:Button :elevatorControl
:Queue
2:next_job=getJob()
{parameter} job job
play()
main:CDplayer
Steps in Building a UML
Collaboration Diagram
1. Set the context
2. Identify which objects and which
associations between them participate in
the collaboration
3. Draw the classes/objects and link them
4. Insert the messages
5. Validate the diagram
Workshop Activity -17-
Assuming the following 4 classes:
• CampaignDialogue
• Client
• Campaign
• Advert
Produce a collaboration diagram modelling
the addition of a new advert to an existing
campaign. Stereotypes need not be used.
UML Component Diagrams
• Models parts of software and their inter-
dependencies
• Represents code structure
• Are generally implemented in physical
terms as “files”
• Come as either “source”, “binary”, or
“executable” components
• ONLY executable type components can
be instantiated
Predefined Component Diagram
Stereotypes
• File
– Usually a source code file
• Binary / Library
– Usually a compiled segment directly linkable into other
compilations
• Executable
– Usually a directly executable module
• Table
– Usually a database table
• Page
– Usually a Web page
• Document
– Usually a documentation file (as opposed to compilable code)
Example of a UML Component
Diagram
Example of Source Code
Dependencies
<<page>>
home.html
<<file>> <<document>>
aProg.java aProg.doc
<<file>> <<document>>
anotherProg.java anotherProg.doc
Runtime Component Example
<<executable>>
viewer.exe
UML Deployment Diagrams
• Models the run-time architecture (topology)
of:
• Processors
• Devices
• Software components
• Is ultimately traceable to initial requirements
NEC PowerMate
i-Select VL4
PC:ClientA
*
<<TCP/IP>> VAX:DB Server
Silicon Graphics
O2:Server
* <<DecNet>>
* * *
Dell Dimension
*
2350 PC:ClientB
<<TCP/IP>>
Component Support in UML
Deployment Diagrams
UNIX Transaction
server sub-system
<<supports>>
NEC Server
Object Allocation in Deployment
Diagrams
Controller:MicrowaveOvenSystem
Guard.exe
<<process>>
Supervisor
Thermometer
controller
ClientProg,exe
NEC Server:MainServer
transf TransactionServ.exe
T1:updateThread
Supervisor
<<becomes>>
transf
dbobj
callobj
Deployment Diagrams in the form
of Class Diagrams
The End