OOSD Unit2
OOSD Unit2
BASIC
STRUCTURAL
MODELLING
UML Diagrams
• Types of UML Diagrams:
Use Case Diagram
Class Diagram
Sequence Diagram
Collaboration Diagram
State Diagram
Activity Diagram
Introduction
• Use case diagrams
– Describe the functional behavior of the system as seen by the
user
• Class diagrams
– Describe the static structure of the system: Objects, attributes,
associations
• Sequence diagrams
– Describe the dynamic behavior between objects of the system
• State-chart diagrams
– Describe the dynamic behavior of an individual object
• Activity diagrams
– Describe the dynamic behavior of a system, i.e. The
Workflow.
Use-Case Diagrams
• A use-case diagram is a set of use cases
• A use case is a model of the interaction
between
External users of a software product (actors) and
The software product itself
More precisely, an actor is a user playing a specific role
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.
Interaction Diagrams
• show how objects interact with one another
Picks up
Dial tone
Dial
Picks up
Hello
Sequence Diagram:Object interaction
A B
Self-Call: A message that an
Object sends to itself. Synchronous
[condition] remove()
Condition
*[for each] remove()
Iteration
Self-Call
Sequence Diagrams – Object Life
Spans
• Creation A
Create message
Object life starts at that point Create
B
• Activation
Symbolized by rectangular stripes
Place on the lifeline where object is
activated.
Rectangle also denotes when object
is deactivated. Activation bar X
Return
• Deletion Deletion
Placing an ‘X’ on lifeline
Lifeline
Object’s life ends at that point
Sequence Diagram
Message
•Sequence diagrams demonstrate User Catalog Reservations
the behavior of objects in a use case
by describing the objects and the
1: look up ()
messages they pass.
2: title data ()
5: hold title ()
6 : remove reservation ()
•The labels may contain the seq. # to
indicate concurrency.
What is a Collaboration Diagram
Sequence Contract
Diagram Collaboration
Diagram
Activity diagrams
• Useful to specify software or hardware system behaviour
• Based on data flow models – a graphical representation (with a
Directed Graph) of how data move around an information
system
[order reject]
Send Accept
Invoice Make Payment
Invoice Payment
40
Some definitions
• Flow: permits the interaction between two nodes of the activity
diagram (represented by edges in activity diagram)
• State: a condition or situation in the life of an object during which it
satisfies some conditions, performs some activities, or waits for
some events
• Type: specifies a domain of objects together with the operations
applicable to the objects (also none); includes primitive built-in
types (such as integer and string) and enumeration types
• Token: contains an object, datum, or locus of control, and is present
in the activity diagram at a particular node; each token is distinct
from any other, even if it contains the same value as another
• Value: an element of a type domain
41
State Diagrams
State Diagrams show the sequences of states an object
goes through during its life cycle in response to stimuli,
together with its responses and actions; an abstraction
of all possible behaviors.
Start End
Unpaid Paid
Invoice created paying Invoice destroying
Time Diagram
• show interactions between primary with time
• focus on conditions changing within and
among lifelines
• describe behavior of individual classifiers and
interactions of classifiers,
• focusing attention on time of events
Component Diagram
• used to break down a large object-oriented
system into the smaller components
• models the physical view of a system such as
executables, files, libraries, etc.
• visualizes the relationships as well as the
organization between the components present
in the system
• A component is a single unit of the system,
which is replaceable and executable
component diagram for an online
shopping system
Deployment Diagram
• shows the execution architecture of a system
• visualize the physical hardware and software
of a system
• model the hardware topology of a system
(logical components of a system)