What is Object Oriented Programming?

What is Object Oriented Programming (OOP)?

Object Oriented programming is a programming paradigm wherein all information is stored within the object and all ‘actions’ are performed by the objects. In the first tutorial, we explained the concept of Objects and classes. We defined “class” as a template that stores information about the state(customer’s name, address etc) and operations that an entity can perform (ordering a dish). “Object” was defined  as the actual implementation of “class”. This tutorial introduces Object Oriented Programming and lays down its main features that we will explore in details in the following tutorials.

What are the principles of Object Oriented Programming?

The four basic principles of Object oriented programming are Encapsulation, Abstraction, Inheritance, and Polymorphism. New-comers to Object Oriented Programming are generally overwhelmed by these terms, however, they will become obvious once you start coding and spend a few months with the language. The key is to start thinking in terms of ‘who’ instead of ‘what’.  Therefore, when you start writing a program, start thinking about who (which object) will contain the algorithm or logic that prompted you to write the program. To stimulate the thinking process, here’s a problem.
How would you begin writing a program that adds two numbers? Seems easy right? a=b+c is all that you want to write. But when you are writing with java, the first thing you ask yourself is ‘who’ is going to perform the addition? A Mathematician perhaps….

public class Mathematician {
  public static double performAddition(double a, double b) {
      return a+b;

As an exercise think of a couple of more programs that you would like to write and start thinking in terms of the ‘who’ would be responsible for the logic for the programs and ‘who’ would have the information required. Next, we look at the first principle of Object Oriented Programming – Inheritance

Leave a Comment