UML: Unified Modeling
Language
L. Grewe
History
Graphic modeling language for
describing object-oriented software
Started in 1994
• Combined notations from 3 leading OO
methods
OMT (James Rumbaugh)
OOSE (Ivar Jacobson)
Booch (Grady Booch)
Industry standard
Why UML?
Software larger & complex
• Difficult to analyze
Describe SW clearly
Use Computer-aided software
engineering (CASE) tools
• A picture is worth a thousand
words…..save time looking at and
making visuals.
What is UML?
Specify & Visualize Software via
modeling language
• views
• diagrams
• relationships between classes
UML Concepts
Use case diagrams/studies
Class Diagrams
Instance Snapshots
Sequence Diagrams
….more (for complete understanding
of UML take our SW Engineering
course)
UML Concepts….more
State
State
Diagrams
Class
Diagrams
Use Case Diagrams
Use Case
Diagrams State
Use Case Use Case
Diagrams State
Diagrams
Use Case Diagrams Object
Diagrams
Diagrams
Sequence Diagrams
Diagrams
Diagrams
Scenario State
Scenario
Diagrams State
Diagrams
Collaboration
Diagrams Component
Diagrams
Diagrams Models Diagrams
Scenario Component
Scenario
Diagrams
Component
Diagrams
Deployment
Statechart
Diagrams Diagrams
Diagrams Diagrams
Activity
Diagrams
UML: Use case study
Use Case Studies to understand system
and the stakeholders & requirements.
Uses concept of Actors:
• Often serves some kind of role in the SW
system. (e.g. customer, vendor, etc.)
• Define State & Operations for each Actor
• Define Relationships between Actors
Use Case Diagram
Shows actors, entities and actions
involved in one usage scenario
Have a diagram and often
corresponding description
Can (often) have more than one for
a software program
Example: Use Case Diagram
use case: buy_thing
participants: (Purchaser, Vendor, Thing)
pre-condition:
vendor.possessions -> includes thing
purchaser.pocket >= thing.price
post-condition:
vendor.possessions = vendor.possessions - thing
purchaser.possessions = purchaser.possessions + thing
vendor.till = vendor.till@pre + thing.price
purchaser.pocket = purchaser.pocket@pre - thing.price
UML: Class Diagrams
Classes are Graphically Represented
with areas for
• Class Name, Class Variables, and
Operations
• Properties, Responsibilities, Rules,
Modification History, etc.
Example: Class Diagram
BookTitle class
BookTitle Instance
Another Example: Class Diagrams
Here show class diagrams
and associations between
the classes.
• Associations
(diamonds/arrows) show
aggregations/
compositions
• See class webiste and
reading for more details.
Classes: Company,
Department, Office,
Headquarters, Person,
ContractInformation,
PersonalRecord
Class Diagrams: relationships
Between Classes
Association OR
• Permanent, structural, “has a”
• Solid line (arrowhead optional)
Dependency
• Temporary, “uses a”
• Dotted line with arrowhead
Generalization
• Inheritance, “is a”
• Solid line with open (triangular) arrowhead
Implementation
• Dotted line with open (triangular) arrowhead
Associations w/ Navigation
Information
Can indicate direction of relationship
Represented by solid line with
arrowhead
Gas Pedal class knows about Engine class
Engine class doesn’t know about Gas Pedal class
Cardinality of Associations
Some relationships may be
quantified
Cardinality denotes how many
objects the source object can
legitimately reference
Examples
•* 0, 1, or more
•5 5 exactly
• 5..8 between 5 and 8, inclusive
• 5..* 5 or more
Example: cardinality
Says : Bank to Branch is a 1 to many
association….means a Bank can have many
Branches, but, a Branch is associated with
one Bank.
UML Instance Snapshot
Diagram that shows results of applying a
use-case action.
UML Use Case Sequence Diagram
Scenario shows the
sequence of events
in a use-case.
Here the use-case
is ian applying for
a job, where tony
is the secretary
and sue is the
manager.
Generalization
Denotes inheritance between classes
Can view as “is-a” relationship
Represented by line ending in (open)
triangle
Laptop, Desktop, PDA inherit
state & behavior from Computers