Definition of an Object

Team-Fly

As its name implies, OOP is centered around objects. For the purposes of OOP, an object is simply a combination of code and data that can be used together. Examples of code objects are subroutines, buttons, and screens. SAP has the BOR (Business Object Repository), which contains objects like material and sales orders.

Two mechanisms handle the communication to and from most objects. The first way to communicate between objects is through variables that can be passed back and forth from the calling object. The second approach consists of a predefined set of procedures that can be called to cause the object to do something. These procedures are more commonly known in the Java world as methods. Methods use the variables to determine the exact operation that the object is to perform. A graphical representation of an object can be seen in Figure 6.1.

With OOP you only have to know two things about each object:

  • The communication process for the object, which basically means the format and content of both the incoming and outgoing variables

click to expand

Figure 6.1: A simple representation of an object-oriented environment

  • What the object does, or how the object behaves based on a specific set of input data

You, as programmer, do not have to know how the object is built. Consequently, you save a considerable amount of time when developing an application because you do not have to write and support every single line of code in an application. Because complete object-oriented applications are simply collections of objects that work together, you only have to code the new objects that you create and the glue that binds all of the objects together.

Objects in OOP have another advantage in addition to reusability of code; this advantage concerns how variables are treated within objects. In OOP, the object always controls which of its variables and methods other objects can see and use. This is called encapsulation, and it is the fundamental part of OOP.

The benefits of encapsulation are that objects can be written and maintained independent of the source code for other objects, and can easily be shared by different objects. Another benefit is simplicity, because a complicated piece of code can be written just once and then called many times. One more benefit is that data can be protected from other objects so that both integrity and security of the object are maintained.


Team-Fly


Java & BAPI Technology for SAP
Java & BAPI Technology for SAP
ISBN: 761523057
EAN: N/A
Year: 1998
Pages: 199

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net