SAP ABAP - Object Orientation
Object orientation simplifies software design to make it easier to understand, maintain, and reuse. Object Oriented Programming (OOP) represents a different way of thinking in writing software. The beauty of OOP lies in its simplicity. The expressiveness of OOP makes it easier to deliver quality software components on time.
As solutions are designed in terms of real-world objects, it becomes much easier for programmers and business analysts to exchange ideas and information about a design that uses a common domain language. These improvements in communication help to reveal hidden requirements, identify risks, and improve the quality of software being developed. The object-oriented approach focuses on objects that represent abstract or concrete things of the real world. These objects are defined by their character and properties that are represented by their internal structure and their attributes (data). The behavior of these objects is described by methods (i.e. functionality).
Let’s compare the procedural and object oriented programming −
|Features||Procedure Oriented approach||Object Oriented approach|
|Emphasis||Emphasis is on tasks.||Emphasis is on things that does those tasks.|
|Modularization||Programs can be divided into smaller programs known as functions.||Programs are organized into classes and objects and the functionalities are embedded into methods of a class.|
|Data security||Most of the functions share global data.||Data can be hidden and can’t be accessed by external sources.|
|Extensibility||This is more time consuming to modify and extend the existing functionality.||New data and functions can be added effortlessly as and when required.|
ABAP was initially developed as a procedural language (just similar to earlier procedural programming language like COBOL). But ABAP has now adapted the principles of object oriented paradigms with the introduction of ABAP Objects. The object-oriented concepts in ABAP such as class, object, inheritance, and polymorphism, are essentially the same as those of other modern object-oriented languages such as Java or C++.
As object orientation begins to take shape, each class assumes specific role assignments. This division of labor helps to simplify the overall programming model, allowing each class to specialize in solving a particular piece of the problem at hand. Such classes have high cohesion and the operations of each class are closely related in some intuitive way.
The key features of object orientation are −
- Effective programming structure.
- Real-world entities can be modeled very well.
- Stress on data security and access.
- Minimizes code redundancy.
- Data abstraction and encapsulation.