2.09.2010

Object Orientation | Its Uses

What is Object Orientation?

In the past, information systems used to be defined primarily by their functionality: data and functions were kept separate and linked together by means of input and output relations.

The object-oriented approach, however, focuses on objects that represent abstract or concrete things of the real world. These objects are first defined by their character and their properties which are represented by their internal structure and their attributes (data). The behaviour of these objects is described by methods (functionality).

Objects form a capsule which combines the character to the respective behaviour. Objects should enable programmers to map a real problem and its proposed software solution on a one-to-one basis. Typical objects in a business environment are, for example, ‘Customer’, ‘Order’, or ‘Invoice’. From Release 3.1 onwards, the Business Object Repository (BOR) of SAP Web Applicaton Server ABAP has contained examples of such objects. The BOR object model will be integrated into ABAP Objects in the next Release by migrating the BOR object types to the ABAP class library. A comprehensive introduction to object orientation as a whole would go far beyond the limits of this introduction to ABAP Objects. This documentation introduces a selection of terms that are used universally in object orientation and also occur in ABAP Objects. In subsequent sections, it goes on to discuss in more detail how these terms are used in ABAP Objects. The end of this section contains a list of further reading, with a selection of titles about object orientation.

Objects

Objects are instances of classes. They contain data and provides services. The data forms the attributes of the object. The services are known as methods (also known as operations or functions). Typically, methods operate on private data (the attributes, or state of the object), which is only visible to the methods of the object. Thus the attributes of an object cannot be changed directly by the user, but only by the methods of the object. This guarantees the internal consistency of the object.
Classes

Classes describe objects. From a technical point of view, objects are runtime instances of a class. In theory, you can create any number of objects based on a single class. Each instance (object) of a class has a unique identity and its own set of values for its attributes.

Object References

In a program, you identify and address objects using unique object references. Object references allow you to access the attributes and methods of an object. In object-oriented programming, objects usually have the following properties:
Encapsulation

Objects restrict the visibility of their resources (attributes and methods) to other users. Every object has an interface, which determines how other objects can interact with it. The implementation of the object is encapsulated, that is, invisible outside the object itself. Inheritance You can use an existing class to derive a new class. Derived classes inherit the data and methods of the superclass. However, they can overwrite existing methods, and also add new ones.
Polymorphism

Identical (identically-named) methods behave differently in different classes. In ABAP Objects, polymorphism is implemented by redefining methods during inheritance and by using constructs called interfaces.
Uses of Object Orientation

Below are some of the advantages of object-oriented programming: · Complex software systems become easier to understand, since object-oriented structuring provides a closer representation of reality than other programming techniques. · In a well-designed object-oriented system, it should be possible to implement changes at class level, without having to make alterations at other points in the system. This reduces the overall amount of maintenance required. · Through polymorphism and inheritance, object-oriented programming allows you to reuse individual components. · In an object-oriented system, the amount of work involved in revising and maintaining the system is reduced, since many problems can be detected and corrected in the design phase.
Achieving these goals requires:

· Object-oriented programming languages

Object-oriented programming techniques do not necessarily depend on object-oriented programming languages. However, the efficiency of object-oriented programming depends directly on how object-oriented language techniques are implemented in the system kernel.

· Object-oriented tools

Object-oriented tools allow you to create object-oriented programs in object-oriented languages. They allow you to model and store development objects and the relationships between them.

· Object-oriented modeling

The object-orientation modeling of a software system is the most important, most time-consuming, and most difficult requirement for attaining the above goals. Object-oriented design involves more than just object-oriented programming, and provides logical advantages that are independent of the actual implementation.
read more...

SAP Object and Properties | Polymorphism | Inheritance | Encapsulation

Object Introduction

ABAP Objects has appeared with the version 4.0. of R/3 and has never stopped maturing since that time. It has now reached a level that makes it a real object oriented programming language that is worth learning. So if you are ready to see what this great technology is about, take a big breath and go on reading.
What is ABAP Objects

ABAP Objects stands for Object oriented ABAP. Compared to the traditional ABAP programming language, ABAP Objects represents an extension of ABAP that provides the language with the tools to support the object oriented programming paradigm.



What is object oriented programming?

To anyone who doesn’t know what object oriented programming is, the object orientation terminology might sound like it is yet another fancy concept that doesn’t serve any real purpose nor provide any real added value just like too many other concepts in computer sciences. More recent than the traditional procedural programming model in which the source code is arranged in procedures to help achieve some level of modularity, the object oriented programming builds on the basics of the existing procedural programming model to propose a radically more sophisticated and comprehensive programming model.

This model lets the analyst-programmer implement complex systems made up of numerous objects linked together or not and control the interactions between these objects. This characteristic of the object programming language constitutes a definitive advantage other traditional programming techniques as it becomes much easier to solve complex problems. As you have already understood, the notion of Object is at the center of the model. It is voluntarily a very general notion as its aim is to describe anything that has properties and functions. In this sense, the terminology object is not yet abstract enough because it bears some idea of concreteness while an object in the sense of object oriented programming might very well represent abstract things. In fact the notion of Object could have been advantageously replaced with the notion of Concept as the programming model we are going to see is able to manipulate any kinds of concepts and to make actual representations of them.
The object oriented programming model has three major characteristics. It assumes support for:
1. Encapsulation
2. Inheritence
3. Polymorphism

We are going to see in more details what these terms mean but keep in mind that these characteristics of object programming represent only the minimum key features that any object oriented programming language must implement. The object oriented programming is not limited to these characteristics. Also we are going to see here what these terms mean in a rather abstract way. We will become more concrete in the next sections of this article when you will have a better understanding of the key concepts of object programming.
1. Encapsulation

Encapsulation is the ability that an object has to contain and restrict the access to its members. We will see later that objects members may be either properties (data) or methods (functions) of the objects. Encapsulation is a key concept of object programming that ensures the autonomy and integrity of the objects.
2. Inheritance

Inheritance is the ability of an object to inherit the properties and methods of an other object. We will come back to this later as you need to have a good understanding of what an object really is if you want to apprehend this concept. Keep in mind for the moment that inheritence is the ability offered to objects to inherit properties from other objects and to form hierarchies. This characteristic leads to the creation of families of objects (just like families exist for humans) with parent objects and child objects. In this configuration, it is clear that child objects inherit some characteristics from their parent object.
3. Polymorphism

This somewhat barbaric term designates the ability of objects to redefine properties inherited from their parents. In other words, a method of an object may have different implementations (behaviours or forms) depending on the object that implements it. This characteristic of the object oriented languages is an important asset to implement abstract concepts which often make sense only in specific contexts.
read more...