Object Oriented Programming

Object Oriented Programming is a programming style in which the program is made with components which match to real world objects. Any real world object, has some properties (which may or may not change over time) and some behavior (which may or may not depend on other conditions).
e.g. A pencil is a real world object; which has the following properties:
  1.  It is red in colour (will not change with time)
  2.  It is 10 cm in length as of now (may change when sharpen) 
And it has the following behaviors:
  1. It leaves mark when used properly. 
  2. The mark may vary depending upon the pressure applied and nib thickness. (Depends upon external factor)
  3. Its length gets reduced when sharpened (constant behavior)
 PS: This is just an example, It may have more properties and behaviors which are omitted to keep it simple.

The advantages of using objects in programming world is all Objects know about there properties and behavior. This is helpful when different objects interact with each other. Keeping this relation in mind helps developer understand the requirements better and program efficiently, as they can nor relate the soft code to real world. The interaction between different objects is also similar to real world. If other objects know that a behavior or property exists, they need not know what exactly the behavior should be (one controls oneself).

Another important feature associated with OOP (Object Oriented Programming) is classification of objects. Since real world (and real world programs) is full of objects, it will be difficult to manage them as individuals. With the introduction of objects, we need a way to classify (or order) these objects which will help us know how objects are related to each other and how can an object be created when required. e.g. a pen, which is very similar to a pencil is another object is also present. But a pen, is not a pencil. They are different but related. We can classify them both as "Writing Instruments" Simply by classifying pen and pencil in a group called "Writing Instruments" we have simplified our life a lot Now we know, both of them will at least have a "Writing behavior" We don't need to know "How" they write as "pen" or "pencil" themselves are aware how to write. Apart from this, there are a few major features of Object Oriented Programming technique which we would be discussing soon
  • Inheritance 
  • Abstraction 
  • Polymorphism 
  • Encapsulation