Saturday, March 11, 2017

It's All About Object Oriented Programming (OOP / OOPS)

Hello and welcome to next post of the series "Freshers to Professional" blog. In case you missed previous blogs, you can read here.

Part 1 : Because All The Leaders Were Developers Once
Part 2 : Some of the Greatest Programmers of All Time
Part 3 : How to be a Good Developer and Professional

Now we will cover some of the basic fundamentals that you should be clear with, when you start your carrier as fresher. In this post we will see about Object Oriented Programming commonly referred as OOP or OOPS.

This is most important fundament of software engineering now a days. When I interview a freshers of the post of the developers, this is my first question to them. "Tell me Three Main Principles of Object Oriented Programming". When someone fails to answer this question, I do not go further in interview and let them go. In my opinion every fresher should know about concepts of OOP. That's the crux of software development. Now a days no matter what language you use, all of them supports OOP. Be it JavaScript, PHP, C# or Java or anything all of them support OOP only implementation if different and if you are clear with fundamentals of OOP then you can implement in any of the languages. As fresher this is what is expected from you and that's why language like C++ and Java is included in almost all the courses of Computer science.

During my tenure in IT industry, I have interviewed many freshers and very few time I get satisfactory answer on concept of OOP. Some freshers knows only the name of concept but they can not explain it further. Some of them can explain it but with great confusion. When I ask them why they don't know about it, they say "We think it's not important" Now that's the biggest mis understanding. OOP is followed in most of the development in business applications. So you should be clear with fundamentals of OOP.

Why OOP was introduced?

Object oriented programming concept was created because of the need to overcome the problems that were found with using structured programming techniques. In earlier days programmers used to write many lines of code because OOP was not there. With the the OOP number of lines of codes is reduced because it makes your code reusable and easy to maintain. Any business application is going to change over the period of time and these changes should be easy to do. With OOP it is possible now. Major frameworks are built on concept of OOP and when you are using that framework, you should be knows how the OOP is used in there. Then only you will be able to work with it. Major software design patterns like MVC also works on OOP.  So no matter what language you use, OOP is involved in it. So it is required that you understand OOP concepts and use it in your work.

Also there are other advantages of OOP

  • Code Reusability
  • OOP  provides a clear modular structure for programs
  • OOP makes it easy to maintain and modify existing code 

Now lets see the three main principles of OOP.

Abstraction / Data Encapsulation / Data Hiding

Encapsulation is an Object Oriented Programming concept that binds together the data and functions that manipulate the data, and that keeps both safe from outside interference and misuse. Implementation details of a class are kept hidden from the user. The user can only perform a restricted set of operations on the hidden members of the class by executing special functions commonly called methods.

So for the simple example, when you implement a class and define private members of the class, those members will be accessible only inside of the class. If you want to expose some of the functions and members to outside world, it will be declared as public. Here are some of the key things related to Abstraction / Data Encapsulation

  • Class
  • Abstract Class
  • Static Class
  • Static Methods
  • Modifiers like public, private
  • Constructor
  • Friend Functions

I will not give details about it as there are tons of articles available over the internet.


One of the most important concepts in object-oriented programming is that of inheritance. Inheritance allows us to define a class in terms of another class, which makes it easier to create and maintain an application. This also provides an opportunity to reuse the code functionality and fast implementation time. When creating a class, instead of writing completely new data members and member functions, the programmer can designate that the new class should inherit the members of an existing class. This existing class is called the base class, and the new class is referred to as the derived class.

Here are some the key things related to Inheritance.

  • Single Inheritance
  • Multiple Inheritance
  • Multilevel Inheritance
  • Hybrid Inheritance
  • Overriding
  • Modifiers


Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object. One function with different parameters is also referred as polymorphism. Polymorphism usually comes to picture when we use inheritance and when we have parent and child class relationship.

Here are some the key things related to Inheritance.

  • Method Overriding
  • Method Overloading

So learn about OOP understand it's principles and other related stuff mentioned above if you want to establish yourself as good developer.

No comments:

Post a Comment