Академический Документы
Профессиональный Документы
Культура Документы
KIIT CSE/IT
(OOSD)
Topics to be Discussed
1. INTRODUCTION
2. AN OBJECT ORIENTED PHILOSOPHY
3. OBJECTS
4. CLASSES
5. OBJECT RESPONDS TO MESSAGES
6. OBJECT RELATIONSHIP AND ASSOCIATIONS
7. CONSUMER-PRODUCER ASSOCIATION
8. AGGREGATION AND OBJECT CONTAINMENT
KIIT CSE/IT
(OOSD)
1. INTRODUCTION
What is an object ?
Ans: A car is an object; a real world
entity , identifiably separate from its
surroundings.
Car has well defined attributes:
Color
Manufacturer
Cost
Owner
KIIT CSE/IT
(OOSD)
1. INTRODUCTION contd.
Car has well defined set of things we
do with it(i.e methods) :
Drive it
Lock it
Tow it
Carry passenger
What do object have to do with
system development ?
KIIT CSE/IT
(OOSD)
1. INTRODUCTION contd.
Properties or attributes describe the
state (data) of an object.
Methods (procedures) defines its
behavior.
KIIT CSE/IT
(OOSD)
2. AN OBJECT ORIENTED PHILOSOPHY
KIIT CSE/IT
(OOSD)
2. AN OBJECT ORIENTED
PHILOSOPHY contd.
It has been said that one should
speak:
English for business
German for engineering
Persian for poetry
A similar quip can be made for
programming languages.
Traditional languages were more
machine dependant
KIIT CSE/IT
(OOSD)
2. AN OBJECT ORIENTED
PHILOSOPHY contd.
Fundamental characteristic of OOP is that
it allows the base concepts of the language
to be extended to include ideas and terms
closer to those of its application.
New data types can be defined in terms of
existing data types.
FUNDAMENTAL DIFFERENCE BETWEEN THE
OBJECT ORIENTED SYSTEMS AND
TRADITIONAL SYSTEMS ARE:
KIIT CSE/IT
(OOSD)
2. AN OBJECT ORIENTED
PHILOSOPHY contd.
Traditional Systems:
Most traditional development
methodologies are either algorithm
centric or data centric.
In an algorithm centric methodology you
can think of an algorithm that can
accomplish the task, then build data
structures for that algorithm to use.
In a data centric methodology, you think
how to structure the data, then build the
algorithm around
KIIT that
CSE/IT
(OOSD)
structure.
2. AN OBJECT ORIENTED
PHILOSOPHY contd.
In traditional approach a lot of code was
written to do all the things that have to
be done.
The code is the plan, brick, and mortar
for building a structure(Code Centric).
Code is the active entity here.
KIIT CSE/IT
(OOSD)
2. AN OBJECT ORIENTED
PHILOSOPHY contd.
Object-Oriented Systems:
Here the algorithm and the data
structures are packaged together as an
object, which has a set of attributes or
properties.
The state of these attributes is reflected
in the values stored in its data
structures.
Objects has a collection of methods or
procedures
Attributes KIIT
and methods
CSE/IT
(OOSD)
are equal and
2. AN OBJECT ORIENTED
PHILOSOPHY contd.
OOP languages bridge the semantic gap
between the ideas of the application and
those of the underlying machine &
Objects represent the application data in
a way that is not forced by hardware
architecture.
KIIT CSE/IT
(OOSD)
3. OBJECTS
KIIT CSE/IT
(OOSD)
3. OBJECTS contd.
KIIT CSE/IT
(OOSD)
Class
A class is comprised of three sections
The first section contains the class name
The second section shows the structure
(attributes)
The third section shows the behavior (operations)
A class is an abstract definition of an object
It defines the structure and behavior of each
object in the class
It serves as a template for creating objects
Objects are grouped into classes
KIIT CSE/IT
(OOSD)
5. OBJECT RESPONDS TO MESSAGES
KIIT CSE/IT
(OOSD)
Eg: Cars, motorcycles & bicycles will all respond to a
stop message but differently.
Stop
Message
KIIT CSE/IT
(OOSD)
5. OBJECT RESPONDS TO
MESSAGES contd.
NOTE: Messages makes no assumptions about
the class of the receiver or the arguments; they
are simply objects.
It is the receivers responsibilities to respond to
the message appropriately.
This gives flexibility, as different objects can
respond to the same message in different ways.
This is known as polymorphism. It is the main
difference between a message and a subroutine
call.
KIIT CSE/IT
(OOSD)
Difference Between Message &
Method
Instruction Vegetabl
Way it is e
1.Cook Rice
2.Wash All the Prepared Biriyani
vegetables.
3. Marinate the
same with
Yogurt & ginger-
garlic paste
for about an
hour.
4Heat a fry-pan
with Oil , add
Onions etc
5.Cover & let it
sit for a few
MESSAG
minutes before METHO OBJECT
serving.
E KIIT D CSE/IT
(OOSD)
5. OBJECT RESPONDS TO
MESSAGES contd.
In other words, message is the
instruction and the method is the
implementation.
Brake
Car .
Object
*7
5 Object .
KIIT CSE/IT
(OOSD)
Encapsulation and Information Hiding
A concept of Self-containing
Information hiding is the principle of
concealing the data and procedures of an
object
internal structure is hidden from their
surroundings
Functionality and behaviour characterised
by interfacing operations
Data Abstraction is a benefit of oo
concept that incorporates encapsulation
and polymorphism.
KIIT CSE/IT
(OOSD)
Some more O-O Concepts
Class Hierarchy
Single Inheritance
Multiple Inheritance
Multilevel Inheritance
Dynamic Inheritance: Allows objects to
change and evolve over time. It refers to
the ability to add, delete, or change
parents from objects(or Classes) at run
time. Eg: Window object changing to an
icon and a Vice versa.
Polymorphism
KIIT CSE/IT
(OOSD)
Polymorphism
A concept in type theory
A common name may denote
instances of different classes
One type of operation can be
implemented in different ways by
different classes
Overloading in modern OO
language
KIIT CSE/IT
(OOSD)
Why Polymorphism?
A very strong tool for allowing system
designers to develop flexible systems
Designer only need to specify what shall
occur and not occur and not how it shall
occur
To add an object, the modification will
only affect the new object, not those
using it
KIIT CSE/IT
(OOSD)
Inheritance
If class B inherits class A, then both
operations and the information
structure described in class A will
become part of class B
KIIT CSE/IT
(OOSD)
Inheritance
KIIT CSE/IT
(OOSD)
Why Inheritance?
Show similarities
Reuse common descriptions
Software Reuse
Easy modification of model by
performing modification in one place
Avoid redundancy , leading to
smaller and more efficient model,
easier to understand
KIIT CSE/IT
(OOSD)
6. OBJECT RELATIONSHIP AND ASSOCIATIONS
Eg:
KIIT CSE/IT
(OOSD)
7. CONSUMER-PRODUCER ASSOCIATION
Request for
PrintServ printing Item
er
PRODUCE CONSUM
R ER object
provides requests
service service
KIIT CSE/IT
(OOSD)
Association and
Link
A link:
An instance of an association
Exists between two or more objects
Dynamically created and destroyed
as the run of a system proceeds
For example:
An employee joins an organization.
Leaves that organization and joins
a new organization etc.
Relationships
Association
Aggregation
Composition
Dependency
Generalization
Realization
KIIT CSE/IT
(OOSD)
ASSOCIATION
These are the most general type of relationship:
It denotes a semantic connection between
two classes
It shows BI directional connection between
two classes
It is a weak coupling as associated classes
remain somewhat independent of each other
Example:
KIIT CSE/IT
(OOSD)
Association
Relationship
1 borrowed by *
Library Member Book
3-ary Association
* *
Person Skill
Competency
level
Aggregation
Relationship
Represents whole-part
relationship
Represented by a diamond
symbol at the composite end.
Cannot be reflexive(i.e.
recursive)
Not symmetric
It can be transitive
Aggregation
Relationship
* Paragraph * Line
1
Document 1
Composition
Relationship
Life of item is same as the order
1 *
Order Item
Relationships: Composition
A form of aggregation with strong
ownership and coincident lifetimes
The parts cannot survive the
whole/aggregate
This is a strong form of aggregation
It expresses the stronger coupling
between the classes
KIIT CSE/IT
(OOSD)
Aggregation
cont
* Item Composition
Order
* Item Aggregation
Order
8. AGGREGATION AND OBJECT CONTAINMENT
Engin Whee
Seat
e l
KIIT CSE/IT
(OOSD)
Relationships: Dependency
A relationship between two model
elements where a change in one
may cause a change in the other
Non-structural, using relationship
KIIT CSE/IT
(OOSD)
Relationships:
Generalization
A relationship among classes where one
class shares the structure and/or behavior
of one or more classes
Defines a hierarchy of abstractions in
which a subclass inherits from one or more
superclasses
Single inheritance
Multiple inheritance
Generalization is an is-a-kind of
relationship
KIIT CSE/IT
(OOSD)
Relationships: Realization
One classifier serves as the contract
that the other classifier agrees to
carry out
Found between:
Interfaces and the classifiers that realize
them
KIIT CSE/IT
(OOSD)
The Relationship Between Classes
and Objects
A class is an abstract definition of an
object
It defines the structure and behavior of
each object in the class
It serves as a template for creating
objects
Objects are grouped into classes
KIIT CSE/IT
(OOSD)
Strengths of Object
Orientation
A single paradigm
Facilitates architectural and code reuse
Models more closely reflect the real world
More accurately describe corporate data and
processes
Decomposed based on natural partitioning
Easier to understand and maintain
Stability
A small change in requirements does not mean
massive changes in the system under development
KIIT CSE/IT
(OOSD)
CASE STUDY
Do Self Study of A PAY ROLL
PROGRAM of both Structured
Approach and O-O Approach.
KIIT CSE/IT
(OOSD)