An Introduction to the Object-Orientation
What is Object-Orientation
• A new technology based on objects and classes
• A way of thingking to organizing software as a collection of discrete objects that incorporate both data structure and behaviour
• An abstraction of the real world based on objects and their interactions with other objects
Three Characteristics of OO
Abstraction and Classification :.
o Focusing on essential, inherent aspects of an entity and ignoring its accidental.
o The idea of grouping software ideas into classes of things
Encapsulation and Information Hiding :
o Separating the external aspects of an object, which are accessible to other objects, from the internal implementation details of object, which are hidden from other objects
Polymorphism and Inheritance :
o Ability of abstractions to share properties by inheritance hierarchy.
Object and Classes
An object is a thing or concept. It can be a real-world thing or concept, or an abstraction of a thing or concept expressed as a software representation.
An object has state (attributes) and behavior (method)
“An object has state, behaviour and identity; the structure and behaviour of similar objects are defined by their common class .”
“The state of an object encompasses its (static) properties plus the
... . The child will not consistently look where the object was last seen to disappear, regardless of what ... as soon as anything passes from its experience that thing is no more. However, only a couple of ... way just by closing your eyes. Like most things in life, acquisition of the concept of the ... stage because in it children are occupied with sensing things and moving them. From these activities they learn ...
current (dynamic) values of those properties.”
“The behaviour of an object encompasses how it acts and reacts, in
terms of state changes and message passing.”
“The identity of an object is that property which distinguishes it from
Individual objects, also called instances, have identity and are distinct things, and can be distinguished from other objects.
A class is a description of a collection of objects with common attributes and behavior.
In practice, the definition or specification of a class includes the
definitions of the attributes comprising the state, the methods
implementing the behavior, and how to handle creation and
destruction of an object.
The differences between class and object
• An object is a concrete entity that exists in space and time
A class is an abstraction, the essence of an object
• An object has specific values for its properties
A class describes these properties and the range of possible values
• A class is a type
An object is a variable of the type