[go: up one dir, main page]

0% found this document useful (0 votes)
92 views12 pages

Object-Oriented Analysis Basics

This document discusses the key concepts of object-oriented analysis and design including objects, classes, inheritance, interfaces, polymorphism, overloading, overriding, and encapsulation. An object has state, behavior, and identity. Classes define common properties and behaviors for objects. Inheritance allows subclasses to inherit attributes and behaviors from superclasses. Interfaces define behaviors without implementation. Polymorphism allows different types of objects to respond to the same message differently. Overloading and overriding determine which method is called based on parameters or subclass definition. Encapsulation hides implementation details and allows changes without affecting other code.

Uploaded by

Muzammil Basha
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)
92 views12 pages

Object-Oriented Analysis Basics

This document discusses the key concepts of object-oriented analysis and design including objects, classes, inheritance, interfaces, polymorphism, overloading, overriding, and encapsulation. An object has state, behavior, and identity. Classes define common properties and behaviors for objects. Inheritance allows subclasses to inherit attributes and behaviors from superclasses. Interfaces define behaviors without implementation. Polymorphism allows different types of objects to respond to the same message differently. Overloading and overriding determine which method is called based on parameters or subclass definition. Encapsulation hides implementation details and allows changes without affecting other code.

Uploaded by

Muzammil Basha
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/ 12

Object-Oriented Analysis and Design

Introduction
Cutajar
&
Cutajar
What is an Object?
An object has…
 State
◦ Changes over time
 Behavior
◦ What the object does in response to messages
 Identity
◦ What makes the object unique
Cutajar
&
Cutajar
State
Not only do these people look different, they have different properties (also
called attributes) that let us tell one from the other. Some of the properties
that a person might have are name, age, height, and so on. Some of these,
like age, might change (are mutable) and some, like name, might never
change (are immutable)..

John Maria
Age: 32 Age: 35
Height: 6’ 2” Height: 5’ 10”
Cutajar
&
Cutajar Jane Joe
Age: 21 Age: 35
Height: 5’ 8” Height: 5’ 10”
Behavior
sit! Behavior is what the object can
do. That is, the effect of the
object responding to a message
or a call to a method.

return BONE! Some methods


return something
to the caller

Cutajar eat(drumstick)
& I said SIT!
Cutajar
Some methods
need something
from the caller
Identity

Cutajar
&
Cutajar Usually, one can tell one object from another through some
combination of the properties. In fact, there MUST be some way
of telling one object from another. Java uses the object’s
address.
Classes
 Define the properties and behavior of objects
 Can have behavior and properties that are defined in the class but are
independent of the individual objects

Cutajar
&
Cutajar
Inheritance Object-oriented languages support
some type of inheritance. Many
support inheritance from more
than one parent class. This is
Human (Super Class)
called multiple inheritance. Java
having common
supports only single inheritance,
attributes and
but allows a class to implement
behaviors
multiple interfaces.

Multiple
inheritance
Cutajar
not
& permitted
Cutajar Male in Java
Female Baby

Subclasses inherit common features and changes or adds some of their own
Interface

Cutajar
&
Cutajar A Class can implement
various interfaces and
must define methods
used for that interface
Polymorphism
 Different type of objects can respond to the same message
 The actual method that executes is not determined until run time
◦ Dynamic (or late) binding
PLAY !

Cutajar
&
Cutajar
Overloading
 The method which the object performs is determined by the type and
number of parameters passed to it.

play(radio)

Cutajar
& play(guitar)
Cutajar

play(piano)
Overriding
 The method in a subclass
hides the method in the
super class. This permits a
redefinition of a method
I know how it according to the particular
should be done needs of the subclass

overriding overriding

I know how I know how


boys do it. girls do it.

Cutajar
&
Cutajar
Encapsulation
We are hiding the implementation details of
a behavior. The way an object responds to
a message is not exposed, just the fact
that it can respond and the result type
(response). One of the biggest advantages
of O-O is the ability to make changes to an
object’s implementation without affecting
other parts of the program.

How did he do
that ?
Cutajar
&
Cutajar

You might also like