0% found this document useful (0 votes)
163 views59 pages

Chap5 PDF

The document discusses the Unified Modeling Language (UML) and its main diagrams for object-oriented modeling. It describes UML's main static and dynamic diagram types, including class diagrams, use case diagrams, sequence diagrams, and others. It provides details on class notation, associations, multiplicity, and other elements of UML class diagrams which are the primary diagrams for static modeling.

Uploaded by

karthi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
163 views59 pages

Chap5 PDF

The document discusses the Unified Modeling Language (UML) and its main diagrams for object-oriented modeling. It describes UML's main static and dynamic diagram types, including class diagrams, use case diagrams, sequence diagrams, and others. It provides details on class notation, associations, multiplicity, and other elements of UML class diagrams which are the primary diagrams for static modeling.

Uploaded by

karthi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 59

Object-Oriented Systems

Development:
Development
Using the Unified Modeling
Language

Chapter 5:
Unified Modeling Language

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Goals

• Modeling.
• Unified modeling language.
– Class diagram.
– Use case diagram.
– Interaction diagrams.
•Sequence diagram.
•Collaboration diagram.

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Goals (Con’t)

– Statechart diagram.
– Activity diagram.
– Implementation diagrams.
•Component diagram.
•Deployment diagram.

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Introduction
• A model is an abstract representation
of a system, constructed to
understand the system prior to
building or modifying it.
• Most of the modeling techniques
involve graphical languages.

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Static or Dynamic Models

• Models can represent


– static or
– dynamic situations.

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Static Model
• A static model can be viewed as a
"snapshot" of a system's
parameters at rest or at a specific
point in time.
• The classes’ structure
and their relationships
to each other frozen
in time are examples of
static models.
Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill
Dynamic Model
• Is a collection of procedures or
behaviors that, taken together,
reflect the behavior of a system
over time.
• For example, an order interacts
with inventory to determine
product availability.

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Why Modeling?
• Turban cites the following
advantages:
• Models make it easier to express
complex ideas.
• For example, an architect
builds a model to
communicate ideas
more easily to clients.

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Advantages of Modeling (Con’t)

• Models reduce complexity by


separating those aspects that are
unimportant from those that are
important.

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Advantages of Modeling (Con’t)
• Models enhance learning.
• The cost of the modeling analysis
is much lower than the cost of
similar experimentation
conducted with a real system.
• Manipulation of the model
(changing variables) is much
easier than manipulating a real
system.
Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill
Modeling Key Ideas
• A model is rarely correct on the
first try.
• Always seek the advice and
criticism of others.
• Avoid excess model revisions, as
they can distort the essence of
your model. Let simplicity and
elegance guide you through
the process.
Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill
The Unified Modeling Language
(UML)
• The unified modeling language
(UML) is a language for specifying,
constructing, visualizing, and
documenting the software system
and its components.

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


UML Diagrams
The UML defines nine graphical
diagrams:
1. Class diagram (static)
2. Use-case diagram
3. Behavior diagrams (dynamic):
– 3.1. Interaction diagram:
•3.1.1. Sequence diagram
•3.1.2. Collaboration diagram

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


UML Diagrams

– 3.2. Statechart diagram


– 3.3. Activity diagram
4. Implementation diagram:
4.1. Component diagram
4.2. Deployment diagram

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


UML Class Diagram,
• The UML class diagram is the
main static analysis diagram.
• Class diagrams show the static
structure of the model.
• Class diagram is collection of
static modeling elements, such as
classes and their relationships.

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Class Notation
• In class notation, either or both the
attributes and operation compartments
may be suppressed.
Boeing 737 Boeing 737
length: meter
fuelCapacity: Gal
Boeing 737 doors: int

length: meter
fuelCapacity: Gal lift ()
doors: int break ()

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Class Interface Notation
• Class interface notation is used to
describe the externally visible
behavior of a class.
• For example, an operation with a
public visibility.

Person BankAccount

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Binary Association Notation
• A binary association is drawn as a
solid path connecting two classes or
both ends may be connected to the
same class.
worksFor
Company Person
employer employee

Person

marriedTo

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Association Role
• A simple association—the
technical term for it is binary
association—is drawn as a solid
line connecting two class symbols.
• The end of an association, where
it connects to a class, shows the
association role.

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


UML Association Notation
• In the UML, association is represented
by an open arrow.

BankAccount Person

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Qualifier
• A qualifier is an association attribute.
For example, a person object may be
associated to a Bank object.
• An attribute of this association is the
account#.
• The account# is the Bank
qualifier of this account#
*
association.
0..1
Person
.

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Multiplicity
• Multiplicity specifies the range of
allowable associated classes.
• It is given for roles within
associations, parts within
compositions, repetitions, and other
purposes.
• lower bound .. upper bound.

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


OR Association
• An OR association indicates a
situation in which only one of several
potential associations may be
substantiated at one time for any
single object.
Person
Car {or}

Company

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Association Class
• An association class is an association
that also has class properties.
• An association class is shown as a class
symbol attached by a dashed line to an
association path.
Company Person
employer employee

WorksFor
salary

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


N-Ary Association
• An n-ary association is an association
among more than two classes.
• Since n-ary association is more
difficult to understand, it is better to
convert an n-ary association to binary
association. semester *
Year

* *
Class Student
class student

GradeBook
grade
exam
lab

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Aggregation

• Aggregation is a form of association.


• A hollow diamond is attached to the end
of the path to indicate aggregation.

1 consistOf *
Team Player
class

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Composition
• Composition, also known as the a-
part-of, is a form of aggregation with
strong ownership to represent the
component of a complex object.
• The UML notation for composition is a
solid diamond at the end of a path.
Car
1 1 1 1

4,10 1 graphical composition


4 2,5
Wheel Light Door Engine
Car Car
4 4 Wheel
Wheel
4,10 nested composition
Light 4,10 Light
2,5 2,5
Door Door
1 1
Engine Engine

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Generalization
• Generalization is the relationship
between a more general class and a
more specific class.
• Generalization is displayed as directed
line with a closed, hollow Separate target style

arrowhead at the Vehicle

superclass end. Bus Truck Car

Shared target style

BoeingAirplane

Boeing 737 Boeing 757 Boeing 767

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Use-Case Diagram
• The description of a use case
defines what happens in the
system when the use case is
performed.
• In essence, the use-case model
defines the outside (actors) and
inside (use case) of the system's
behavior.

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Use-Case Diagram (Con’t)
• A use-case diagram is a graph of actors, a set
of use cases enclosed by a system boundary,
communication (participation) associations
between the actors and the use cases, and
generalization among the use cases.
Help Desk
Making a call

Take the call


Operator
Client Do research

Return a call

Support
representative
Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill
Actor Notations
• The three representations of an actor
are equivalent.

<< actor>> << actor>>


Customer Customer Customer

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Use-Case Diagram (Con’t)

• These relationships are shown in


a use-case diagram:
– Communication.
– Uses.
– Extends.

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Behavior or Dynamic Diagrams

• Interaction diagrams:
– Sequence diagrams
– Collaboration diagrams
• Statechart diagrams
• Activity diagrams

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


UML Interaction Diagrams
• Interaction diagrams describe how
groups of objects collaborate to
get the job done.
• Interaction diagrams capture the
behavior of a single use case,
showing the pattern of interaction
among objects.

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


UML Sequence Diagram
• Sequence diagrams are an easy and
intuitive way of describing the
behavior of a system.
• A sequence diagram shows an
interaction arranged in a time
sequence. Telephone Call
Caller Exchange Receiver Talk

OffHook

DialTone
Dial Number

RingTone

OffHooke

OnHook

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


UML Collaboration Diagram
• A collaboration diagram represents a
set of objects related in a particular
context, and the exchange of their
messages to achieve a desired
outcome. Telephone
Object
Call
Caller Message

1: OffHooke
2: DialTone 3: Dial Number

Exchange
4: RingTone

Receiver

5: OffHook

6: OnHook
Talk

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


UML Collaboration Diagram
(Con’t)
Telephone Call
Object Caller Message

1.1: OffHooke 2.1: DialTone 1.2: Dial Number

Exchange

2.2: RingTone

Receiver

3.1: OffHook

4.1: OnHook
Talk

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


UML Statechart Diagram
•A statechart diagram (also
called a state diagram) shows
the sequence of states that an
object goes through during its
life in response to outside
stimuli and messages.

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Idle
lift receiver and get dial tone

State

Dialing

Start Dial number.siValid()


entry and start dialog
entry and number.append(n)
exit/ stop dial tone

digit(n)

Substates
Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill
Complex Transition

i j

A B
k l

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


UML Activity Diagram
•An activity diagram is a
variation or special case of a
state machine, in which the
states are activities
representing the performance
of operations and the
transitions are triggered by the
completion of the operations.
Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill
UML Activity Diagram (Con’t)
Prepare
document
incoming
s

Index
documents

Make electronic
file

Complete
Request

Check data for Draw up contract


life
insurance
Mortgage-deed

Calculate data
for Pay provision
construction to
insurance
mortgag
agent
e

Draw up insurance
policy

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


UML Activity Decision

[hours < =40]


Calculate payroll Normal payroll

[hours > 40]


Overtime, get authoriation

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Swimlanes.
office clerk InsuranceAgent Loanofficer

Prepare incoming
documents

Make electronic
file Index documents

Complete
request

Check data for life Draw up concept


insurance mortgage-deed

Calculate data for


Pay provision to
construction
mortgage insurance agent

Draw up insurance
policy

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Implementation diagrams
•These diagrams show the
implementation phase of
systems development.
•Such as the source code
structure and the run-time
implementation structure.

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Implementation diagrams
(Con’t)
•There are two types of
implementation diagrams:
– Component diagrams show the
structure of the code itself.
– Deployment diagrams show the
structure of the run-time system.

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Component diagrams

Access Update

UI

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Deployment Diagram

Node 1: AdminServer

Access Update

Node 2: John   PC

UI

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Model Management: Package
•A package is a grouping of
model elements.
•Packages themselves may
contain other packages.
•A package may contain both
subordinate packages and
ordinary model elements.
Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill
A Package and Its Contents
GradeNoteBook

Year
semester *
* *
Class Student
class student

GradeBook
grade
exam
lab

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


A Package and Its Dependencies

Customer

Business Model

Clients
Bank

Account

Checking Saving

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Model Constraints and Comments
• Constraints are assumptions or
relationships among model elements
specifying conditions and
propositions that must be maintained
as true otherwise the system described
by the model would be invalid.
* WorkFor *
Person {subset}
Department
1 ManagerOf 1

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Note
• A note is a graphic symbol containing
textual information; it also could
contain embedded images.

Person employee employer Company

Represents
an incorporated
Static models & entity
revision levels
released yesterday

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Stereotype
• Stereotypes represent a built-in
extendibility mechanism of the UML.
• User-defined extensions of the UML
are enabled through the use of
stereotypes and constraints.
Flow Flow
Copy Copy

NumberOfCopy NumberOfCopy

makeCopy makeCopy

Copy

Copy
NumberOfCopy

makeCopy

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


UML Meta-Model
•A meta-model is a model of
modeling elements.
•The purpose of the UML meta-
model is to provide a single,
common, and definitive
statement of the syntax and
semantics of the elements of
the UML.
Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill
UML Meta-Model (Con’t)
Relationship

Generalization Association
1

Association Role

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Summary
•A model is a simplified
representation of reality.
•The unified modeling
language (UML) was
developed by Booch, Jacobson,
and Rumbaugh and
encompasses the unification of
their modeling notations.
Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill
Summary (Con’t)

• UML consists of the following


diagrams:
– Class diagram.
– Use case diagram.
– Sequence diagram.
– Collaboration diagram.

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill


Summary (Con’t)
– Statechart diagram.
– Activity diagram.
– Component diagram.
– Deployment diagram.

Object-Oriented Systems Development Bahrami ? Irwin/ McGraw-Hill

You might also like