Lecture 2
Lecture 2
Introduction to
to UML
UML
http://www.uml-diagrams.org/uml-25-
diagrams.html
1
Overview
• What is UML?
• A brief history of UML and its origins.
• UML diagrams (Version 2.5)
• UML Modeling tools
• References
2
UML: Unified Modeling Language
• An industry-standard graphical language for
specifying, visualizing, constructing, and
documenting the artifacts of software systems,
as well as for business modeling.
Booch ’91
(OOD) Rumbaugh's
OMT - 1
5
Three Amigos.
6
Structure diagram shows static structure of the system and
its parts on different abstraction and implementation levels and
how those parts are related to each other.
Structure diagrams are not utilizing time related concepts, do not
show the details of dynamic behavior.
STRUCTURE DIAGRAMS
7
Class diagram
• A static structure diagram which describes
structure of a system at the level
of classifiers (classes, interfaces, etc.).
• It shows some classifiers of the system,
subsystem or component, different
relationships between classifiers,
their attributes, operations and constraints.
• Some common types of class diagrams are:
– domain model diagram,
– System model diagram of implementation classes.
8
Diagram
Note:
A basic “usage”
relationship
between two
elements
indicates that a
class requires
the presence of
another class. In
Java, for
example, this
client class must
have an import
statement for the
supplier. The
stereotype
<<uses>>
indicates a usage
dependency.
9
System model Diagram of
Implementation Classes
10
Object Diagram
• object diagram is "a class diagram with objects
and no classes.
• Object diagram overview (next slide) shows
some major elements of object diagram -
named and anonymous instance specifications
for objects, slots with value specifications,
and links (instances of association).
11
Object Diagram
12
Package Diagram
• Package diagram is UML structure
diagram which shows structure of the
designed system at the level
of packages.
• The following elements are typically
drawn in a package diagram:
– package, packageable element,
dependency, element import, package
import, package merge.
13
Package Diagram
14
Model Diagram
• Model diagram is UML auxiliary structure
diagram which shows some abstraction or
specific view of a system, to describe some
architectural, logical or behavioral aspects of
the system.
• The drawing (next slide) shows some major
elements of the model diagram.
15
Model Diagram
16
Composite Structure
Diagrams
Composite Structure Diagram could be used to
show:
• internal structure of a classifier - internal
structure diagram,
• classifier interactions with environment
through ports,
• a behavior of a collaboration - collaboration use
diagram.
The term "structure" for this type of diagrams is
defined in UML as a composition of
interconnected elements, representing run-time
instances collaborating over communications
links to achieve some common objectives.
17
Internal Structure
Diagram
18
Collaboration Use
Diagram
19
Component Diagram
• Component diagram shows components and
dependencies between them.
• This type of diagram is used in Component-
Based Development (CBD) to describe systems
with Service-Oriented Architecture (SOA).
• Components in UML could represent
– logical components (e.g., business components, process
components), and
– physical components (e.g., CORBA components, EJB
components, COM+ and .NET components, WSDL
components, etc.)
• The following nodes and edges are typically drawn
in a component
diagram: component, interface, provided
interface, required interface, class port, connector,
20
artifact, component realization, usage.
Diagrams
21
Example: Java EE 5 Web Services –
JAX-WS 2.0
Deployment
Diagrams
• Deployment diagram is a structure
diagram which shows architecture of the
system as deployment (distribution) of
software artifacts to deployment targets.
• Some common types of deployment diagrams
are:
– Implementation (manifestation) of components by
artifacts
– Specification level deployment diagram,
– Instance level deployment diagram,
– Network architecture of the system.
23
Manifestation (implementation) of
Components by Artifacts
24
Specification Level Deployment
Diagram
web application deployed to Tomcat JSP server and database
schemas - to database system
25
Network architecture
diagrams
26
UML Profile
Diagrams
• Profile diagram is structure diagram which
describes lightweight extension mechanism to
the UML by defining custom stereotypes, tagged
values, and constraints.
• Profiles allow adaptation of the UML metamodel
for different:
– platforms (such as J2EE or .NET), or
– domains (such as real-time or business process
modeling).
• Profile only allows adaptation or customization
of an existing metamodel. Do not modify
existing concepts.
27
UML Profile
Diagrams
• The Device Concept has been adapted to Server
concept by providing three tagged values
28
Java EJB 3.0 UML
Profile
29
Profile Application
• When a profile is applied, instances of the appropriate
stereotypes should be created for those elements that
are instances of metaclasses with required extensions.
• The model is not well formed without these instances.
30
Behavior diagrams show the dynamic behavior of the
objects in a system, which can be described as a series of
changes to the system over time
BEHAVIOR DIAGRAMS
31
Use Case Diagram
• Use case diagrams are in fact twofold:
– they are both behavior diagrams, because they
describe behavior of the system describe a set of actions
(use cases) that some system or systems (subject)
should or can perform in collaboration with one or
more external users of the system (actors), and
– they are also structure diagrams - as a special case of
class diagrams where classifiers are restricted to be
either actors or use cases related to each other
with associations.
• UML 2.5 Specification moved use cases out of
behavior modeling to UML supplementary
concepts.
• Two kinds: Business use case and system use case
32
Business Use Case
Diagrams
33
Business Use Case
Diagrams
34
System Use Case
Diagram
35
Information Flow
Diagrams
• Information flow diagram is UML behavior
diagram which shows exchange of information
between system entities at some high levels of
abstraction.
• Information flows may be useful to describe
circulation of information through a system by
representing aspects of models not yet fully
specified or with less details. Useful for
architectural modeling.
• Information flows do not specify the nature of the
information, mechanisms by which it is conveyed,
sequences of exchange, or any control conditions.
36
Information Flow
Diagrams
37
Scheduled Workflow (SWF)
Example
Show information flow associated with radiology exams and including
patient registration, ordering radiology exam, exam scheduling,
acquisition of images, image storage and viewing activities
38
Activity Diagrams
• Activity diagram is UML behavior diagram which
shows flow of control or object flow with emphasis
on the sequence and conditions of the flow.
• The actions coordinated by activity models can be
initiated because other actions finish executing,
because objects and data become available, or
because some events external to the flow occur.
• The following nodes and edges are typically
drawn on UML activity diagrams:
– activity, partition, action, object, control, activity edge.
39
Business Flow - Process Order
Example
40
Software Design - Resolve Issue
Example
41
Single Sign-On for Google Apps
Example
42
State Machine
Diagrams
• State machine diagram is a behavior
diagram which shows discrete behavior of a
part of designed system through finite state
transitions.
• State machine diagrams can also be used to
express the usage protocol of part of a system.
• Two kinds of state machines defined in UML
2.4 are:
– behavioral state machine, and
– protocol state machine.
• Behavioral state machine is subclassed by
protocol state machine
43
machine diagram Example -
Bank ATM
44
Protocol state machine
• UML protocol state machine diagrams are used to
express a usage protocol or a lifecycle of
some classifier.
• It shows which operations of the classifier may be
called in each state of the classifier, under which
specific conditions, and satisfying some optional
postconditions after the classifier transitions to a
target state.
• Because these diagrams show lifecycle, they are
useful to explain how objects could change their
states over the time.
45
Online shopping user account protocol state machine
diagram.
46
Interaction diagrams
• Interaction diagrams include several
different types of diagrams:
– sequence diagrams,
– interaction overview diagrams,
– communication diagrams, (known
as collaboration diagrams in UML 1.x)
– timing diagrams.
47
Sequence Diagrams
• Sequence diagram is the most common kind
of interaction diagram, which focuses on
the message interchange between a number
of lifelines.
• Sequence diagram describes an interaction by
focusing on the sequence of messages that
are exchanged, along with their corresponding
occurrence specifications on the lifelines.
• The following nodes and edges are typically
drawn in a UML sequence diagram:
– lifeline, execution specification, message, combined
fragment, interaction use, state invariant
continuation destruction occurrence.
48
Sequence Diagrams
49
Interaction overview
diagrams
50
Interaction overview
diagrams
51
Communication Diagrams
52
Communication Diagrams
53
Communication Diagram
Example
Timing Diagrams
55
Timing Diagrams
• Timing Diagram Example - Stages of
Alzheimer’s Disease
56
Timing Diagrams
• Timing Diagram Example - User Experience Website Latency
57
Each UML diagram has a contents area.
As an option, some diagrams may also have
a frame (shown as rectangle) with frame heading.
58
Example: Class diagram of a
package org.hibernate.jdbc
frame
59
Example : activity owned
by use case
• Activity (diagram) enclosed in Search
Items use case frame
60
UML Modeling Tools
• Rational Rose (www.rational.com) by IBM
• UML Studio 7.1 ( http://www.pragsoft.com/) by
Pragsoft Corporation
Capable of handling very large models (tens of
thousands of classes). Educational License US$ 125.00;
Freeware version.
• Microsoft Visio
• Dia: open source, much like visio.
(http://www.gnome.org/projects/dia/)
• ArgoUML (Open Source; written in java )
(http://www.apple.com/downloads/macosx/development
_tools/argouml.html )
• Others
(http://www.objectsbydesign.com/tools/umltools_byCom
pany.html )
61
Reference
1. UML Distilled: A Brief Guide to the Standard Object Modeling Language
Martin Fowler, Kendall Scott
4. Software Engineering Principles and Practice. Second Edition; Hans van Vliet.
6. The Unified Modeling Language User Guide SECOND EDITION By Grady Booch,
James Rumbaugh, Ivar Jacobson
6.
62