0% found this document useful (0 votes)
13 views39 pages

Roadmap of UML

Oops UML DESIGN

Uploaded by

Krishna Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views39 pages

Roadmap of UML

Oops UML DESIGN

Uploaded by

Krishna Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

UML Unified Modeling Language

UML

Unified Modeling Language

1
UML Unified Modeling Language

Types UML

Structure Diagrams Behavioral Diagrams

1. Class Diagram 1. Use Case Diagram


2. Component Diagram 2. Activity Diagram
3. Deployment Diagram 3. State Machine Diagram
4. Object Diagram 4. Sequence Diagram
5. Package Diagram 5. Communication Diagram
6. Profile Diagram 6. Interaction Overview Diagram
7. Composite Structure Diagram 7. Timing Diagram

2
UML Unified Modeling Language

Structure Diagrams

1-Class Diagram

Class Notation Class Relationships

There are three major parts of a class To create a class diagram, the next step
diagram as shown in the image below: is building relationships. There are three
main types of relationships here:
1. Class Name
2. Class Attributes 1. Generalizations
3. Class Operations 2. Associations
3. Dependencies

—--------------------------------------------

Generalizations

Generalizations are often known as


Inheritance because it links a subclass to
its superclass. The class diagram allows a
subclass to inherit from multiple
superclasses but it can’t be used to model
interface implementation. Checking,
Savings, and Credit Accounts are
generalized by Account

Attributes

3
UML Unified Modeling Language

Associations Composition

1. class House {
2. private Room livingRoom;
3. // constructors, methods, etc.
4. }
5. class Room {
6. // room implementation
7. }

Inheritance

1. class Animal {
2. // animal implementation }
3. class Dog extends Animal {
4. // additional dog-specific properties and
behaviors
Association 5. }

1. class Car { Realization


2. private Engine engine;
3. private Wheel[] wheels; }
4. class Engine { // engine }
5. class Wheel { // wheel } 1. interface Printable {
2. void print(); }
3. class Document implements Printable {
4. public void print() { // printing }}
Aggregation

1. class Library { Dependency


2. private List<Book> books;
3. // constructors, methods, etc.
1. class Order {
4. }
2. private Customer customer;
5. class Book {
3. // constructors, methods, etc. }
6. // book implementation
4. class Customer {
7. }
5. // customer implementation }

4
UML Unified Modeling Language

Association Navigability Class-owned on one side (navigable in both


directions)
Class-owned on one side (explicitly
non-navigable)

—------------------------------------------
Association Cardinality

Unspecified navigability
Navigable in one direction
Navigable in both directions
Navigable in one direction (explicit)
Non-navigable
—-------------------------------------
ssociation Navigability with Class
The association ends can have various
Ownership
cardinalities:

● One
● Zero or one
● Zero to many
● One to many
● Many
● A specific number
● A specific range of numbers

Class-owned on one side (navigable in one


direction)
Class-owned on both sides (explicitly
navigable)
Class-owned on both sides (implicitly
navigable)

5
UML Unified Modeling Language

Dependencies

Dependency shows that one class


depends on another. Change in one class Class Diagram Example: Order
will create change in another class. For
example, an employee is dependent on the System
organization.

1. class Organization {
2. // organization implementation
3. }
4. class Employee {
5. private Organiz organiz;
—--------------------------------------------------------
6. public Employee(Organiz organiz){
7. this.organiz=organiz;
8. }}
Class Diagram Example: GUI

Member access modifiers

All classes have different access levels


depending on the access modifier
(visibility). Here are the access levels
with their corresponding symbols:

● Public (+)
● Private (-)
● Protected (#)
—--------------------------------------------------------
● Package (~)
● Derived (/)
● Static (underlined)

6
UML Unified Modeling Language

2-Component Diagram

Component Diagram at a Glance Component Diagram Example -


Using Interface (Order System)

—-----------------------------------------------------
—-----------------------------------------------------

Port
Basic Concepts of Component
Diagram Ports are represented using a square along
the edge of the system or a component. A
1. A rectangle with the component's port is often used to help expose required
name and provided interfaces of a component.
2. A rectangle with the component icon
3. A rectangle with the stereotype text
and/or icon

—-----------------------------------------------------
—-----------------------------------------------------

Association: _______________
Interface
In the example below shows two type of ● An association specifies a semantic
component interfaces: relationship that can occur between
typed instances.
● It has at least two ends represented
by properties, each of which is
connected to the type of the end.
More than one end of the association
may have the same type.

7
UML Unified Modeling Language

Composition: Links:

● Composite aggregation is a strong ● A generalization is a taxonomic


form of aggregation that requires a relationship between a more general
part instance be included in at most classifier and a more specific
one composite at a time. classifier.
● If a composite is deleted, all of its ● Each instance of the specific
parts are normally deleted with it classifier is also an indirect instance
of the general classifier.
—----------------------------------------------------- ● Thus, the specific classifier inherits
the features of the more general
Aggregation classifie

● A kind of association that has one of —-----------------------------------------------------


its end marked shared as kind of Modeling Source Code
aggregation, meaning that it has a
shared aggregation. Component Example - Java Source Code

—-----------------------------------------------------

Dependency

● A dependency is a relationship that


signifies that a single or a set of
model elements requires other Component Diagram Example - C++ Code
model elements for their with versioning
specification or implementation.
● This means that the complete
semantics of the depending
elements is either semantically or
structurally dependent on the
definition of the supplier element(s)

—-----------------------------------------------------

Modeling a Physical Database


Constraint

● A condition or restriction expressed


in natural language text or in a
machine readable language for the
purpose of declaring some of the
semantics of an element.

8
UML Unified Modeling Language

Component diagram for a library Provided interfaces:


management system
A straight line from the component box with
an attached circle. These symbols
represent the interfaces where a
component produces information used by
the required interface of another
component.

—-----------------------------------------------------

Required interfaces:
A straight line from the component box with
an attached half circle (also represented as
a dashed arrow with an open arrow). These
symbols represent the interfaces where a
component requires information in order to
perform its proper function.

—----------------------------------------------------- —-----------------------------------------------------

Component diagram for an ATM


system

9
UML Unified Modeling Language

3-Deployment Diagram
Other Notations
When to Use Deployment Diagram
● Dependency
● Association relationships.
● What existing systems will the newly ● May also contain notes and
added system need to interact or constraints.
integrate with?
● How robust does system need to be
(e.g., redundant hardware in case of
a system failure)?
● What and who will connect to or
interact with system, and how will
they do it
● What middleware, including the
operating system and
communications approaches and
protocols, will system use?
● What hardware and software will
users directly interact with (PCs,
network computers, browsers, etc.)?
● How will you monitor the system
once deployed? —---------------------------------------------------
● How secure does the system needs
to be (needs a firewall, physically Steps for Modeling a Client/Server
secure hardware, etc.)?
System
—---------------------------------------------------
The example shows the topology of a
human resources system, which follows a
Nodes classical client/server architecture.

● 3-D box represents a node, either


software or hardware
● HW node can be signified with
<<stereotype>>
● Connections between nodes are
represented with a line, with optional
<<stereotype>>
● Nodes can reside within a node

10
UML Unified Modeling Language

TCP/IP Client / Server Example Deployment diagram example

—--------------------------------------------------- —---------------------------------------------------

The Example shows the topology Deployment diagram elements


of a fully distributed system.

—---------------------------------------------------

Deployment Diagram Example -


Corporate Distributed System

11
UML Unified Modeling Language

4-Object Diagram
Object Diagram Example I -
Basic Object Diagram Symbols Company Structure
and Notations

: Object Names

● Every object is actually symbolized


like a rectangle, that offers the name
from the object and its class
underlined as well as divided with a
colon.

—--------------------------------------------------- —---------------------------------------------------

Object Diagram Example II - POS


Object Attributes:

● Similar to classes, you are able to list


object attributes inside a separate
compartment. However, unlike
classes, object attributes should
have values assigned for them.

—---------------------------------------------------

Links:

● Links tend to be instances


associated with associations. You
can draw a link while using the lines
utilized in class diagrams.

12
UML Unified Modeling Language

Object Diagram Example III - Writer

—---------------------------------------------------

Object Diagram Example V -


Deriving an Object Structure
Similar to Communication Diagram

5-Package Diagram

13
UML Unified Modeling Language

stereotype to represent the type of


dependency between two packages.

Package Diagram Example -


Import

<<import>> - one package imports the


functionality of other package

—---------------------------------

Packages can be represented by the


notations with some examples shown
below: —---------------------------------

Package Diagram Example - Access


<<access>> - one package requires help
from functions of other package.

—---------------------------------

Package Diagram - Dependency


Notation
There are two sub-types involved in
dependency. They are <<import>> &
<<access>>. Though there are two Modeling Complex Grouping
stereotypes users can use their own

14
UML Unified Modeling Language

Package Diagram Example - Layering Package Diagram Example - Order


Structure Processing System

—---------------------------------

—---------------------------------

Package Diagram Example - Order


Subsystem
—---------------------------------

15
UML Unified Modeling Language

6-Profile Diagram

Basic Concepts of Profile Diagram Tagged Values Tagged Value can be


useful for adding properties to the model for
some useful purposes:
Profile diagram is basically an extensibility
mechanism that allows you to extend and
customize UML by adding new building
● Code generation
blocks, creating new properties and
● Version control
specifying new semantics in order to make
● Configuration management
the language suitable to your specific
● Authorship
problem domain.
● Etc
Profile diagram has three types of
extensibility mechanisms:

● Stereotypes
● Tagged Values
● Constraints

Stereotypes
Constraints
Stereotypes allow you to increase
vocabulary of UML. You can add, create
new model elements, derived from existing
For example: In development of a real time
ones but that have specific properties that
system it is necessary to adorn the model
are suitable to your problem domain.
with some necessary information such as
Stereotypes are used to introduce new
response time. A constraint defines a
building blocks that speak the language of
relationship between model elements that
your domain and look primitive. It allows
must be use {subset} or {xor}. Constraints
you to introduce new graphical symbols.
can be on attributes, derived attributes and
For example: When modeling a network
associations. It can be attached to one or
you might need to have symbols for
more model elements shown as a note as
<<router>>, <<switches>>, <<hub>> etc. A
well.
stereotype allows you to make these things
appear as primitive.

16
UML Unified Modeling Language

Profile Diagram at a Glance Profile Diagram Example I - IT


In the figure below, we define a profile of Management
EJB as a package. The bean itself is
A profile is applied to another package in
extended from component metamodel as
order to make the stereotypes in the profile
an abstract bean. The abstract bean can be
available to that package. The illustration
concreted as either an Entity Bean or
below shows the Network, Telecomms and
Session Bean. An EJB has two types of
Software profiles being applied to the
remote and home interfaces. An EJB also
ITManagement package.
contains a special kind of artifact called
JAR file for storing a collection of Java
code.

Profile Diagram Example


Textual vs Graphic Icon Stereotype
In the figure below, we define a profile of
Stereotypes can be in textual or graphical EJB as a package. The bean itself is
representation. The icon can also replace extended from component metamodel as
the normal class box. For Example: People an abstract bean. The abstract bean can be
often use these 3 stereotyped class concreted as either an Entity Bean or
representations to model the software MVC Session Bean. An EJB has two types of
framework: remote and home interfaces. An EJB also
contains a special kind of artifact called
JAR file for storing a collection of Java
code.

17
UML Unified Modeling Language

7-Composite Structure References to External parts


Diagram
We have seen examples of how Composite
Composite Structure Diagram at a Structure diagrams are great at describing
Glance aggregation, but your models will also need
to contain references to objects outside of
the class you are modeling.
● Composite Structure Diagrams show But what about the referencing an external
the internal parts of a class. object with Composite Structure Diagram
● Parts are named: like the example below?
partName:partType[multiplicity]
● Aggregated classes are parts of a
class but parts are not necessarily
classes, a part is any element that is
used to make up the containing
class.

Example

In this example the Wheels and the Engine


are the Parts of the Collaboration and the
FrontAxle and the RearAxle are the
Connectors. The Car is the Composite
Structure that shows the parts and the
connections between the parts.

Everything looks like it ends up


inside StoreManager,

so we can create a composite structure


diagram to really see what it's made of.

18
UML Unified Modeling Language

Parts Composite Structure Diagram


A part is a diagram element that represents
Example - Computer System
a set of one or more instances that a
containing structured classifier owns. A part Let's develop the composite structure
describes the role of an instance in a diagram for a computer system which
classifier. You can create parts in the include the following a list of the
structure compartment of a classifier, and in components:
several UML diagrams such as composite
structure, class, object, component,
deployment, and package diagrams. ● Power Supply Unit (PSU)
● Hard Disk Drive (HDD)
● Mainboard (MB)
Port ● Optical Drive (DVD-RW)
● Memory Module (MM)
A port defines the interaction point between
a classifier instance and its environment or We will assume for the moment that the
between the behavior of the classifier and mainboard is of the type that has a sound
its internal parts. card and display adapter built in:

Interface
Composite Structure diagram supports the
ball-and-socket notation for the provided
and required interfaces. Interfaces can be
shown or hidden in the diagram as needed.

Connector
A line that represents a relationship in a
model. When you model the internal
structure of a classifier, you can use a
connector to indicate a link between two or
more instances of a part or a port. The
connector defines the relationship between
the objects or instances that are bound to
roles in the same structured classifier and it
identifies the communication between those
roles. The product automatically specifies
the kind of connector to create.

19
UML Unified Modeling Language

Behavioral Diagrams Extend Relationship

8-Use Case Diagram

—-----------------------------------

Generalization Relationship

—-----------------------------------

Association Link —-----------------------------------

Top Level Use Cases

—-----------------------------------

Include Relationship

20
UML Unified Modeling Language

Operational Use Cases ● System function (process –


automated or manual)
● Named by verb + Noun (or Noun
Phrase).
● i.e. Do something
● Each Actor must be linked to a use
case, while some use cases may not
be linked to actors.

Association Link

● The participation of an actor in a use


case is shown by connecting an
actor to a use case by a solid link.
● Actors may be connected to use
cases by associations, indicating that
Actor the actor and the use case
communicate with one another using
messages.
● Someone interacts with the use case

(system function).
● Named by a noun.
● Actor plays a role in the business
● Similar to the concept of a user, but
Boundary of system
a user can play different roles ● The system boundary is potentially
● For example: the entire system as defined in the
● A prof. can be an instructor and also requirements document.
a researcher ● For large and complex systems,
● plays 2 roles with two systems each module may be the system
● Actor triggers use case(s). boundary.
● Actor has a responsibility toward the ● For example, for an ERP system for
system (inputs), and Actor has an organization, each of the modules
expectations from the system such as personnel, payroll,
(outputs). accounting, etc.
● can form a system boundary for use
cases specific to each of these
business functions.
● The entire system can span all of
Use Case these modules depicting the overall
system boundary

21
UML Unified Modeling Language

Extends Generalization
● A generalization relationship is a
● Indicates that an “Invalid Password”
parent-child relationship between use
use case may include (subject to
cases.
specified in the extension) the
● The child use case is an enhancement
behavior specified by base use case of the parent use case.
“Login Account”. ● Generalization is shown as a directed
● Depict with a directed arrow having a arrow with a triangle arrowhead.
dotted line. The tip of arrowhead ● The child use case is connected at the
points to the base use case and the base of the arrow. The tip of the arrow
child use case is connected at the is connected to the parent use case.
base of the arrow. ●
● The stereotype “<<extends>>”
identifies as an extend relationship
Use Case Diagram Examples

Include
● When a use case is depicted as using
the functionality of another use case,
the relationship between the use
cases is named as include or uses
relationship.
● A use case includes the functionality
described in another use case as a
part of its business process flow.
● A uses relationship from base use
case to child use case indicates that Carpark system
an instance of the base use case will
include the behavior as specified in
the child use case.
● An include relationship is depicted with
a directed arrow having a dotted line.
The tip of arrowhead points to the
child use case and the parent use
case connected at the base of the
arrow.
● The stereotype “<<include>>”
identifies the relationship as an include
relationship.

22
UML Unified Modeling Language

9-Activity Diagram Activity Diagram Notation


Summary

Activity diagram is another important


behavioral diagram in UML diagram to Activity
describe dynamic aspects of the system. Is used to represent a set of actions
Activity diagram is essentially an advanced
version of flow chart that modeling the flow
from one activity to another activity.

—----------------------------------------------
—----------------------------------------------

Action
Activity Diagram - Learn by A task to be performed
Examples

A basic activity diagram - flowchart like

—----------------------------------------------

Control Flow
Shows the sequence of execution

—----------------------------------------------

Object Flow
Show the flow of an object from one activity
(or action) to another activity (or action).

—----------------------------------------------

Initial Node
Portrays the beginning of a set of actions or
activities

23
UML Unified Modeling Language

Activity Final Node Join Node


Stop all control flows and object flows in an Bring back together a set of parallel or
activity (or action) concurrent flows of activities (or actions).

—----------------------------------------------

Object Node —----------------------------------------------


Represent an object that is connected to a
set of Object Flows Swimlane and Partition
A way to group activities performed by the
same actor on an activity diagram or to
group activities in a single thread

—----------------------------------------------

Decision Node
Represent a test condition to ensure that
the control flow or object flow only goes
down one path

—----------------------------------------------

Merge Node —----------------------------------------------


Bring back together different decision paths
that were created using a decision-node. The activity diagram example below
visualize the flow in graphical form.

—----------------------------------------------

Fork Node
Split behavior into a set of parallel or
concurrent flows of activities (or actions)

24
UML Unified Modeling Language

—----------------------------------------------

—----------------------------------------------

25
UML Unified Modeling Language

10-State Machine Diagram solid circle. A transition from this


state will show the first real state
● The final state of a state machine
State Notation diagram is shown as concentric
circles. An open loop state machine
represents an object that may
terminate before the system
terminates, while a closed loop state
machine diagram does not have a
final state; if it is the case, then the
object lives until the entire system
terminates.
State
Example:
A state is a constraint or a situation in the
life cycle of an object, in which a constraint
holds, the object executes an activity or
waits for an event.
A state machine diagram is a graph
consisting of:

● States (simple states or composite


states)
● State transitions connecting the
states Example - Entry / Exit Action
(Check Book Status)
Example:
This example illustrates a sta
te machine diagram derived from a Class -
"BookCopy":

Initial and Final States


● The initial state of a state machine
diagram, known as an initial
pseudo-state, is indicated with a

26
UML Unified Modeling Language

Substates History States


A simple state is one which has no Unless otherwise specified, when a
substructure. A state which has substates transition enters a composite state, the
(nested states) is called a composite state. action of the nested state machine starts
Substates may be nested to any level. A over again at the initial state (unless the
nested state machine may have at most transition targets a substate directly).
one initial state and one final state. History states allow the state machine to
Substates are used to simplify complex flat re-enter the last substate that was active
state machines by showing that some prior to leaving the composite state. An
states are only possible within a particular example of history state usage is presented
context (the enclosing state). in the figure below.
Substate Example - Heater

State Machine Diagrams are often used for


deriving testing cases, here is a list of
possible test ideas:

In this example, the state machine first


● Idle state receives Too Hot event entering the Auction requires a fork at the
● Idle state receives Too Cool event start into two separate start threads. Each
● Cooling/Startup state receives substate has an exit state to mark the end
Compressor Running event of the thread. Unless there is an abnormal
● Cooling/Ready state receives Fan exit (Canceled or Rejected), the exit from
Running event the composite state occurs when both
● Cooling/Running state receives OK substates have exited.
event
● Cooling/Running state receives
Failure event
● Failure state receives Failure
Cleared event
● Heating state receives OK event
● Heating state receives Failure event

27
UML Unified Modeling Language

11-Sequence Diagram Note that:

Sequence Diagrams captures: ● An actor does not necessarily


represent a specific physical entity
but merely a particular role of some
● the interaction that takes place in a
entity
collaboration that either realizes a
● A person may play the role of
use case or an operation (instance
several different actors and,
diagrams or generic diagrams)
conversely, a given actor may be
● high-level interactions between user
played by multiple different person.
of the system and the system,
between the system and other
systems, or between subsystems
(sometimes known as system
sequence diagrams)

Below is a sequence diagram for making a


hotel reservation. The object initiating the
sequence of messages is a Reservation
window.

Lifeline

● A lifeline represents an individual


participant in the Interaction.

Actor

● a type of role played by an entity that


interacts with the subject (e.g., by
exchanging signals and data)
● external to the subject (i.e., in the
sense that an instance of an actor is
not a part of the instance of its
corresponding subject).
● represent roles played by human
users, external hardware, or other
subjects.

28
UML Unified Modeling Language

Activations Return Message

● A thin rectangle on a lifeline) ● A message defines a particular


represents the period during which communication between Lifelines of
an element is performing an an Interaction.
operation. ● Return message is a kind of
● The top and the bottom of the of the message that represents the pass of
rectangle are aligned with the information back to the caller of a
initiation and the completion time corresponded former message.
respectively

Self Message

● A message defines a particular


communication between Lifelines of
an Interaction.
● Self message is a kind of message
Call Message that represents the invocation of
message of the same lifeline.
● A message defines a particular
communication between Lifelines of
an Interaction.
● Call message is a kind of message
that represents an invocation of
operation of target lifeline.

Recursive Message

● A message defines a particular


communication between Lifelines of
an Interaction.
● Recursive message is a kind of
message that represents the

29
UML Unified Modeling Language

invocation of message of the same ● Destroy message is a kind of


lifeline. It's target points to an message that represents the request
activation on top of the activation of destroying the lifecycle of target
where the message was invoked lifeline.
from.

Create Message Duration Message

● A message defines a particular


● A message defines a particular
communication between Lifelines of
communication between Lifelines of
an Interaction.
an Interaction.
● Duration message shows the
● Create message is a kind of
distance between two time instants
message that represents the
for a message invocation.
instantiation of (target) lifeline.

Note

A note (comment) gives the ability to attach


various remarks to elements. A comment
Destroy Message carries no semantic force, but may contain
information that is useful to a modeler.
● A message defines a particular
communication between Lifelines of
an Interaction.

30
UML Unified Modeling Language

Message and Focus of Control

● An Event is any point in an


interaction where something occurs.
● Focus of control: also called
execution occurrence, an execution
occurrence
● It shows as tall, thin rectangle on a Operator Fragment Type
lifeline)
● It represents the period during which
an element is performing an alt Alternative multiple fragments:
operation. The top and the bottom of only the one whose condition
the rectangle are aligned with the is true will execute.
initiation and the completion time
opt Optional: the fragment
respectively.
executes only if the supplied
condition is true. Equivalent to
an alt only with one trace.

par Parallel: each fragment is run


in parallel.

loop Loop: the fragment may


execute multiple times, and
the guard indicates the basis
of iteration.

region Critical region: the fragment


can have only one thread
Sequence Fragments executing it at once.
● UML 2.0 introduces sequence (or neg Negative: the fragment shows
interaction) fragments. Sequence an invalid interaction.
fragments make it easier to create
and maintain accurate sequence ref Reference: refers to an
diagrams interaction defined on another
● A sequence fragment is represented diagram. The frame is drawn
as a box, called a combined to cover the lifelines involved
fragment, which encloses a portion in the interaction. You can
of the interactions within a sequence define parameters and a return
diagram value.
● The fragment operator (in the top left
cornet) indicates the type of sd Sequence diagram: used to
fragment surround an entire sequence
● Fragment types: ref, assert, loop, diagram.
break, alt, opt, neg

31
UML Unified Modeling Language

A scenario is one path or flow through a


Note That:
use case that describes a sequence of
events that occurs during one particular
● It is possible to combine frames in execution of a system which is often
order to capture, e.g., loops or represented by a sequence diagram.
branches.
● Combined fragment keywords: alt,
opt, break, par, seq, strict, neg,
critical, ignore, consider, assert and
loop.
● Constraints are usually used to show
timing constraints on messages.
They can apply to the timing of one
message or intervals between
messages.

Combined Fragment Example

Sequence Diagram for Modeling


Use Case Scenarios

User requirements are captured as use


cases that are refined into scenarios. A use
case is a collection of interactions between
external actors and a system. In UML, a
use case is:
"the specification of a sequence of actions,
including variants, that a system (or entity)
can perform, interacting with actors of the
system."

32
UML Unified Modeling Language

12-Communication Diagram Communication Example - Hotel


Reservation
Communication Diagram at a
Glance

In the example of the notation for a


communication diagram, objects (actors in
use cases) are represented by rectangles.
In the example (generic communication
diagram):

● The objects are Object1, Object2,


Object..., ObjectN-1 ..., and ObjectN.
● Messages passed between objects ● Each message in a communication
are represented by labeled arrows diagram has a sequence number.
that start with the sending object ● The top-level message is numbered
(actor) and end with the receiving 1.
object. ● Messages sent during the same call
● The sample messages passed have the same decimal prefix, but
between objects are labeled 1: suffixes of 1, 2, etc. according to
message1, 2: message2, 3: when they occur.
message3, etc., where the numerical
prefix to the message name
indicates its order in the sequence.
● Object1 first sends Object2 the
message message1, Object2 in turn Example - Sequence diagram vs
sends ObjectN-1 the message Communication (Library Item
message2, and so on.
● Messages that objects send to Overdue)
themselves are indicated as loops
(e.g., message message5).

33
UML Unified Modeling Language

If you open this sequence diagram in Visual sequence numbers to determine the order
Paradigm you can automatically generate of messages between objects:
the communication diagram shown in figure
below:

Example - From Sequence Diagram


to Communication Diagram

Note: If you compare the two diagrams,


you'll see they both contain objects and
messages. It also becomes clear that it's
much easier to determine the time ordering
of messages by looking at the sequence
diagram and it's easier to see the
relationships between objects by looking at
the communication diagram.
Note that:
Messages in communication diagrams are
shown as arrows pointing from the Client ● Focus of control: also called
object to the Supplier object. Typically, execution occurrence/activation. It
messages represent a client invoking an shows as tall, thin rectangle on a
operation on a supplier object. They can be lifeline that represents the period
modeled along with the objects in the during which an element is
following manner: performing an operation.
● The top and the bottom of the
● Message icons have one or more rectangle are aligned with the
messages associated with them. initiation and the completion time
● Messages are composed of respectively.
message text prefixed by a ● In communication diagram focus of
sequence number. control is explicit and thus, can be
● This sequence number indicates the represented by the message nest
time-ordering of the message. numbering.

For example, in the communication diagram


in the figure below, you can follow the

34
UML Unified Modeling Language

13-Interaction Overview *extracted from UML 2.0 Reference


Diagram Manual
The example above shows a student
who has been accepted into a
Interaction Overview Diagram at a university. First the student must be
Glance accept or decline admission. After
accepting, the student must both
Interaction Overview Diagram is one of the register for classes and apply for
fourteen types of diagrams of the Unified housing. After both of those are
Modeling Language (UML), which can complete, the student must pay the
picture a control flow with nodes that can
contain interaction diagrams which show
registrar. If payment is not received in
how a set of fragments might be initiated in time the student is excluded by the
various scenarios. Interaction overview registrar.
diagrams focus on the overview of the flow
of control where the nodes are interactions
(sd) or interaction use (ref). Interaction
The other notation elements for interaction
overview diagrams are the same as for
activity and sequence diagrams. These An Interaction diagram of any kind may
include initial, final, decision, merge, fork appear inline as an Activity Invocation
and join nodes.

Interaction Use

Large and complex sequence diagrams


could be simplified with interaction uses. It
is also common to reuse some interaction
between several other interactions.

35
UML Unified Modeling Language

Interaction Diagram Example -


Access Control System

● The Interaction EstablishAccess


occurs first with argument"Illegal
PIN" followed by an interaction with
the message CardOut which is
shown in an inline Interaction.
● Then there is an alternative as we
find a decision node with an Interaction Diagram Example -
InteractionConstraint on one of the Order Reporting
branches.
● Along that control flow we find
another inline Interaction and an
InteractionUse in the sequence.

Interaction Diagram Example - Room


Reservation

Interaction Diagram Example -


Scheduling System

36
UML Unified Modeling Language

14-Timing Diagram Basic Concepts of Timing


Diagrams

State Timeline Representation Major elements of timing UML diagram -


lifeline, timeline, state or condition,
message, duration constraint, timing ruler.
Changes from one state to another are
represented by a change in the level of the
lifeline. For the period of time when the
object is a given state, the timeline runs Lifeline
parallel to that state. A change in state
appears as a vertical change from one level A lifeline in a Timing diagram forms a
to another. The cause of the change, as is rectangular space within the content area of
the case in a state or sequence diagram, is a frame. Lifeline is a named element which
the receipt of a message, an event that represents an individual participant in the
causes a change, a condition within the interaction. It is typically aligned horizontally
system, or even just the passage of time. to read from left to right.

Multiple lifelines may be stacked within the


same frame to model the interaction
between them.

Value lifeline Representation


The figure below shows an alternative
notation of UML Timing diagram. It shows
the state of the object between two
horizontal lines that cross with each other
each time the state changes.

State Timeline in Timing Diagram


A state or condition timeline represents the
set of valid states and time. The states are
stacked on the left margin of the lifeline
from top to bottom.

37
UML Unified Modeling Language

The cause of the change, as is the case in


a state or sequence diagram, is the receipt
of a message, an event that causes a
change, a condition within the system, or
even just the passage of time.

Multiple Compartments
Value Lifeline
It is possible to stack several life lines of A value lifeline shows the change of value
different objects in the same timing of an item over time. The X-axis displays
diagram. One life line above the other. elapsed time in whatever units are chosen,
Messages sent from one object to another the same as for the state lifeline. The value
can be depicted using simple arrows. The is shown between the pair of horizontal
start and the end points of each arrow lines which crosses over at each change in
indicate when each message was sent and value.
when it was received.

Timeline and Constraints


We can use the length of a timeline to
indicate how long the object remains in a
particular state by reading it from left to
right. To associate time measurements, you
show tick marks online the bottom part of
the frame.
The example below shows that the Login
State Lifeline event is received three time units after the
start of the sequence. To show relative
A state lifeline shows the change of state of times, you can mark a specific instance in
an item over time. The X-axis displays time using a variable name. The figure
elapsed time in whatever units are chosen marks the time the sendMail event is
while the Y-axis is labelled with a given list received as time
of states. A state lifeline is shown below:

38
UML Unified Modeling Language

diagram much easier by inspecting the


message passing between the objects
against the states attached in the lifeline.
The Carpark example below shows the
model consistency between two interaction
diagrams.

You can use relative time marks in


constraints to indicate that a message must
be received within a specified amount of
time.

State and Value Lifeline Side-by-Side


State and Value Lifelines can be put one
after the other in any combination.
Messages can be passed from one lifeline
to another. Each state or value transition
can have a defined event, a time constraint
which indicates when an event must occur, The figure above shows a sequence
and a duration constraint which indicates diagarm of the car park example, while the
how long a state or value must be in effect figure below presents the corresponding
for. timing diagram of the car park example.
The various parts of the timing diagram
refer to the content of sequence diagram.

Model Consistency among


Interaction Diagrams
Timing diagram should always be
consistent with the relevant sequence
diagram and state machine. To do this we
can attach states in the lifeline for each of
the objects in the sequence diagram. We
can then derive the corresponding timing

39

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy