Object-Oriented Programming (OOP), Its Pillars & Its Characteristics

Object-Oriented Programming (OOP), Its Pillars & Its Characteristics

Object-Oriented Programming

Object-Oriented Programming

It is the programming style that is based on the concept of :
1. Class
2. Objects
3. Methods

Class

Real-World Example – Class

Class is the blueprint of an object. It defines the attributes of the objects and what operations can be performed.

Objects
Methods

These are the behaviors of the class which contains the process of any work done.

Pillars or Elements of Object-Oriented Programming

Inheritance is the technique where a new class can be created out of an existing class.

1.Encapsulation,

2. Inheritance,

3. Polymorphism,

4. Abstraction.

Inheritance

A Child class from a Parent class is created such that it inherits the properties and methods of the parent class and can have its own additional properties and methods.

Abstraction

It refers to, providing only essential information to the outside world and hiding their background details and implementation

A real-world example can be a calculator where the results of calculations are shown without showing how it is done.

Types of Abstraction

Data Abstraction: It is the technique in abstraction where fewer details are shown to the outer world. For example, if privacy is strong in someone’s Facebook profile, we are able to see a few details, and the features like about, photos cannot be seen.

Process Abstraction : It is the technique in abstraction where the implementation or functions are not shown to the outer world. While changing gear in a car we don’t have to worry about engine-level mechanics.

Encapsulation

Encapsulation is a process of binding data members (variables, properties) and member functions (methods) into a single unit. It is also a way of restricting access to certain properties or components. The best example of encapsulation is a class.

Encapsulation
Polymorphism
Polymorphism

It is the ability of an object to take many forms. It occurs when a parent class reference is used to refer a child class object.

Advantages & Disadvantages of OOP

Usability of Code :Inheritance allows to re use the parent class codes

Data Security : Abstraction & Encapsulation helps to hide the vulnerable data to the outside world

Real World Models : Through the class , object and methods it is very easy to actualize the real world examples in the code.

Tricky Designs : Some time , it’s hard to design the models of objects and can be a bit tricky

Over Generalised Classes : The design sometimes make the classes over generalized.

Need of Both Coding & Planning skills: The OOP Concept demands a developer with both programming as well as software engineering skills.

Share this on facebook

Subscribe to our Youtube Channel

Leave a comment

Your email address will not be published. Required fields are marked *