Object-Oriented Programming (OOPs) Concepts : Intermediate Level





In this post we will learn about the pillars of object-oriented programming, we will understand what these pillars are, what these pillars accomplish, and why having these concepts based on the methodology is advantageous.

The basic concepts or pillars of object-oriented programming.

1. Objects

2. Classes

3.
 Abstraction

4. Encapsulation

5. Inheritance

6. Polymorphism


So what does the basic concept wording mean here?

It means the properties or concepts on which object-oriented programming works.
Remember it isn't strictly speaking, something on which oops is built upon because that is objects and classes.



Abstraction

To understand abstraction is to understand the fact that when working with a function or a class, there is a distinction made between the interface of the said function or class and its internal working or implementation.

Abstraction works on the idea that the "Understanding" or the "process" by which a program works can be hidden from unauthorized users.

The process of "abstraction" in object-oriented programming "abstracts" the implementation details of the class, resulting in an interface akin to a "black box" that solves the issue timely without concern over the underline working of the said solution.

In the coding, this aspect of programming is seen when a function from a class whether static or not is called, the details as to the internal implementations are "abstracted" that is not revealed and only the function is called which performs the necessary task and provides the output.

So we can conclude that abstraction does the following 

1. Eases complexity

2. Decreases issues related to maintenance 

3. Increases confidentiality and security aspects 


Encapsulation

Encapsulation can be summarized as the "wrapping" or "encapsulating" of data into a single commodity or unit.

By encapsulation, you bind the data of the objects (attributes, values, and properties) and the member functions (the methods of the class) to the code, essentially the variables of the class, the instance variables, and the member functions or methods of the class (those that are not public) are hidden from any other class.

The data stored in this class cannot be accessed directly but through the member methods of the class.
It can also be considered as a way to restrict access to components within the class.


Inheritance

Inheritance is another fundamental that is very important in the context of object-oriented programming.

Inheritance can be understood as the ability to "provide inheritance" or to "pass on" or to "acquire" properties of/from a class to another class.

When a class inherits from another class, it means that we do not have to write all the functions and details again, this reduces redundancy and provides reusability to the code.


Polymorphism

Polymorphism means many forms, derived from the word poly meaning many and morph meaning form.

Just like a person can have many different forms to just one task, for example, a person can be a father, a husband, a friend, a mentor, an employee, an employer, and so on so forth.
This real-life scenario is painted as polymorphism in the object-oriented programming methodology through function overloading and operator overloading.


We will be learning more about these and other additional features & concepts of object-oriented programming later.

Post a Comment

Previous Post Next Post