<- Previous Page Next Page ->

Even More OOP Concepts 

Data abstraction:

The public interface, formed by the collections of messages understood by an object, completely defines how to use this object. Programs that want to manipulate an object, only have to be concerned about which messages this object understands, and do not have to worry about how these tasks are achieved nor the internal structure of the object. The hiding of internal details makes an object abstract, and the technique is normally known as data abstraction.

With abstraction you create a well-defined entity which can be properly handled. These entities define the data structure of a set of items. An entity with the properties just described is called an abstract data type (ADT). However, data abstraction and data hiding are almost same.

Abstraction refers to the act of representing essential without including the background details or explanations. Classes use the concept of abstraction and are defined as a list of abstract attribute such as size, weight and cost, and functions to operate on these attributes. Data abstraction ensures security of data from being unexpected viewing or changing or manipulating. Both the term data abstraction and data hiding (see page) are closely related and are often understood as one which is very much correct.

 Abstract Data Type or Data Abstraction is a wide asked and thought question even in procedural or structured languages as data security or data hiding is essential for corporate users and to ensure the irrational manipulation or processing of data by other calls because of dynamic binding and multiple calls or value passing i.e. messages.

Encapsulation:

Encapsulation means that the data and instructions for variable are wrapped up together and treated as a unit. The blueprints for these variables are called objects. Look at the figure O (1) (page). The object ‘Student’ is using three types of data or variable. They are name, date-of-birth and marks. All these variables are used to interact with other objects and are used in respective objective’s function. All these data or variable together called encapsulated and the process is known as encapsulation.

Again, data encapsulation means that there is a very close attachment between data items and procedures. The procedures (methods) are responsible for manipulating the data in order to reflect its behavior. The public interface, formed by the collections of messages understood by an object, completely defines how to use this object. Programs that want to manipulate an object, only have to be concerned about which messages this object understands, and do not have to worry about how these tasks are achieved nor the internal structure of the object.

The wrapping of data and functions into a single unit (called class) is known as encapsulation. In OOP, data is not accessible to the outside world and only those functions which are wrapped in the class can access it. These functions provide the interface between the object’s data and the program. This insulation of data from direct access by the program is called data hiding. The values of the variables inside an object are private, unless methods are written to pass that information outside of the object.

Messages/ Message passing:

Objects are autonomous entities which only provide a well-defined interface. We'd like to talk of objects as if they are active entities. For example, objects ``are responsible'' for themselves, ``they'' might deny invocation of a method, etc. This distinguishes an object from a module, which is passive. Therefore, we don't speak of procedure calls. We speak of messages with which we ‘ask’ an object to invoke one of its methods. Software objects interact and communicate with each other using messages. Example- the key word in a programming language ‘employee salary (name)’ will first refer first the object name which is here employee, then the message or variable which is here salary and then the information which is here name.

The Internet provides several objects. Two of the most well known ones are ‘client’ and ‘server’. For example, you use an FTP client (object) to access data stored on an FTP server (object). Thus, you could view this as if the client “sends a message'' to the server asking for providing data stored there. In the client/server environment we really have two remotely acting entities: the client and server process. Typically, these two entities exchange data in form of Internet messages.

Even in for database management or procedural languages, message passing is vital as it will say the program what to do or with what to work with. In a word, it is the instruction for making the software, the design and the hardware to work and interact.

Overloading:

Overloading, in OOP, means the ability to assign multiple meanings to the names of operators and functions. For example, the operator +, normally associated with arithmetic addition can be overloaded to add one list to another in a certain context.

Use of a single symbol to represent operators with different argument types, e.g. "-", used either, as a monadic operator to negate an expression, or as a dyadic operator to return the difference between two expressions. Another example is "+" used to add either integers or floating point numbers. Overloading is also known as ad-hoc polymorphism. Overloading is often referred as operator overloading.

User-defined operator overloading is provided by several modern programming languages, e.g. C++'s class system and the functional programming language Haskell's type classes.

Dynamic Binding:

Dynamic binding means that the code associated with a given procedure call is not known until the time of the call at run-time. Think os an object which has a certain function and that was inherited from it’s respective class. Thus every object of that class will inherit the function but wont have any effect unless or until it is called. 

One important reason for having dynamic binding is that it provides a mechanism for selecting between alternatives which is arguably more robust than explicit selection by conditionals or pattern matching. When a new subclass is added, or an existing subclass changes, the necessary modifications are localized: you don't have incomplete conditionals and broken patterns scattered all over the program.

Page-7

<- Previous Page Next Page ->