Você está na página 1de 41

Object-Oriented Analysis and

Design

UNIT-I

Introduction to OOAD
Object oriented methods enable us to create sets
of objects that work together synergistically to
produce software that better module their problem
domains than similar systems produced by
traditional techniques. The system created using
object oriented methods are easier to adapt
changing requirements, easier to maintain, more
robust, promote greater design. The reasons why
object orientation works High level of abstraction.
Seamless transition among different phases of
software
development.
Encourage
of
good
programming techniques. Promotion of reusability.

Introduction to OOAD cont


Object-Oriented Analysis and Design
analysis models the real-world
requirements, independent of the
implementation environment
design applies object-oriented
concepts to develop and
communicate the architecture and
details of how to meet requirements

Unified Modeling Language:


Its a language for modeling software systems.
This language is used for specifying,
visualizing, constructing and documenting
software
systems
through
out
the
development.
Model Represents an abstract of the system.
It is build prior to the original system. It can
be used to make a study on the system and
also can be used to analyze the effect of
changes on the system. Models are used in
all disciplines of engineering.

UML diagrams
UML is composed of 9 graphical diagrams:
1) Class Diagram
2) Use Case Diagram
3) Behavior Diagram
a. Interaction Diagram
i. Sequence Diagram
ii. Collaboration Diagram
b. State Chart Diagram
c. Activity Diagram
4) Implementation Diagram
a. Component Diagram
b. Deployment Diagram

UML modeling
Unified Modeling Language
OMG Standard, Object Management
Group
Based on work from Booch, Rumbaugh,
Jacobson

UML is a modeling language to


express and design documents,
software
Particularly useful for OO design
Not a process, but some have been
proposed using UML

Use Case diagram


Use cases are scenarios for understanding system
requirements. A use case is an interaction between
users and a system. The use-case model captures
the goal of the user and the responsibility of the
system to its users
Use case model. Structured by Realized by
Implemented by Tested in Express in Use-case
model Domain Object Model Analysis Model Design
model Implementation Model Testing model OK
NOT OK The use case model defines the outside
(actors) and inside (use case) of the system
behavior.

Use case diagram cont

Use case diagram cont

Passenger

Used during requirements


elicitation
to
represent
external behavior

Actors represent roles,


that is, a type of user of
the system
Use cases represent a
sequence of interaction for
a
type of functionality;
summary of scenarios
The use case model is the
set of all use cases. It is a
complete description of the
functionality of the system
and its environment

PurchaseTicket

Use case cont


The use case description must contain:
How and when the use case begins and
ends.
The interaction between the use case and its
actors, including when
The interaction occurs and what is
exchanged.
How and when the use case will store data in
the system.
Exceptions to the flow of events.

Class Diagrams
Class diagram represents the types of objects in
the system and the various
kinds of static relationships that exist between
them. Class diagrams are used in object
modeling
where real world objects are mapped to logical
objects in computer program.
The class diagrams are used to describe the
roles and responsibilities of objects to carry out
in performing the desired behavior of the
system.

Class Diagram cont


The class diagram is used to decide
what classes exist and how they
relate to each other.
Represents a set of interrelated
classes.
This diagram shows the existence of
various classes and logical relation
between them.

Class Diagram Perspectives


We draw Class Diagrams under three
perspectives
Conceptual
Software independent
Language independent

Specification
Focus on the interfaces of the software

Implementation
Focus on the implementation of the software

The interaction diagrams


An interaction diagram is used to trace the
execution scenario in the same context as an
object diagram.
Interaction diagram includes objects involved in the
sequence of communication.
The interaction diagram represents the sequence of
message passing among related objects.
The interaction diagram represents the sequence of
message passing between various objects.
The interaction diagrams are also used to describe
the behavior of the system in terms of scenarios

interaction diagrams cont

When we need interaction diagram?


Interaction diagrams are used when you
want to model the behavior of several
objects in a use case. They demonstrate
how the objects collaborate for the behavior.
Interaction diagrams do not give a in depth
representation of the behavior. If you want
to see what a specific object is doing for
several use cases use a state diagram. To
see a particular behavior over many use
cases or threads use an activity diagrams.

Interaction diagram
example

State Diagram
Interaction diagrams do not give a in depth
representation of the behavior. If you want
to see what a specific object is doing for
several use cases use a state diagram
Use state diagrams to demonstrate the
behavior of an object through many use
cases of the system.
Only use state diagrams for classes where
it is necessary to understand the behavior
of the object through the entire system

State Diagram cont


A diagram that captures the behavior of an
object by specifying the sequence of states
it goes through during its lifetime in
response to events, together with the
responses to those events
describe changes in state in a procedure
Also called statechart diagram or state
machine diagram
State a condition or situation during the
life of an object at which time it satisfies
some condition, performs some activity, or
waits for some event

State Diagram cont


A state diagram to describe the
behavior (i.e., state changes) of a
single class according to events and
messages which class sends and
receives
A state diagram can also clarify a use
case to specify the actions the use
case can take in accordance with
varying conditions of the system
E.g., a use case enroll course, the
state can be full, opened, and closed.

Example of State Diagram


i)
Invoice created

Unpaid

Paying

Invoice destroyed

Paid

ii)
[condition] /action
StateEvent(parameters)
1
do/activity 1

Start state

transition

State 2
...

End state

State diagram notation


Name compartment

Action labels

Activity diagram
To see a particular behavior over many use
cases or threads use an activity diagrams
The main reason to use activity diagrams is to
model the workflow behind the system being
designed.
Activity Diagrams are also useful for: analyzing
a use case by describing what actions need to
take place and when they should occur;
describing a complicated sequential algorithm;
and modeling applications with parallel
processes.

Activity diagram cont


Focus on flow of activity of internal
process in object
similar to flowchart
describe changes in activity in a
procedure
information from use case scenario
or event flow can be used to describe
activity diagram.
Used to provide detail for complex
algorithms

Activity diagram model

Example of Activity Diagram for


Register Course
Fill form

Select course

[No]

Submit to
PA

approve?

[Yes]
Register
course

end

Example of Activity Diagram for


ATM Authorization
Enter card

Enter PIN

Read card

Request PIN
[No]

Verify PIN

valid?
[Yes]

Select other
service

Package diagram
UML packages diagrams are often used to illustrate
the logical architectures of a system the layers,
subsystems, packages (in the Java sense). A layer
can be modeled as a UML package.
A UML package diagram provides a way to group
elements. A UML packages can group anything:
classes, other packages, use cases, and so on.
It is common to want to show dependency (a
coupling) between package so that developers can
see the large-scale coupling in the system. The UML
dependency line is used for this, a dashed arrowed
line with arrow pointing towards the depended-on
package.
Some UML tools can reverse-engineer package

Package diagram

When we need package


diagram?
To organize complex class diagrams, you
can group classes into packages. A
package is a collection of logically related
UML elements
Notation
Packages appear as rectangles with small tabs
at the top.
The package name is on the tab or inside the
rectangle.
The dotted arrows are dependencies. One
package depends on another if changes in the
other could possibly force changes in the first.
Packages are the basic grouping construct with
which you may organize UML models to

Package diagram Example

Component diagram
Shows a set of components and their

relationships.
Represents the static implementation
view of a system.
Components map to one or more
classes, interfaces, or collaborations.

Component diagram cont


UML component diagrams describe software components
and their dependencies to each others
A component is an autonomous unit within a system
The components can be used to define software
systems of arbitrary size and complexity
UML component diagrams enable to model the highlevel software components, and the interfaces to
those components
Important for component-based development (CBD)
Component and subsystems can be flexibly REUSED
and REPLACED
A dependency exists between two elements if
changes to the definition of one element may cause
changes to the other
Component Diagrams are often referred to as wiring
diagrams

Why we use component


diagram?
Shows various components in a system
and their dependencies, interfaces
Explains the structure of a system
Usually a physical collection of classes
Similar to a Package Diagram in that both are
used to group elements into logical structures
With Component Diagrams all of the model
elements are private with a public interface
whereas Package diagrams only display public
items.

How we use component


diagram?
Components are shown as rectangles
with two tabs at the upper left

Dashed arrows indicate dependencies


Circle and solid line indicates an
interface to the component

component diagram
example

A Deployment Diagram
A Deployment Diagram shows the configuration of run-time
processing elements and the software components, processes,
and objects.
Software
component
instances
represent
run-time
manifestations of code units.
Deployments Diagrams capture only components that exist as
run-time entities.
A deployment diagram shows the systems hardware, the
software installed on that hardware, and the middleware that
connects the disparate machines together.
A Deployment Diagram is a collection of one or more
deployment diagrams with their associated documentation.
Deployment diagrams show the physical configurations of
software and hardware.

Deployment Diagram cont

Deployment Diagram cont

End of unit-1

Você também pode gostar