Introduction to UML
1
Modeling
Describing a system at a high level of
abstraction
A model of the system
Used for requirements and specifications
Is it necessary to model software
systems?
Object Oriented Modeling
What is UML?
UML stands for “Unified Modeling Language”
It is a industry-standard graphical language for
specifying, visualizing, constructing, and
documenting the artifacts of software systems
The UML uses mostly graphical notations to
express the OO analysis and design of software
projects.
Simplifies the complex process of software design
Why UML for Modeling
Use graphical notation to communicate more
clearly than natural language (imprecise) and
code(too detailed).
Help acquire an overall view of a system.
UML is not dependent on any one language or
technology.
UML moves us from fragmentation to
standardization.
UML History
OO languages appear mid 70’s to late 80’s (cf. Budd: communication and complexity)
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 pre-UML
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.x
UML 1.2 in June ’98
UML 1.3 in fall ’99
UML 1.5 http://www.omg.org/technology/documents/formal/uml.htm
UML 2.0 underway http://www.uml.org/
UML 2.0
IBM-Rational now has Three Amigos
Grady Booch - Fusion
James Rumbaugh – Object Modeling Technique (OMT)
Ivar Jacobson – Object-oriented Software Engineering: A Use Case Approach (Objectory)
( And David Harel - StateChart)
Rational Rose http://www-306.ibm.com/software/rational/
6
History of UML
Unified Modeling Language (UML)
An effort by IBM (Rational) – OMG to standardize OOA&D notation
Combine the best of the best from
Data Modeling (Entity Relationship Diagrams);
Business Modeling (work flow); Object Modeling
Component Modeling (development and reuse - middleware, COTS/GOTS/OSS/…:)
Offers vocabulary and rules for communication
Not a process but a language
de facto industry standard
8
UML is for Visual Modeling
A picture is worth a thousand words!
- standard graphical notations: Semi-formal
- for modeling enterprise info. systems, distributed Web-based applications, real time embedded systems,
…
Sales Places Order
Representative Customer
Fulfill Order
Item
Business Process
via
Ships the Item
- Specifying & Documenting: models that are precise, unambiguous, complete
UML symbols are based on well-defined syntax and semantics.
analysis, architecture/design, implementation, testing decisions.
- Construction: mapping between a UML model and OOPL.
9
Three (3) basic building blocks of UML (cf. Harry)
Water
have Fresh water
Rivers
Oceans
have
have Salt water
live in
have
Fish have
Crocodiles
Penguins
Things - important modeling concepts
Just glance thru
for now
Relationships - tying individual things
Diagrams - grouping interrelated collections of things
and relationships 10
Types of UML Diagrams
Use Case Diagram
Class Diagram
Sequence Diagram
Collaboration Diagram
State Diagram
This is only a subset of diagrams … but are most
widely used
3 basic building blocks of UML - Things
UML 1.x
Structural — nouns/static of UML models (irrespective of time).
Behavioral — verbs/dynamic parts of UML models. Main
Grouping — organizational parts of UML models.
Annotational — explanatory parts of UML models.
12
Structural Things in UML- 7 Kinds (Classifiers)
Nouns.
Conceptual or physical elements.
Active Class Component Interface Node
(replaceable part, (collection of externally
Class (processes/threads)
Visible ops)
(computational
realizes interfaces) resource at run-time,
Student Event Mgr processing power
std_id thread w. memory)
grade time Course.cpp
changeLevel( ) Start IGrade
setGrade( ) suspend( ) <<interface>> UnivWebServer
getGrade( ) stop( ) IGrade
setGrade()
getGrade()
Register Manage Course
for Courses Registration
Use Case Collaboration
(a system service (chain of responsibility
-sequence of shared by a web of interacting objects,
Interactions w. actor) structural and behavioral) 13
Behavioral Things in UML
Verbs.
Dynamic parts of UML models: “behavior over time”
Usually connected to structural things.
Two primary kinds of behavioral things:
Interaction
a set of objects exchanging messages, to accomplish a specific purpose.
harry: Student katie: Professor
ask-for-an-A
name = “Harry Kid” name = “Katie Holmes”
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
14
sober/turn-on-PC
3 basic building blocks of UML - Diagrams
A connected graph: Vertices are things; Arcs are relationships/behaviors.
UML 1.x: 9 diagram types. UML 2.0: 12 diagram types
Structural Diagrams Structural Diagrams
Represent the static aspects of a system.
Class; Class;
Object Object
Component Component
Deployment
Deployment
Composite Structure
Package
Interaction Diagrams
Behavioral Diagrams Behavioral Diagrams
Represent the dynamic aspects.
Use case Sequence;
Use case Communication
Sequence;
Collaboration Statechart Interaction Overview
Statechart Timing
Activity
Activity
15
Diagrams in UML – Interaction Diagrams
A use case diagram presents an outside view of the system.
Then, how about the inside view of the system?
Interaction diagrams describe how use cases are realized
in terms of interacting objects.
Two types of interaction diagrams
Sequence diagrams
Collaboration (Communication) diagrams
16
UML Model
Functional model: Use case diagram
Describe the functional behavior of the system
as seen by the user
Object model: Class diagram
Describe the static structure of the system in
terms of Objects, Attributes, Associations, and
Operations.
17
UML Model
Class diagram used in different phases of the software life
cycle
1.Requirement and analysis:
analysis object model application concepts
2. System design:
system design model descriptions of subsystem interfaces
3. Object design:
object design model detailed descriptions of solution
objects
18
UML Model
Dynamic model: Interaction diagram, State machine diagram,
Activity diagram
Describe the internal behavior of the system
Interaction diagram :
describe behavior as a sequence of messages exchanged
among a set of objects
State machine diagram :
describe behavior in terms of states of an individual object and
the possible transitions between states
Activity diagram :
describe behavior in terms of control and data flows
19