Object Oriented Programming Concepts
- Classes
- Objects
- Data Abstraction
- Encapsulation
- Inheritance
- Polymorphism
Class & Object :
A class is a collection of instance variables and methods.
Ex: fruit mango;
class object
For example, mango, apple and orange are members of
the class fruit.
A class is a template or logical structure.
A class is a blue print from which individual objects are created.
Classes are user-defined data types and behave like the
built-in types of a programming language.
Objects are instances of the type class.
Objects are the basic run-time entities in an object oriented
system.
Data Abstraction :
Abstraction refers to the act of representing essential features
without including the background details or explanations.
Abstraction are of two types:
Procedure Abstraction
Data Abstraction
The access specifiers in JAVA or any OOP language, provides data
abstraction.
Encapsulation :
The wrapping up of data and methods into a single unit ( called
class) is known as encapsulation.
That is, the data and methods are given in the class definition.
Data encapsulation is the most striking features of a class.
Inheritance :
Inheritance is the process by which objects of one class acquire
the properties of another class. The concept of inheritance
provides the reusability.
A class can inherit one or more classes. Inherited class is called
as parent class or super class. Class that inherits a parent class is
called as child class or sub class.
Benefits of Inheritance
- Software reusability (among projects) : Functions written once can be
reused. No need to spend time in rewriting the code
- Code sharing (within a project) : Many users and projects can use the
same classes.
- Increased reliability (resulting from reuse and sharing of well-tested
code) : Probability of fewer bugs in already used and tested code.
- Consistency of interface (among related objects) :Guarantees that
interfaces to similar objects are in fact similar and the user is not
presented with a confusing collection of objects
- Rapid prototyping (quickly assemble from pre-existing
components) :Software systems can be generated more quickly
and easily, leading to a style of programming known as rapid
prototyping.
- Polymorphism and frameworks (high-level reusable
components): Polymorphism permits the programmer to
generate high-level reusable components that can be tailored to
fit different applications by changes in their low-level parts.
- Information hiding :Reduces inter connections between
software system thus decreasing software complexity.
Polymorphism
Poly – Many Morph – Form
Polymorphism is the characteristic feature, that enables an entity
to co-exist in more than one form.
Ex: It allows the single method to perform different actions based
on the parameters. JAVA supports method overloading and overriding to implement
polymorphism
Benefits of OOP
OOP CONCEPTS
- Through inheritance, we can eliminate redundant code and extend the
use of existing classes.
- The principle of data hiding helps the programmer to build secure
programs that cannot be invaded by code in the parts of the program.
- It is easy to partition the work in a project based on objects.
- Object oriented system easily upgraded from small to large systems.
- Software complexity can be easily managed.
Applications of OOP
- Real-time systems.
- Object-Oriented Databases.
- Neural Networks and Parallel Programming.
- Decision Support and Office Automation Systems
Encapsulation :
The wrapping up of data and methods into a single unit ( called class) is known as encapsulation.
That is, the data and methods are given in the class definition.
Data encapsulation is the most striking features of a class.
Inheritance :
Inheritance is the process by which objects of one class acquire the properties of another class. The concept of inheritance provides the reusability.
A class can inherit one or more classes. Inherited class is called as parent class or super class. Class that inherits a parent class is called as child class or sub class.
Benefits of Inheritance
- Software reusability (among projects) : Functions written once can be reused. No need to spend time in rewriting the code
- Code sharing (within a project) : Many users and projects can use the same classes.
- Increased reliability (resulting from reuse and sharing of well-tested code) : Probability of fewer bugs in already used and tested code.
- Consistency of interface (among related objects) :Guarantees that interfaces to similar objects are in fact similar and the user is not presented with a confusing collection of objects
- Rapid prototyping (quickly assemble from pre-existing components) :Software systems can be generated more quickly and easily, leading to a style of programming known as rapid prototyping.
- Polymorphism and frameworks (high-level reusable components): Polymorphism permits the programmer to generate high-level reusable components that can be tailored to fit different applications by changes in their low-level parts.
- Information hiding :Reduces inter connections between software system thus decreasing software complexity.
Polymorphism
Poly – Many Morph – Form
Polymorphism is the characteristic feature, that enables an entity to co-exist in more than one form.
Ex: It allows the single method to perform different actions based on the parameters. JAVA supports method overloading and overriding to implement polymorphism
Benefits of OOP OOP CONCEPTS
- Through inheritance, we can eliminate redundant code and extend the use of existing classes.
- The principle of data hiding helps the programmer to build secure programs that cannot be invaded by code in the parts of the program.
- It is easy to partition the work in a project based on objects.
- Object oriented system easily upgraded from small to large systems.
- Software complexity can be easily managed. Applications of OOP
- Real-time systems.
- Object-Oriented Databases.
- Neural Networks and Parallel Programming.
- Decision Support and Office Automation Systems