Uml m3
Uml m3
MODULE 3:
Unified Modeling language- Introduction,
UML Diagrams – Class diagrams, Sequence
diagrams, Object diagrams, Deployment
diagrams, Use case diagrams, State diagrams,
Activity diagram, Component diagrams –
Case StudyIdentifying Classes- Noun Phrase
Approach, Common class Pattern Approach,
Use-Case Driven Approach, CRC.
History of the UML
Things (entities)
Relationships
Diagrams
Entites
Dependency
Association
Generalization
Realization
Type of relationship UML syntax Semantics
Source – Target
Dependency Source element depends on
the target element and
change last may affect the
first.
Association Description of the set of
relationships between
objects.
Aggregation The target element is a part
of the source element.
Composition Strict (more limited) form of
aggregation/
Type of relationship UML syntax Semantics
Source – Target
Inclusion Source element contains the
target element.
Generalization The source element is a
specialization of a more
generalized the target
element, and can replace
him.
Realization The original item is
guaranteed to perform the
contract, a certain target
element.
Diagrams in the UML
Class diagram
Object diagram
Use case diagram
Sequence diagram
Collaboration diagram
Statechart diagram
Activity diagram
Component diagram
Deployment diagram
Class diagrams
of the world.
system boundary).
Class/object representation
Values and attributes
Value : piece of data.
Attribute: a named property of a class that describes a
value held by each object of the class.
1. Collaboration Diagrams
2. State Transition Diagrams
Collaboration Diagrams
Actor System
System SystemOp
Op
:ClassA
+ Operation:xxx
Precondition:. 1:
. message1()
:ClassB
Use Case
Contract
Diagram Collaboration
Diagram
Alternatively (or perhaps primarily)
Sequence Diagrams can be used
instead of Collaboration Diagrams
Sequence Diagrams
Actor System
:ClassA :ClassB
System
Op
SystemOp
Operation:xxx message1()
+
Precondition:.
.
Notation
Illustrating links
1: tot := total():integer
:POST :Sale
sender receiver
Illustrating Iteration
SystemOp( )
sender receiver
Sequence number followed Iteration clause is optional
by a * indicates iteration
Collaboration Diagrams
Illustrating Iteration
In the example described on the previous slide, we
assumed that the target object contained a sequence
of names (simple strings) as an attribute. More
generally the ClassList may be considered a
collection of StudentRec objects, and messages may
be directed to the collection. The depiction of a
message to a multiobject – a group of objects stored
in a collection – is indicated on the next slide.
1: message( )
:ClassA
1b.1: msg5( )
:ClassC :ClassD
Collaboration Diagrams
New
1: create( )
c: Controller m:MenuItem
2: add(m)
:MenuItem
:ClassA :ClassB
msg1( )
msg2( )
Each message between
Focus of control is objects is represented with a
msg3( )
illustrated with an message expression on an
activation box arrowed line between the
objects
Sequence Diagrams
Additional Notation
Object creation -- let the classB object create an
instance of a classC object.
Newly created class
is placed in a column
:ClassA :ClassB
starting at the level
(time) of creation.
msg1( )
msg2( )
create( )
msg3( )
:ClassC
msg4( )
time
Sequence Diagrams
Conditional
Mutually exclusive
messageconditional
– has guardmessage
to specify the condition
msg1( )
[flag = true]
msg2( )
[flag = false] msg3( )
Sequence Diagrams
msg1( )
msg3( )
msg4( )
*[k = 1..M]
msg5( )
Class name
Data attributes
Classes to which
Link attributes messages are
sent
Messages
methods received
Class Description
State Transition Diagrams
State 1 State 2
start
Additional Notation
event|output
State State
[boolean condition]
[valid subscriber]
idle active
talking
on hook playing dial do: hang up
tone
answered
digit
The state labeled
complete|ringing
active has
substates dialing connectin
g
digit
State Transition Diagrams
arrival arrival
departure departure
arrival | balk
class Queue {
private:
State
int capacity, size;
public:
Queue(int cap);
void enqueue(Object obj); State
//precondition: queue not full transitions
//post condition: if (queue not full)
// size = size + 1
// else no change
Object dequeue();
//precondition: queue not empty
//post-condition: size = size-1
}
Visibility
permanent or transient
exclusive or shared
fixed or variable
Visibility
ProductSpe Computer
*
c describes
class Computer {
private:
ProductSpec &
ps; public:
2: spec:=
specification(upc) A ProductSpec object is
:ProductCatalog passed to the Sale object for
use by its makeLineItem
method
COMPONENT
DIAGRAM
in UML 2.0
PLAN OF TALK
A component
Specifies a CONTRACT of the services that it
provides to its clients and that it requires from
others components in terms of its provided and
required interfaces
Can be replaced
The system can be extended
DEPENDENCIES
Components can be
connected by usage
dependencies
Usage Dependency
A usage dependency is relationship which one
element requires another element for its full
implementation
Is a dependency in which the client requires
the presence of the supplier
Is shown as dashed arrow with a <<use>>
keyword
The arrowhead point from the dependent
component to the one of which it is
dependent
PORT
Specifies a distinct interaction point
Between that component and its environment
Between that component and its internal parts
An internal, or white
box view of a
component is where
the realizing
classes/components are
nested within the
component shape
Realization is a relationship between two set
of model elements
One represents a specification
The other represent an implementation of
the latter
INTERNAL VIEW
Deployment diagrams
Show the physical relationship between
hardware and software in a system
Hardware elements:
• Computers (clients, servers)
• Embedded processors
• Devices (sensors, peripherals)
Are used to show the nodes where software
components reside in the run-time system
DEPLOYMENT DIAGRAMS
Deployment diagram
Contains nodes and connections
A node usually represent a piece of hardware
in the system
A connection depicts the
communication path
used by the hardware to
communicate
Usually indicates the
method such as TCP/IP
DEPLOYMENT DIAGRAMS
Deployment diagrams
contain artifact
An artifact
Is the specification of a
phisycal piece of
information
Ex: source files, binary
executable files, table
in a database system,
….
An artifact defined by
the user represents a
concrete element in
the physical world
DEPLOYMENT DIAGRAMS
An artifact manifest one or more model
elements
A <<manifestation>> is the concrete physical
of one or more model elements by an artifact
This
A model element often is a component
manifestation is
notated as a dashed
line with an open
arrow-head labeled
with the keyword
<<manifest>>
DEPLOYMENT DIAGRAMS