Saturday, June 23

Introduction to Object Orientation


Software systems are defined by data and functionality. In a non object oriented system, functionality and data and treated separately. The focus in such a system remains on functionality. On the other hand, object oriented systems data and functionality are combined together using objects. Objects are concrete representation of real world things. So in a object oriented systems, developer need to map real world things with software objects and they need to define functions a of each object in such a manner that it reflects its behavior in the real world.
Typical objects in a SAP software system can be Invoice, Customer, order etc. It is not possible to introduce Object orientation with this small article.
Objects
Objects are formed out of classes. Class is the structure of object. For example, cuckoo belongs to the bird class, Amazon belongs to the river class. Objects have attributes (also called its characteristics) and functions or services. The services of an object work upon the attributes of the object to change the value of attributes. Attributes and services can be private, public or protected.
Classes
As already described, classes are structure of objects. Any number of objects can be formed out of  a class. Each object has its own values of its attributes.
Object References
Object references are not the real objects but their references. So you can very well access data and services of object using its reference.
Abstraction
The implementation of objects is not visible to the users. Users see only the data and services of the object. But how the services manipulate the data is unknown to the user of the object, such feature is called encapsulation. For example : Tata innova and Maruti are objects of the car class and Average is a service of car class. Average returns different value for both these objects. But how it calculates the average of the car if unknown. User only knows the name of the service, the data it takes and the result it gives.
Inheritance
New classes can be formed from existing classes. This feature of object orientation is called inheritance. The new class thus formed is called derived class. Derived class has data and functions of the parent class. But it can overwrite data and functions of the parent class.
Polymorphism
In ABAP Objects, polymorphism is implemented by redefining methods during inheritance and by using constructs called interfaces. Identical methods behave differently in different classes. Polymorphism means same method behaves differently in different classes.
Polymorphism is a great feature of Object oriented technology. Code written using polymorphism is easy to maintain. With polymorphism, the developer writes a general interface and not a concrete implementation. Change in the requirement of  the client can be handled very easily if the program developed has polymorphism feature  in it.

No comments:

Post a Comment

You are welcome to express your views here...