Everything is an object and is an object of some generic type which is nothing but the class. Their behavior is defined by different methods. These are three key words in understanding Object Oriented Programming.

For example – Car is a generic way to define (most of) the four wheelers. Car in this example is a class. Jack drives a Chevy Cobalt. Jack’s Cobalt is an object. Mileage is defined by miles driven divided by oil consumption. So, if Jack provides the specifics of miles driven and oil consumed by his car, we can accurately determine his car’s mileage. Mileage is method. Similarly, Bob drives a GT. He can also find his car’s mileage by using the method. So, can Ted and Joe.

If you are new to OOP, then initially you will face some issues with the philosophy of Object Oriented Programming. It’s very different form Procedural Programming and is a must have in skill set because more and more projects are focusing on Objects as a concept.

Three major concepts in OOPS are –

  1. Encapsulation
  2. Inheritance
  3. Polymorphism

Why OOP is such an important concept? Well, ABAP was created as a procedural language which was mainstay of any language of the time. With advent and rise of JAVA, OOP came to fore as the next stage of evolution. ABAP adopted OOP and the ease of programming brought OOP in the spotlight.

Code is highly reusable. Properties of a class are transferable. The transferred properties can be redefined to accommodate changing requirements without hurting the properties of original class. This reduces maintenance effort.

In the above example, trucks can inherit properties of car and add more properties specific to trucks. Now, Lyndon can drive a RAM 2500 without worrying that any change in his class Truck would have any impact on properties of Jack’s Chevy.

Data hiding is another huge advantage with OOP.


PS: Scott Ambler’s The Object Primer is an amazing book. Get an old version and keep it handy. Apart from OOP, it touches upon UML which is a great concept to get acquainted with.