Chapter-2 UML and UML Diagrams
Chapter-2 UML and UML Diagrams
By Akfete.A
[Youtube: Moi_TeachTech]
1
1/24/2024
What is UML?
• The Unified Modeling Language (UML) is a s
tandard language for specifying, visualizing, constructing,
and documenting the artifacts of software systems, business
modeling and other non-software systems.
• The UML represents a collection of best engineering
practices that have proven successful in the modeling of
large and complex systems.
• The UML is a very important part of developing object
oriented software and the software development process.
• The UML uses mostly graphical notations to express the
design of software projects.
• Using the UML helps project teams communicate, explore
potential designs, and validate the architectural design of the
software.
1/24/2024 2
U~ Unified:
• Unifies all existing previous
Notations
M~ Modeling:
• Used for Modeling Software
Artifacts
L~
1/24/2024
Language:
• Means of Communication
3
UML is a language for:
Visualizing: Graphical models with precise semantics
Specifying: Models are precise, unambiguous and co
mplete to capture all important Analysis, Design, and I
mplementation decisions.
Constructing: Models can be directly connected to
programming languages, allowing forward and revers
e engineering
Documenting: Diagrams capture all pieces of inform
ation collected by development team, allowing to shar
e and communicate the embedded knowledge.
1/24/2024 4
UML History
• OO languages appear mid 70’s to late 80’s
• Between ’89 and ’94, OO methods increased from 10 to 50.
• Unification of ideas began in mid 90’s.
– Rumbaugh joins Booch at Rational ’94
– v0.8 draft Unified Method ’95
– Jacobson joins Rational ’95
– UML v0.9 in June ’96
– UML 1.0 offered to OMG in January ’97
– UML 1.1 offered to OMG in July ’97
– Maintenance through OMG RTF
– UML 1.2 in June ’98
– UML 1.3 in fall ’99
– UML 1.5
– UML 2.0 underway
Fulfill Order
Item
Business Process
via
Ships the Item
Documenting
Architecture, Requirements, Tests, Activities (Project planning, Release
management)
7
1/24/2024
Three (3) basic building blocks of UML (cf. Harry)
Water
Rivers
Oceans
have
1/24/2024
3 basic building blocks of UML - Things
UML 1.x
Structural — nouns/static of UML models (irrespective of time).
Main
Behavioral — verbs/dynamic parts of UML models.
1/24/2024 9
Structural Things in UML- 7 Kinds (Classifiers)
Nouns.
Conceptual or physical elements.
setGrade()
getGrade()
2. Interface
A collection of operations that specify a service (for a
resource or an action) of a class or component. It describes
the externally visible behavior of that element.
<<interface>>
IWindow name IWindow
operations
open()
close()
1/24/2024 11
Structural Things in UML
3. Collaboration
Chain of
Define an interaction among a web of objects. Responsibility
Define a society of roles and other elements.
Provide cooperative behavior.
Capture structural and behavioral dimensions. Order
Order validation
management <<refine>>
4. Use Case
A sequence of actions that produce an observable result for a
specific actor.
Provides a structure for behavioral things.
Place Order
Realized through a collaboration (usually realized by a set of
actors and the system to be built).
1/24/2024 12
Structural Things in UML
5. Active Class Event Manager
name
Special class whose objects own one or more
attributes Thread
processes or threads. time Heavy border
Can initiate control activity. operations
suspend()
flush()
6. Component
Replaceable part of a system.
Components can be packaged logically. Orderform.java
Conforms to a set of interfaces.
Provides the realization of an interface.
7. Node
Element that exists at run time.
Represents a computational resource. WebServer
Generally has memory and processing power.
Variations on Structural Things: Actors, Signals, Utilities, Processes & Threads, Applications, Documents, etc.
1/24/2024 13
Behavioral Things in UML
Verbs.
Dynamic parts of UML models: “behavior over time”
Usually connected to structural things.
State Machine
specifies the sequence of states an object or an interaction goes through during its
lifetime in response to events.
received-an-A/
inStudy buy-beer inParty
1/24/2024
sober/turn-on-PC 14
3 basic building blocks of UML - Relationships
4 Kinds
Dependency
Association
Generalization
Realization
1/24/2024 15
Relationships in UML
1. Dependency
a semantic relationship between two things in which a change to one thing (independent) may affect the
semantics of the other thing (dependent).
2. Associations
a structural relationship that describes a set of links, a link being a connection between objects.
employer employee
0..1 *
Can be directed labels Can have multiplicity & role names
Aggregation
a special kind of association. It represents a structural
relationship between the whole and its parts.
Represented by a diamond.
1/24/2024 16
Relationships in UML
3. Generalization
a specialization/generalization relationship in which objects of the specialized element (the child) are more
specific than the objects of the generalized element.
4. Realization
a semantic relationship between two elements, wherein one element guarantees to carry out what is expected by
the other element.
Where?
Between interfaces and classes that realize them…
Between use cases and the collaborations that realize them...
1/24/2024 17
3 basic building blocks of UML - Relationships
Student University
attends
1. Associations
Structural relationship that describes a set of links, a link being a connection between
objects. variants: aggregation & composition
Student Person
2. Generalization
a specialized element (the child) is more specific the generalized element.
Student
3. Realization IGrade
one element guarantees to carry out what is expected by the other element.
(e.g, interfaces and classes/components; use cases and collaborations)
• Communication(collaberati
on)
• Sequence
• Interaction overview
• Timing
1/24/2024 19
Class diagram
1/24/2024 20
Class diagram
1/24/2024 21
Class diagram
1/24/2024 22
Component diagram
1/24/2024 23
Component diagram
24
1/24/2024
Deployment diagram
1/24/2024 26
Object diagram
1/24/2024 27
Object diagram
1/24/2024 28
Package diagram
• UML 2 Package diagrams simplify
complex class diagrams, it can group
classes into packages. A package is a
collection of logically related UML
elements. Packages are depicted as file
folders and can be used on any of the
UML diagrams.
1/24/2024 29
Package diagram
1/24/2024 30
Composite structure diagram
1/24/2024 31
Composite structure diagram
• E.g
1/24/2024 32
Activity diagram
1/24/2024 33
Activity diagram
1/24/2024 34
Activity diagram
1/24/2024 35
State machine diagram
• UML 2 State machine diagrams can show
the different states of an entity also how
an entity responds to various events by
changing from one state to another. The
history of an entity can best be modeled
by a finite state diagram.
1/24/2024 36
State machine diagram
1/24/2024 37
State machine diagram
1/24/2024 38
Use cases diagram
UML 2 Use cases diagrams describes the behavior of the
target system from an external point of view. Use
cases describe "the meat" of the actual requirements.
• Use cases. A use case describes a sequence of actions
that provide something of measurable value to an
actor and is drawn as a horizontal ellipse.
• Actors. An actor is a person, organization, or external
system that plays a role in one or more interactions
with your system. Actors are drawn as stick figures.
• Associations. Associations between actors and use
cases are indicated by solid lines. An association exists
whenever an actor is involved with an interaction
described by a use case.
1/24/2024 39
Use cases diagram
• HMS
1/24/2024 40
Use cases diagram
• E.g
1/24/2024 41
Use cases diagram
1/24/2024 42
Use-Case Diagram Example
register as student
lab
make/edit course
System Boundary
lecturer
43
1/24/2024
Communication diagram
• UML 2 Communication diagrams used to
model the dynamic behavior of the use
case. When compare to Sequence
Diagram, the Communication Diagram is
more focused on showing the
collaboration of objects rather than the
time sequence.
1/24/2024 44
Communication diagram
1/24/2024 45
Sequence diagram
• UML 2 Sequence diagrams models the
collaboration of objects based on a time
sequence. It shows how the objects
interact with others in a particular
scenario of a use case.
1/24/2024 46
Sequence diagram
1/24/2024 47
References
• http://www.agilemodeling.com/
• http://www.visual-
paradigm.com/VPGallery/diagrams/index.html
• http://bdn.borland.com/article/0,1410,31863,00.
html
• http://en.wikipedia.org/wiki/Unified_Modeling_L
anguage
• http://pigseye.kennesaw.edu/~dbraun/csis4650/
A&D/UML_tutorial/index.htm
1/24/2024 48
Thank you
Q&A?