UML ChapterTwoLecture
UML ChapterTwoLecture
During the early 90s, there were around 50 O-O methods, among
them:
Booch: Categories and Subsystems
Coad and Yourdon: Class, Object, Class-&-Object
Jacobson: Use cases, and OOSE
Rumbaugh: Class and Associations, and OMT
Then in 1995, Rational Software brought three industry leaders together to
create a single approach to object-oriented systems development.
Grady Booch, Ivar Jacobson, and James Rumbaugh (the three amigos)
worked with others to create a standard set of diagramming techniques
known as the Unified Modeling Language (UML).
Class:
A class is used to represent various objects. It is used to define the properties
and operations of an object. In UML, we can also represent an abstract class. A
class whose functionalities are not defined is called an abstract class. Any UML
class notation is generally expressed as follows,
Object:
An object is an entity which is used to describe the behavior and functions of a
system. The class and object have the same notations. The only difference is that
an object name is always underlined in UML.
The notation of any object in UML is given below.
Interface:
An interface is similar to a template without implementation details. A circle
notation represents it. When a class implements an interface, its functionality is
also implemented.
Use-case:
Use-cases are one of the core concepts of object-oriented modeling. They are
used to represent high-level functionalities and how the user will handle the
system.
Actor:
It is used inside use case diagrams. The actor is an entity that interacts with the
system. A user is the best example of an actor. The actor notation in UML is given
below.
Component:
A component notation is used to represent a part of the system. It is denoted in
UML like given below,
Node:
A node is used to describe the physical part of a system. A node can be used to
represent a network, server, routers, etc. Its notation is given below.
Deployment diagram:
It represents the physical hardware on which system is installed. A
deployment diagram represents the physical view of a system. It
denotes the communication and interaction between various parts
of the system.
A deployment diagram consists of the following notations :
A node, A component, An artifact and An interface
State machine:
It used to describe various states of a single component throughout the software
development life cycle. It is used to capture different states of a system
component.
Activity diagram:
An activity diagram is used to represent various activities carried out by different
components of a system. It is denoted the same as that of the state machine
diagram. Activity diagram mainly contains initial state, final state, a decision box,
and an action notation.
Booch ‘91
OMT - 1
How to use UML diagrams
to design software
system?
Types of UML Diagrams:
Use Case Diagram
Class Diagram
Sequence Diagram
Collaboration Diagram
State Diagram
Borrow Employee
Client
Order Title
Fine Remittance
Supervisor
Use-Case Diagrams
Actors: A role that a user plays with respect to the system, including human users
and other systems. e.g., inanimate physical objects (e.g. robot); an external system
that needs some information from the current system.
Use case: A set of scenarios that describing an interaction between a user and a
system, including alternatives.
Association:
communication between an actor and a use case; Represented by
a solid line.
<<extend>>
Use-Case Diagrams
Figure 16.12
The McGraw-Hill Companies, 2005
Use-Case Diagrams
Name
Account_Name
- Customer_Name
Attributes
- Balance
+addFunds( ) Operations
+withDraw( )
+transfer( )
OO Relationships
Example:
Supertype Customer
Regular Loyalty
Customer Customer
Subtype1 Subtype2
-Inheritance is a required feature of object orientation
-Generalization expresses a parent/child relationship among related classes.
0..1 *
employer teacher
Multiplicity Role
Symbol Meaning
1 One and only one
Role
0..1 Zero or one “A given university groups many people;
some act as students, others as teachers.
M..N From M to N (natural
language) A given student belongs to a single
university; a given teacher may or may not
* From zero to any positive
be working for the university at a particular
integer
time.”
0..* From zero to any positive
integer
1..* From one to any positive
Class diagram
* 4
Student Course
has enrolls
Class Student {
Course enrolls[4];
}
Class Course {
Student have[];
}
OO Relationships: Composition
Whole Class
Class W Association
Models the part–whole relationship
Composition
Class P1 Class P2 Also models the part–whole relationship but, in
addition, Every part may belong to only one
whole, and If the whole is deleted, so are the
Part Classes parts
[From Dr.David A. Workman]
Example Example:
A number of different chess boards: Each square
belongs to only one board. If a chess board is
thrown away, all 64 squares on that board go as
well.
Figure 16.7
The McGraw-Hill Companies, 2005
OO Relationships: Aggregation
Container Class
Aggregation:
Class C expresses a relationship among instances of related
classes. It is a specific kind of Container-Containee
AGGREGATION
relationship.
Apples Milk
Aggregations
may form "part of" the association, but may not be essential to it. They
may also exist independent of the aggregate. e.g. Apples may exist
independent of the bag.
Good Practice: CRC Card
Picks up
Dial tone
Dial
Picks up
Hello
Sequence Diagram:Object
interaction
A B
Self-Call:
Self-Call A message that an
Synchronous
Object sends to itself.
[condition] remove()
Condition
*[for each] remove()
Iteration
Self-Call
Sequence Diagrams – Object Life
Spans
Creation
Create message A
Object life starts at that point
Activation Create
B
Symbolized by rectangular stripes
Place on the lifeline where object is
activated.
Rectangle also denotes when object is
deactivated.
Deletion
Activation bar
X
Placing an ‘X’ on lifeline Return
Deletion
Object’s life ends at that point
Lifeline
Sequence Diagram
Us er
Message Catalog Res ervations
4 : title returned ()
•The horizontal dimension shows the
objects participating in the interaction. 5: hold title ()
5 : title available ()
6: remove reservation
5: title available
6 : borrow title
1: look up
2: title data
4 : title returned
Catalog
5 : hold title
Collaboration diagrams are equivalent to sequence diagrams. All the features of sequence
diagrams are equally applicable to collaboration diagrams
Use a sequence diagram when the transfer of information is the focus of attention
Start End
Unpaid Paid
Invoice created payin Invoice destroying
g
State Diagrams (Traffic light
example)
Traffic Light Start
State
Transition Red
Yellow
Green
Event
What UML Modeling tools we
use today?
List of UML tools
http://en.wikipedia.org/wiki/List_of_UML_tools
ArgoUML: http://argouml.tigris.org/