Professional Documents
Culture Documents
UML
Outline
2
Introduction
A Conceptual Model of the UML
An overview of UML Diagrams
Use case diagram
Class diagram
Sequence diagram
Activity diagram
Deployment diagram
UML
Introduction
3
UML
A Conceptual Model of the UML
6
UML
THINGS
8
UML
Cont…
9
UML
Cont…
10
Structural things
Structural things are the nouns of the UML models. These are the
mostly static parts of a model, representing elements that are
either conceptual or physical.
In all, there are seven kinds of structural things: Class, Interface,
Collaboration, Use Case, Active Classes, Components, and Nodes.
What is a Class?
A class is a description of objects that share the same attributes,
operations, relationships, and semantics. A class is represented
using a rectangle with compartments showing its name,
attributes, and operations.
A class is an abstraction in that it emphasizes relevant
characteristics and suppresses other characteristics.
UML
Cont…
11
UML
Cont…
12
What is an Interface?
An interface is a collection of operations that specify a service of a
class or component.
It defines a set of operation specifications (that is their signatures)
but never a set of operation implementations.
Graphically an interface is rendered as a circle together with its
name. When an interface is shown as a circle, its operations are
suppressed.
However, an interface can also be rendered as a stereotyped class
listing its operations in the appropriate compartment.
UML
Cont…
13
What is a Collaboration?
A collaboration defines an interaction and is a society of
roles and other elements that work together to provide some
cooperative behavior that is bigger than the sum of all the
elements.
Thus, collaborations have structural, as well as behavioral
dimensions.
What is a Use Case?
A use case is a description of a set of sequence of actions that a
UML
Cont…
15
An active class is just like a class except that its objects
represent elements whose behavior is concurrent with
other elements. Graphically, an active class is rendered
just like a class, but with heavy lines.
What is a Component?
A component is a physical and replaceable part of a system that
conforms to and provides the realization of a set of interfaces.
In a system, you will encounter different kinds of deployment
components, such as Java Beans, as well as components that
are artifacts of the development process, such as source code
files.
UML
Cont…
16
What is a Node?
A node is a physical element that exists at run time and
represents a computational resource, generally having at
least some memory and, often, processing capability.
A set of components may reside on a node and may also
migrate from node to node.
Graphically, a node is rendered as a cube, usually,
including only its name.
Server
UML
Cont…
17
Behavioral things
Behavioral things are the dynamic parts of UML models.
These are the verbs of a model, representing behavior over
time and space. In all, there are two primary kinds of
behavioral things: Interaction and State Machine.
What is an Interaction?
An interaction is a behavior that comprises a set of
messages exchanged among a set of objects within a
particular context to accomplish a specific purpose.
Graphically, a message is rendered as a directed line,
almost always including the name of its operation.
display
UML
Cont…
18
UML
Cont…
20
Annotation things
Annotation things are the explanatory parts of UML models.
Dependency relationship
What is an Association Relationship: An association is a structural
relationship that specifies that objects (instances of classes) are
connected to other objects.
Graphically, an association is rendered as a solid line, possibly
directed, occasionally including a label, and often containing other
adornments, such as multiplicity and role names.
UML
Cont…
23
Association relationship
Multiplicity is the number of instances of one class that
relate to one instance of another class.
For each association, there are two multiplicity
decisions to make, one for each end of the association.
For example, a Course Offering object may have either
zero or one Professor object related to it, and conversely
a Professor object may have zero or more Course
Offering objects related to it.
UML
Cont…
24
UML
Cont…
25
UML
Cont…
26
Generalization relationship
UML
Cont…
29
Example of relationships:
UML
Diagrams in UML
31
UML
Cont…
32
Semantics of Diagrams
Use case diagram
Represent the functions of a system from the
user’s point of view
Sequence diagrams:
Represent the system’s behaviour in terms of
interactions among a set of objects.
Collaboration diagrams
A spatial representation of objects, links and
interactions
Emphasizes the structural organization of the
objects.
UML
Cont…
33
Object Diagram
Represent objects and their relationships and
correspond to simplified collaboration diagrams that
does not represent message broadcasts
Class diagrams:
are used to represent the structure of a system in terms of
objects, their attributes, and relationships.
State chart diagrams:
Represent the behavior of a class in terms of states
Shows a state machine, consisting of states, transitions,
events, and activities.
UML
Cont…
34
Activity diagrams:
are flow diagrams used to represent the data flow or the
control flow through a system.
Component diagrams:
Represent the logical components of an application.
Shows the organization and dependencies among a set of
components
Deployment diagrams:
Represent the deployment of components on particular
pieces of hardware.
Shows the configuration of run-time processing nodes
and the components that live on them.
UML
Cont…
35
UML
Cont…
37
UML
Cont…
38
UML
Use case Diagram
39
A UML use case diagram shows the relationships
among actors and use cases within a system.
Components of use case diagrams
Use case
Actor
System Boundary
Relationship
Actor Relationship
UML
Cont…
40
Use cases:
Dialogue between an actor and a system.
Each use case is a sequence of related transactions
performed by an actor and a system in dialogue.
Describes a sequence of action that provide a
measureable value to an actor.
A use case is drawn as a horizontal ellipse on a
UML use case diagram.
Represents a major piece of functionality that is
complete from beginning to end.
UML
Use case diagram (cont…)
41
What are the functions that the actor want from the
system?
Does the system store information? Who will
create, read, update or delete that information.
Does the system need to notify an actor about
UML
changes in its internal states?
Cont…
43
UML
Use case diagram (cont…)
44
UML
Use case diagram (cont…)
48
An Actor :
A person, organization, local process, external
system that plays a role in one or more interactions
with a system
Someone or something that must interact with the
system
UML notation for actor is stickman
UML
Use case diagram (cont…)
49
UML
Use case diagram (cont…)
50
How do we find an actor?
Ask the following questions
Who uses the system?
Who installs the system?
Who Starts up the system?
What other systems use this system?
Who gets the information from the system?
Who provides information to the system?
Note: Actor is always external to the system. They are
never part of the system to be developed.
UML
Use case diagram (cont…)
51
4-Categories of an actor:
Principle
Who uses the main system functions.
Secondary
Who takes care of administration and maintenance.
External hardware
devices which are part of application domain
Other system:
The other system with which the system must
interact.
UML
Cont…
52
UML
Use case diagram (cont…)
53
Actor Guidelines
Place your primary actor(s) in the top-left corner of the
diagram
In western cultures, you start reading in the top-left
corner
Directly involved with your primary/critical use cases
UML
Use case diagram (cont…)
55
Don’t Allow Actors to Interact with One Another
The nature of the interaction between two actors will
UML
Use case diagram (cont…)
56
UML
Use case diagram (cont…)
57
Relationship
There are several types of relationships that may appear on
a use case diagram
An association between an actor and a use case
significant value.
UML
Use case diagram (cont…)
59
UML
Use case diagram (cont…)
60
An <<extend>> association is a generalization relationship
where the extending use case continues the behavior of the
base use case by conceptually inserting additional action
sequences into the base use case
Apply <<extend>> Associations carefully
Many use case modelers avoid the use of <<extend>>
UML
Use case diagram (cont…)
61
Place an Included Use Case to the Right of the Invoking
Use Case
It is common convention to draw <<include>>
relationships horizontally, with the included use case to
the right of the invoking use case,
Place an Extending Use Case Below the Parent Use Case
It is common convention to draw <<extend>>
relationships vertically, with the extending use case
placed lower on your diagram than the base use case
UML
Use case diagram (cont…)
62
Apply the “Is Like” Rule to Use Case Generalization
The sentence “the [inheriting use case name] is like the [parent use
case name]” should make sense
Place an Inheriting Use Case Below the Base Use Case
It is a common convention to draw generalization relationships
vertically, with the inheriting use case placed lower on your diagram
than the parent use case
Apply the “Is Like” Rule to Actor Inheritance
“the[inheriting actor name] is like the [parent actor name]”
Example:
UML
Use case diagram (cont…)
64
System Boundary Box Guidelines:
The rectangle around the use cases is called the
system boundary box.
As the name suggests, it indicates the scope of your
system.
The use cases inside the rectangle represent the
functionality that you intend to implement.
Indicate Release Scope with a System Boundary Box
Avoid Meaningless System Boundary Boxes
UML
Cont…
65
UML
Use case diagram (cont…)
66
Documenting Use Cases
Generic format for documenting the use case:
Pre condition: If any
UML
Use case diagram (cont…)
68
9. (SR)The ATM asks for the amount of cash; user enters Birr 200
10. (SR)The ATM verifies that the amount of cash is within predefined
policy limits and asks the bank, to process the transaction which
eventually confirms success and returns the new account balance.
11. (SR) The ATM dispenses cash and asks the user to take it.
12. (AA) The user takes the cash.
13. (SR) The ATM asks whether the user wants to continue.
14. (AA) The user indicates no.
15. (SR) The ATM prints a receipt, ejects the card and asks the user to
take them
16. (AA) The user takes the receipt and the card.
17. (SR) The ATM asks a user to insert a card.
UML
Use case diagram (cont…)
70
UML
Cont…
71
UML
Class diagram
72
UML
Cont…
73
UML
Cont…
75
UML
Cont…
76
UML
Cont…
77
Center the Dashed Line of an Association Class
The association path should be clearly connected to the path and
UML
Cont…
79
UML
Cont…
80
UML
Cont…
82
Always Indicate the Multiplicity
For each class involved in a relationship, there will always be
a multiplicity for it
UML
Cont…
83
UML
Cont…
84
UML
Sequence Diagram
85
Sequence diagrams describe behaviour as a
sequence of messages exchanged among a set of
objects.
It describe patterns of communication among a set
of interacting objects.
An object interacts with another object by sending
messages.
The reception of a message by an object triggers the
execution of an operation.
UML
Cont…
86
Typically, we use a sequence diagram to:
Describe the event flow of a use case.
Identify the objects that participate in the use case
Assign pieces of the use case behaviour to the objects
in the form of services.
This process often leads to refinements in the use case
(e.g., correcting ambiguous descriptions, adding
missing behaviour) and consequently, the discovery of
more objects and more services.
UML
Cont…
87
UML
Cont…
88
Components of sequence diagram: Name:Class
Objects
Object lifeline
Message
pre/post conditions.
UML
Cont…
89
Request amount
Transaction :Transaction
Enter the amount
Update transaction
Transaction commit
Transaction
Dispense cash complete
Request take cash
Take cash
Request continuation
Terminate
Print receipt ,eject card
Request take card
Take card
Display main screen and prompt for the card.
UML
Cont…
91
UML
Cont…
92
UML
Cont…
93
with yours.
For many business applications, these actors are treated as
“back-end entities,”
System interacts with through access techniques such as C
UML
Cont…
96
Apply Textual Stereotypes to Classifiers
Consistently
Don’t invest a lot of time agonizing over which
UML
Cont…
97
UML
Cont…
98
UML Collaboration Diagram
Like UML sequence diagrams, it used to explore the
messages.
UML
Cont…
99
Components of collaboration diagram
Named objects
exchange of messages
Messages has following attributes
Semantics of components:
Object names identify which objects are participating
messages.
The direction of the message defines the sender and
CUST- TRANSA-
ATM CTION
OMER
2. request password,
6. request kind,
9. request amount,
13. Transaction succeed
14. dispense cash, request take cash
5. account ok.
16. request continuation,
18. print receipt, request take card
4. Verify account,
19. Display main screen
11. process transaction
BANK
Collaboration Diagram
UML
Activity diagrams
102
It is the UML for modeling the dynamic aspects of
systems.
An activity diagrams is essentially a flowchart, showing
flow of control from activity to activity.
Activities are states that represent the execution of a set of
operations.
The completion of these operations triggers a transition to
another activity.
It can be described as an operation of the system.
So the control flow is drawn from one operation to another.
This flow can be sequential, branched or concurrent.
UML
Cont…
103
Activity is a particular operation of the system.
Activity diagrams are not only used for visualizing
dynamic nature of a system, but also used to construct the executable
system by using forward and reverse engineering techniques.
The only missing thing in activity diagram is the
message part.
Before drawing an activity diagram we should identify the
following elements:
Activities
Association
Conditions
Constraints
UML
Cont…
104
Example of an activity diagram for order management system.
In the diagram four activities are identified which are associated
with conditions.
One important point should be clearly understood that an activity
diagram cannot be exactly matched with the code.
The activity diagram is made to understand the flow of activities
and mainly used by the business users.
Some of the main activities are:
Send order by the customer
Receipt of the order
Confirm order
Dispatch order
UML
Cont…
105
UML
Cont…
106
UML
Cont…
107
Example:
UML
Component Diagram
108
UML
Cont…
110
UML
Cont…
111
UML deployment diagrams
UML deployment diagram is used to describe the
relationship among run-time components and hardware
nodes.
It show the configuration of run-time processing elements
and the software components, processes, and objects that
execute on them.
It provides the necessary environment for the components to
execute in.
A UML deployment diagram representing the allocation of
components to different nodes and the dependencies among
components
UML
Cont…
112
UML
Cont…
113
Deployment diagrams are useful for system engineers.
An efficient deployment diagram is very important because
it controls the following parameters:
Performance
Scalability
Maintainability
Portability
So before drawing a deployment diagram the following
artifacts should be identified:
Nodes
Relationships among nodes
UML
Cont…
114
UML
Cont…
115
UML
116
END
UML
Cont…
117
UML