2 Intro UML
2 Intro UML
Visualization is the
key …
9/14/2023 2
The Human
Body
• The Digestive System and
Excretory System
• The Respiratory and
Circulatory System
• The Muscular System
• The Skeleton System
• The Nervous System
• The Reproductive System
9/14/2023 3
The Digestive and Excretory System
9/14/2023 4
The
Respiratory
System
9/14/2023 5
The
Circulatory
System
9/14/2023 6
The Muscular System
9/14/2023 7
The
Nervous
System
9/14/2023 8
The
Skeleton
System
9/14/2023 9
The
Human
Body
Parts
9/14/2023 10
Unified Modeling Language (UML)
• A visual modeling language
• used to specify, visualize, construct and document the
artifacts of an object-oriented software-intensive
system under development
• A set of 9 diagrams (UML 1.4) and 14 diagrams (UML
2.2) each help in visualizing the system from a
different perspective
• ISO/IEC 19505-1:2012 defines the Unified Modeling
Language (UML) (version 2)
• Not an industry standard but useful in s/w
development
9/14/2023 11
• Is NOT a S/W development
methodology
– Descriptive not prescriptive
• Combines best practices from
– Data modeling (ex: ER diagram)
– Business modeling (ex:
Workflows)
UML – Object modeling, and
– Component modeling
• Combines
– Booch method (G Booch)
– OMT (J Rumbaugh)
– OOSE (E Jacobson)
• An extensible language
– Stereotypes, profiles
• Architect
• Domain expert
UML • Designer
Users • Programmer/Developer
• Instructor
UML: History
Source: Wikipedia
Important UML Diagrams
We Discuss …
• Use Case Diagram
• Sequence Diagram
• Statechart
• Activity Diagram
• Class Diagram
• Package Diagram
• Component/Deployment Diagram
• Define system functional requirements
in terms of Actors and Use cases
– Each use case specify a piece of
functionality
– A use case can be elaborated in
Use Cases terms of sequence of interactions
between Actor and the domain
objects
– Simple use cases may involve only
one interaction
– More complicated use cases may
involve several interactions
UML Notation for Use Case Diagram
Use Case
<<extend>> <<extend>>
<<include>> <<include>>
Passenger
PurchaseMultiCard
PurchaseSingleTicket
<<includes>>
<<includes>>
CollectMoney
<<extends>> <<extends>>
NoChange Cancel
Use Case Diagram – Complaint Management System
9/14/2023 20
Objects and Classes
• Objects represent “things” in real world
– Provide understanding of real world
– Form basis for a software solution
• An Object is a single “thing”
– E.g., John’s car
– Mary’s account
• A Class (object class) is a “Blue print” of objects
with the same (similar) characteristics
– E.g., account, employee, car, customer
• Each Object has an identity and a Behavior, and
is distinguishable from others in the class
UML Notation for Class Diagram
Class Name ClassA
class Attributes 1
Association
class Operations *
ClassB
9/14/2023 25
UML Notation for Sequence Diagram
:Actor
objectB1:
objectA anObject :ClassC
ClassB
1: Input
Message
2: Internal
Message
3*: Iteration
Message
4[Condition]:
Conditional
Message
Example Sequence Diagram for Issue a ticket
insertChange() updateBalance()
amountDue
insertChange()
updateBalance()
acknowledgement «create»
:Ticket
printedTicket
• Statechart
– Graphical representation of
finite state machine
– States are rounded boxes
– Transitions are arcs
• Statechart relates events and states
Statechart • Event
– Causes change of state
– Referred to as state transition
• State represents interval between
successive events
• Initial state
– Arc with black ball at end
UML Notation for Statechart Diagram
Initial State
Event
Superstate A
Event / Action
Final State
Statechart Example: Account
Account Opened
Regular
Over
Withdrawal
Withdrawal
Account in Account
Good Standing Overdrawn
Overdraft Paid Off
Deposit
Account closed
Statechart Example: A simple vending machine
Statechart Example: A simple vending machine
Specs (Informal)
• It delivers a chosen drink on receiving two coins
(two quarter – one quarter means 25 cents)
• It can also allow to cancel the order and return
inserted quarters before drink is not delivered,
• After delivering the drink or returning the inserted
quarters, the machine goes to the initial state
• For simplicity, assume the machine has abundant
supply of the drinks
Statechart Example: A simple vending machine
Statechart Example: A simple vending machine
Statechart Example: A simple vending machine
Statechart Example: A simple vending machine
Statechart Example: A simple vending machine
A Washing Machine
Even more involved example …
Example
Suppose N is the current simple
state and transition T1 has been
selected to be taken (followed by
T2) – What will be event/action
sequence…?
1. N state exit action
2. M state exit action
3. T1 transition action
4. Branch action
In case the selected transition is T2
5. T2 transition action
6. I1 initial state pointer action (exit
and entry actions of the state L
What will be transition/ are not executed since that state
condition/action sequence…? is not exited)
7. M state entry action
8. I2 initial state pointer action
9. N state entry action
10. …
9/14/2023 40
• Models a process workflow
• Different from Statechart
– A Statechart models states
of an object/system
Activity • Models concurrency and
synchronization
Diagram • Models normal and alternate
flow of control in the same
diagram
• Can be combined with a
statechart
Activity
Diagram
An Example
• Withdrawing money
from the ATM
Swimlanes in
Activity
Diagram
Activity Diagram:
Toaster
• Structured organization of
Code
• Grouping of related classes
to help the software
engineer to identify and to
Package understand dependencies
• When to use?
Diagram – Code Organization
– Program Comprehension
– Change Management
Package Diagram: An Example
Package diagram for
“Online Banking System
• Depicts how components
are wired together to form
bigger component or system
• Component interacts with
each other though
Component interfaces
Diagram • Connect the required
interface of one component
with the provided interface
of another component.
• Designed with an eye
towards deployment
Component Diagram
Component Diagram
Deployment Diagram
Other Uses of UML …
UML: Modeling Concepts (1)
Ex: Project Project
*
Activity
is produced by * consumes
WorkProduct * Task * Resources
System Participant
Model Time
Document Equipment
Client Developer
Review proposed
change
[change approved]
Update Archive
requirements request
Design Update
test design
Update code
UML:
example of
(if applicable)
Execute all
relevant tests
Process
Review actual
modeling
change
Why UML?
• Dealing with Complexity and Change
• A medium of Communication and
Information sharing needed
– To allow developers to communicate with high
levels of precision
– A lot of decisions have to be made and
communicated
– Software development – A long drawn process
9/14/2023 56
UML Criticisms
• Formal UML models are Large and Complex
• Requires effortful training…
• Some instances of Inconsistent use
• Economics of software development
• Maintenance and synchronization issues
• Claims of being semantically inadequate
– OCL to help
• Lack of Standardization? Not really….
– UML version 1.4.2 document is an ISO/IEC 19501
– UML version 2.5.1 document is now ISO/IEC 19505-1:2012
UML References
• M Fowler, UML Distilled, third edition, Addison Wesley
• Grady Booch, James Rumbaugh, Ivar Jacobson, “The Unified
Modeling Language User Guide”, Addison Wesley, 1999.
• Bernd Bruegge, Allen Dutoit: “Object-Oriented Software
Engineering: Using UML, Patterns, and Java”, Prentice Hall,
2003.
• http://www.uml.org/
• http://www-01.ibm.com/software/rational/uml/
• http://www.agilemodeling.com/essays/umlDiagrams.htm