Showing Page:
1/4
CHARACTERISTICS OF OOP
Object Oriented Programming (OOP) is an approach to program organization and development that attempts
to eliminate some of the pitfalls of conventional programming methods by incorporating the best of
structured programming features with several powerful new concepts.
It is necessary to understand some of the basic concepts used extensively in object-oriented
programming. These include:
Objects
Classes
Abstraction
Encapsulation
Inheritance
Polymorphism
Dynamic binding
Message passing
We shall discuss these concepts in some detail in this section.
Objects
Objects are the basic run time entities in an object-oriented system. They may represent a person, a place, a
bank account, a table of data or any item that the program has to handle.
Objects are characterized by three essential properties:
1. State: represents data (value) of an object.
2. Behaviour: represents the behaviour (functionality) of an object(implemented as methods).
3. Identity: it is used to identify each object uniquely. The identity of an object distinguishes one object
from another.
Some things are not objects, but are attributes; e.g. age, color. An attribute is a specification that defines a
property of an object, element, or file. It may also refer to or set the specific value for a given instance of
such.
Classes
Class can be considered as the blueprint or a template for an object and describes the properties and
behaviour of that object, but without any actual existence. An object is a particular instance of a class which
has actual existence. Once a class has been defined, we can create any number of objects belonging to that
class. Each object is associated with the data of type class with which they are created. A class is thus a
collection of objects similar types. For examples, Mango, Apple and orange members of class fruit.
Abstraction
Abstraction refers to the act of representing essential features without including the background details or
explanation. To understand this concept more clearly, take an example of 'switch board'. You only press
particular switches as per your requirement. You need not know the internal working of these switches.
What is happening inside is hidden from you. This is abstraction, where you only know the essential things
to operate on switch board without knowing the background details of switch board.
Encapsulation
The wrapping up of data(properties) and function(behaviour) into a single unit (called class) is known as
encapsulation. Data encapsulation is the most striking feature of a class. The data is not accessible to the
outside world, and only those functions which are wrapped in the class can access it. These functions
provide the interface between the object’s data and the program. This insulation of the data from direct
access by the program is called data hiding or information hiding. For example - in school, a student cannot
exist without a class.
Inheritance
Inheritance is the process by which objects of one class acquired the properties and behaviours of objects of
another classes. It supports the concept of hierarchical classification. It is the capability to define a new
class in terms of an existing class. An existing class is known as a base class or parent class or super class
and the new class is known as derived class or child class or sub class.
Showing Page:
2/4
Inheritance describes the parent child relationship between two classes. A class can get some of its
characteristics from a parent class and then add more unique features of its own. For example, consider a
Vehicle parent class and a child class Car. Vehicle class will have properties and functionalities common for
all vehicles. Car will inherit those common properties from the Vehicle class and then add properties which
are specific to a car. In this example, Vehicle parent class is known as base class or superclass. Car is known
as derived class, child class or subclass.
In OOP, the concept of inheritance provides the idea of reusability. This means that we can add additional
features to an existing class without modifying it. This is possible by deriving a new class from the existing
one. The new class will have the combined feature of both the classes.
Property Inheritance
Polymorphism
Polymorphism is another important OOP concept. Polymorphism means the ability of a variable, object or
function to take more than one form. An operation may exhibit different behaviour in different instances.
The behaviour depends upon the types of data used in the operation. Let us consider the operation of
addition. For two numbers, the operation will generate a sum. If the operands are strings then the operation
would produce a third string by concatenation.
Objects are allowed to take on more than one form depending on the context. The program will determine
which meaning or usage is necessary for each execution of that object, cutting down on the need to duplicate
code. Java supports different kinds of polymorphism like overloading and overriding.
Overloading: The same method name (method overloading) or operator symbol (operator
overloading) can be used in different contexts. The process of making an operator to exhibit different
behaviours in different instances is known as operator overloading. Using a single function name to
perform different type of task is known as function(method) overloading. Overloading may be also
called compile time polymorphism.
Overriding: We can override an instance method of parent class in the child class. When you refer to
a child class object using a Parent reference (e.g. Parent p = new Child()) and invoke a method, the
overridden child class method will be invoked. Here, the actual method called will depend on the
object at runtime, not the reference type. Overriding may be also called runtime polymorphism.
Showing Page:
3/4
Polymorphism plays an important role in allowing objects having different internal structures to share the
same external interface. This means that a general class of operations may be accessed in the same manner
even though specific action associated with each operation may differ. Polymorphism is extensively used in
implementing inheritance.
Modularity
The act of partitioning a program into individual components is called modularity. It gives the following
benefits.
It reduces its complexity to some extent.
It creates a number of well-defined, documented boundaries within the program.
Module is a separate unit in itself. It can be compiled independently though it has links with other modules.
Modules work quite closely in order to achieve the program’s goal.
Dynamic Binding
Binding refers to the linking of a procedure call to the code to be executed in response to the call. Dynamic
binding means that the code associated with a given procedure call is not known until the time of the call at
run time. It is associated with polymorphism and inheritance. A function call associated with a polymorphic
reference depends on the dynamic type of that reference.
Consider the procedure “draw” in figure by inheritance; every object will have this procedure. Its algorithm
is, however, unique to each object and so the draw procedure will be redefined in each class that defines the
object. At run-time, the code matching the object under current reference will be called.
Message Passing
An object-oriented program consists of a set of objects that communicate with each other. The process of
programming in an object-oriented language, involves the following basic steps:
1. Creating classes that define object and their behaviour,
2. Creating objects from class definitions, and
3. Establishing communication among objects.
Objects communicate with one another by sending and receiving information much the same way as people
pass messages to one another. The concept of message passing makes it easier to talk about building systems
that directly model or simulate their real-world counterparts.
A Message for an object is a request for execution of a procedure, and therefore will invoke a function
(procedure) in the receiving object that generates the desired results. Message passing involves specifying
the name of object, the name of the function (message) and the information to be sent.
Example:
Employee. Salary (name);
Showing Page:
4/4
A method call is also known as message passing. It is conceptualized as a message (the name of the method
and its input parameters) being passed to the object for dispatch.

Unformatted Attachment Preview

CHARACTERISTICS OF OOP Object Oriented Programming (OOP) is an approach to program organization and development that attempts to eliminate some of the pitfalls of conventional programming methods by incorporating the best of structured programming features with several powerful new concepts. It is necessary to understand some of the basic concepts used extensively in object-oriented programming. These include: • Objects • Classes • Abstraction • Encapsulation • Inheritance • Polymorphism • Dynamic binding • Message passing We shall discuss these concepts in some detail in this section. Objects Objects are the basic run time entities in an object-oriented system. They may represent a person, a place, a bank account, a table of data or any item that the program has to handle. Objects are characterized by three essential properties: 1. State: represents data (value) of an object. 2. Behaviour: represents the behaviour (functionality) of an object(implemented as methods). 3. Identity: it is used to identify each object uniquely. The identity of an object distinguishes one object from another. Some things are not objects, but are attributes; e.g. age, color. An attribute is a specification that defines a property of an object, element, or file. It may also refer to or set the specific value for a given instance of such. Classes Class can be considered as the blueprint or a template for an object and describes the properties and behaviour of that object, but without any actual existence. An object is a particular instance of a class which has actual existence. Once a class has been defined, we can create any number of objects belonging to that class. Each object is associated with the data of type class with which they are created. A class is thus a collection of objects similar types. For examples, Mango, Apple and orange members of class fruit. Abstraction Abstraction refers to the act of representing essential features without including the background details or explanation. To understand this concept more clearly, take an example of 'switch board'. You only press particular switches as per your requirement. You need not know the internal working of these switches. What is happening inside is hidden from you. This is abstraction, where you only know the essential things to operate on switch board without knowing the background details of switch board. Encapsulation The wrapping up of data(properties) and function(behaviour) into a single unit (called class) is known as encapsulation. Data encapsulation is the most striking feature of a class. The data is not accessible to the outside world, and only those functions which are wrapped in the class can access it. These functions provide the interface between the object’s data and the program. This insulation of the data from direct access by the program is called data hiding or information hiding. For example - in school, a student cannot exist without a class. Inheritance Inheritance is the process by which objects of one class acquired the properties and behaviours of objects of another classes. It supports the concept of hierarchical classification. It is the capability to define a new class in terms of an existing class. An existing class is known as a base class or parent class or super class and the new class is known as derived class or child class or sub class. Inheritance describes the parent child relationship between two classes. A class can get some of its characteristics from a parent class and then add more unique features of its own. For example, consider a Vehicle parent class and a child class Car. Vehicle class will have properties and functionalities common for all vehicles. Car will inherit those common properties from the Vehicle class and then add properties which are specific to a car. In this example, Vehicle parent class is known as base class or superclass. Car is known as derived class, child class or subclass. In OOP, the concept of inheritance provides the idea of reusability. This means that we can add additional features to an existing class without modifying it. This is possible by deriving a new class from the existing one. The new class will have the combined feature of both the classes. Property Inheritance Polymorphism Polymorphism is another important OOP concept. Polymorphism means the ability of a variable, object or function to take more than one form. An operation may exhibit different behaviour in different instances. The behaviour depends upon the types of data used in the operation. Let us consider the operation of addition. For two numbers, the operation will generate a sum. If the operands are strings then the operation would produce a third string by concatenation. Objects are allowed to take on more than one form depending on the context. The program will determine which meaning or usage is necessary for each execution of that object, cutting down on the need to duplicate code. Java supports different kinds of polymorphism like overloading and overriding. • Overloading: The same method name (method overloading) or operator symbol (operator overloading) can be used in different contexts. The process of making an operator to exhibit different behaviours in different instances is known as operator overloading. Using a single function name to perform different type of task is known as function(method) overloading. Overloading may be also called compile time polymorphism. • Overriding: We can override an instance method of parent class in the child class. When you refer to a child class object using a Parent reference (e.g. Parent p = new Child()) and invoke a method, the overridden child class method will be invoked. Here, the actual method called will depend on the object at runtime, not the reference type. Overriding may be also called runtime polymorphism. Polymorphism plays an important role in allowing objects having different internal structures to share the same external interface. This means that a general class of operations may be accessed in the same manner even though specific action associated with each operation may differ. Polymorphism is extensively used in implementing inheritance. Modularity The act of partitioning a program into individual components is called modularity. It gives the following benefits. • It reduces its complexity to some extent. • It creates a number of well-defined, documented boundaries within the program. Module is a separate unit in itself. It can be compiled independently though it has links with other modules. Modules work quite closely in order to achieve the program’s goal. Dynamic Binding Binding refers to the linking of a procedure call to the code to be executed in response to the call. Dynamic binding means that the code associated with a given procedure call is not known until the time of the call at run time. It is associated with polymorphism and inheritance. A function call associated with a polymorphic reference depends on the dynamic type of that reference. Consider the procedure “draw” in figure by inheritance; every object will have this procedure. Its algorithm is, however, unique to each object and so the draw procedure will be redefined in each class that defines the object. At run-time, the code matching the object under current reference will be called. Message Passing An object-oriented program consists of a set of objects that communicate with each other. The process of programming in an object-oriented language, involves the following basic steps: 1. Creating classes that define object and their behaviour, 2. Creating objects from class definitions, and 3. Establishing communication among objects. Objects communicate with one another by sending and receiving information much the same way as people pass messages to one another. The concept of message passing makes it easier to talk about building systems that directly model or simulate their real-world counterparts. A Message for an object is a request for execution of a procedure, and therefore will invoke a function (procedure) in the receiving object that generates the desired results. Message passing involves specifying the name of object, the name of the function (message) and the information to be sent. Example: Employee. Salary (name); A method call is also known as message passing. It is conceptualized as a message (the name of the method and its input parameters) being passed to the object for dispatch. Name: Description: ...
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.
Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4