You are on page 1of 79

Course code : C5

Course Name : OOAD


Objective
• Object Oriented Analysis and Design Using UML
present the concepts and techniques necessary
to effectively use system requirements to drive
the development of a robust design model.
• In this intensive, students can learn to apply the
Unified Modeling Language (UML) to
fundamental object-oriented analysis and
design concepts including architecture, objects,
classes, components, stereotypes,
relationships, and all supporting diagrams.
• The UML is used throughout the project lifecycle
to capture and communicate analysis and design
decisions.
• Students will understand OOAD Concepts, learn
to represent it with UML and document it using
UML modeling tool.
• The class will be concept & Case study driven and
wherever necessary tool will be used.
Analysis and Design with UML

• Unified Modeling Language (UML)


• Why Construct Model?
• UML Diagram
• Types of UML Diagrams
Object Oriented Analysis and Design (OOAD)

• Object Orientation (OO) and Object Oriented Method


(OOM)
• Object Oriented Modeling
• Polymorphism
• Inheritance
• Object Oriented Analysis and Design
• System Development
– Requirement Model
– Analysis Model
– Design Model
– Implementation Model
– Test Model
– Unified Modeling Language (UML)
• The Value of UML
• History of UML
• Overview of the UML
Complexity

• Complexity
• Complexity Crisis
• General Idea of How to Deal with Complexity
Classes and Objects
• Nature of an Objects
• Relationship among Objects
• Nature of Class
• Relationship among Classes
Basic OOAD Process

• Basic OO Concept
• Basic OOAD Process
• The four Principles
Evaluation System
• Internal evaluation : Number of Marks
Attendance : 05
Assignment : 10
Case Study : 20
Internal Test : 10
Class Assignment : 05
• End Semester Evaluation : Number of Marks
Vijayam Institute BCA Semester 2
What Is an Object?
• Definition: An object is a real world / domain related
entity with its related / encapsulated variables (State)
and related methods (Behavior).
• As the name object-oriented implies, objects are key to
understanding object-oriented methodology.
• You can look around you now and see many examples of
real-world objects: Desk, Projector,, Fan, We ourselves
are Objects
• Software objects are modeled after real-world objects in
that they, too, have state and behavior.
• A software object maintains its state in variables and
implements / changes / modifies its behavior with
methods.
• These real-world objects share 3 characteristics:
they all have Identity, state and behavior.
• For example, dogs have state (name, color,
breed, hungry) and dogs have behavior (barking,
fetching).
• Bicycles have state (current gear, current pedal
cadence, two wheels, number of gears) and
behavior (braking, accelerating, slowing down,
changing gears).
Environment
A Partial Sample Process
Explore Refine Plan Build Deploy

Build - Build - B uild - System


Plan and
Exploratory Infrastructure Functions
Elaborate
Em phasis Em phasis Em phasis
Iterative Development
P lan and
R efine Plan B uild Deploy
Elaborate

D ev C ycle D ev Cycle
...
1 2

Refine Sync. C on-


A nalyze Design Test
Plan A rtifacts struct
Time Boxing
• In time boxing, a development cycle is fixed in
length.
• The development team should choose the
work to accomplish within the time frame.

Refine Update Con-


Analyze Design Test
Plan Artifacts struct

2 weeks to 2 m onths
Object-Orientation
Analysis Design Implementation

Investigation of
Logical solution. Code.
the problem.

• Object-oriented analysis.
– Investigation that is object-centric - Conceptual.
• Object-oriented design.
– Solution in terms of interacting software objects.
• Object-oriented programming.
– Coding in an object-oriented programming language.
A Simple Object Model
STUDENT
COURSE
-ID Number
-Name -Subject
-Grade Point Average 0..*
has record for> -Number
-Title
+Admit() -Credit
0..*
+Regsiter for Classes()
+Withdraw() +Create a Course()
+Change Address() +Delete from Course Master()
1
+Calculate GPA()
1 +Change in Course Master()
+Graduate()

TRANSCRIPT COURSE

-Semester
-Division
-Grade

+Add()
+Drop()
+Complete()
+Change Grade()
Finding Object
Organizing Object
Describing how objects interacts
Defining the operations of objects
Inheritance

Vehicle

Superclass

Generalization
Wheeled Not Wheeled
Class

Specialization
Two wheeled Four wheeled Tank

Subclass

58
Aggregation
– Aggregation is a special form of association. Maybe referred to
alternatively as:
– contains
– is composed of
– is comprised of
– is part of

Examples:
– A Car contains an Engine
– A Car contains a Transmission
– A Car contains a Body
– A Car is composed of many ( four, in this case ) Wheels

59
Composition
– Composition is the relation consists of where the components cannot
exist independently from the whole. Wheels can exist independently from
the car, and are not necessarily destroyed when the car is wrecked The
car registration cannot exist without a car

Multiplicity
– One-to-one (1:1)
– One-to-many (1:m)
– Many-to-many (m:m)
This can be shown on the association/aggregation /composition line,
where `*' means zero or more

60
Composition (has)
The below diagram shows the "has-a"
relationships between the Car, Motor and
Wheel classes

61
• OOP – Object Oriented Programming
• OOD – Object Oriented Design
• OOA – Object Oriented Analysis
OOP:
– Object Oriented Programming is a method of
implementation in which programs are organized as
cooperative collections of objects.
– Each of which represents an instance of some class, and
whose classes are all members of hierarchy of classes united
via inheritance relationships.
– There are three important parts:
» Uses objects not algorithms, consists fundamental logical building
blocks.
» Each object is an instance of some class and
» Classes are related to one another via inheritance relationship
62
– So, it satisfies the following requirements:
• Supports objects that are data abstractions with an interface of
named operations & a hidden local state.
• Objects have an associated type that is class.
• Types classes may inherit attributes from super type that is super
class.
OOD:
– Object Oriented Design is a method of design encompassing
the process of object oriented decomposition and
– It is a notation for depicting (show) both logical and physical
as well as static and dynamic models of the system under
design.
– There are two important parts:
» Leads to an object-oriented decomposition and
» Uses different notations to express different models of the logical
(class & object structure) and physical (module & process
architecture) design of the system.

63
What is a Class?
• “A description of a set of objects that share
the same attributes, operations, methods,
relationships, and semantics. A class may
use a set of interfaces to specify collections
of operations it provides to its
environment.”
• Hence a class is a group of similar objects

64
Relationship among Classes
Class Relationships
• Classes, by themselves, aren't particularly useful. It’s the
relationships among classes that provide the foundation
for the structure of a new system. The following sections
explore how you use the UML to illustrate various kinds
of class relationships.
• Associations An association is a simple structural
connection between classes.
• There are two basic kinds of associations: binary
associations and n-ary associations.

65
Class Relationships
• A binary association, which exists between two classes,
appears as a straight line that connects them. Figure 2-1 shows
some example associations between classes.

Figure 2-1.  Binary associations

• Associations An association is a simple structural connection


between classes.
• There are two basic kinds of associations: binary associations
and n-ary associations. M

66
Binary Association:
• In a binary association is fully described by indicating:
• Each class' relationship with the other
• Its cardinality and
• Its optionality.
Cardinality is expressed in terms of:
• one to one
• one to many
• many to many

67
N-ary Association:
• An n-ary association, which exists among three or more
classes, appears as a set of lines connected to a central
diamond.

• The n-ary association is considered something of an


advanced modeling construct; you’re much more likely
to see—and use—plain binary associations in your
models.

68
Multiplicity Association:
• An association can show multiplicity. Figure the examples of
association multiplicity.

• A ternary association describes a fact that involves three


classes and cannot be split up into component binary
associations without losing information. For example, when a
seller negotiates a price with a buyer through an agent, a
decomposition of the ternary into two binary associations
between buyer and seller and seller and agent would lose the
information on which buyer was involved in the deal between
the seller and agent. 69
Ternary Association:
• A ternary association describes a fact that involves three classes and cannot be split up
into component binary associations without losing information. For example, when a
seller negotiates a price with a buyer through an agent, a decomposition of the ternary
into two binary associations between buyer and seller and seller and agent would lose
the information on which buyer was involved in the deal between the seller and agent.

A ternary association is described in terms of the role that each class plays in the association. For
example:
• An agent negotiates a price between a buyer and a seller
• A buyer negotiates a price with a seller through an agent
• A seller negotiates a price with a buyer through an agent

70
Example

71
OO Objectives
• We want a development method which:
– is able to guide us through analysis, design, and
implementation using one consistent paradigm
throughout those phases
– is less likely to generate errors
– contains checks to help eliminate errors
– facilitates reuse of designs and code

72
• One of the major benefits of OO technology, as
claimed by its promoter,
– is that enables to reuse.
• The most common kind of reuse is through
libraries.
• The user of the library is presented a description
of interface.
• One is supposed to be able to use the API
(application programmers interface) without a
deep understanding of the implementation
details of the library.
73
Object-Oriented Analysis / Object-Oriented Design

• Object-Oriented = Objects + Communication +


Classification + Inheritance
• The key idea of OO design is:
– System requirements are represented in terms of
interacting objects.

74
The general OOAD process

• The general analysis and design process involves


identifying (not in any order) the following things:
– Objects and Classes
– Responsibilities: data and function.
– Collaborators: what other classes helps to carry out
the responsibilities.
– Inheritance: similarity among classes.
– Subsystems: collections of objects and classes that
perform a task.

75
• Typically these components are common to all OO
Analysis methods:
Information / Conceptual Modeling: Identify the entities
and relationships in the problem. That is, what are the
• objects
• attributes of the objects
• relationships among the objects
Lifecycle Modeling: Identify the way that an object
responds to its environment. That is, what are the
• position that the object can be in.
• events that cause transitions (switch/move) between states
(Positions of Objects)
• the actions association.

76
Problem Solving – Core Steps
Step Objectives Deliverable
Concept 1. Capture the essence of 1. One or more sentences
(Problem what to solve? (real describing the vision to
Identification) meaning) achieves and key
objectives.
Analysis 1. Define the problem in 1. A breakdown of the
(Problem details sufficient to problem into clearly
Understanding) provide a satisfactory understand detail.
solution
Design 1. Clearly visualized a 1. A model showing solution
(Create Solution satisfactory solution in components with their
Plan) terms of intentions. relationships and
responsibilities.
Implementation 1. Translate the design 1. Working solution, such
(Create Physical into working product. as source code,
Solution) executables, images, 77
documentation.
Flowchart of Five Step Cycle Block - Iteration

78
Five Step Types Cycle Plan:
• Adding Cycle Plan gives the fifth and final step type.
• The key feature of the Cycle Plan step is it produces a list
of Concepts organized along a timeline.

79

You might also like