Before discussing the difference between Object-Oriented ABAP and Function module, let’s have a short introduction of the two.
Table of Contents
Object-Oriented ABAP or OOABAP is the object-oriented extension of ABAP, which mainly focuses on the classes and object rather than the code flow. An object-oriented approach enables programmers to think like they are working with real-life entities.
The Object-Oriented concept of ABAP mainly revolves around the classes and objects, which are the basic elements of OOABAP. A class is like a blueprint of an object or a template that binds similar kinds of data. It defines the characteristics of an object. An object is a working entity of a class. Each object is unique at its own, meaning with unique identity and attributes. Attributes define the state of an object whereas the behavior of an object refers to the changes that occur in its attributes over some time.
The three pillars of OOABAP are:
Encapsulation: It is a concept of preventing the data from being arbitrarily accessed by some other outside interference or protects the data from being misused.
Polymorphism: It allows overwriting some functionality.
Inheritance: It allows a sub class or a child class to inherit the properties from a parent class.
The classical approach where the ABAP program consists of program blocks and is executed sequentially is known as the Procedural Programming model. Function modules are one of the techniques that separate the functionality of the program into independent, interchangeable modules, such that each contains everything necessary to execute only one aspect of the desired functionality.
This technique improves the readability and maintainability of ABAP programs as well as incorporates the reusability of functions.
Difference between Object-Oriented ABAP and Function module
Now, let’s have a look at their difference.
|It is object-oriented.||It is procedural oriented.|
|It uses objects and classes.||It contains a block of code for a specific functionality|
|It is a bottom-up approach.||It is a top-down approach.|
|Inheritance is possible.||Inheritance is not possible.|
|Polymorphism is possible.||Polymorphism is not possible.|
|Have access specifiers: Private, public, and Protected.||Does not have any access specifier.|