Fundamentals of Object-Oriented Programming



Object - Oriented Paradigm

The Major objective of object - oriented approach is to eliminate some of the flaws encountered in the procedural approach. OOP treats data as a critical element in the program development and does not allow it to flow freely around the system.

OOP allows us to decompose a problem into a number of entities called Objects and the build data and functions around these entities. 

The Combination of data and method make up an object.


Some of the features of object - oriented paradigm are:-

  1. Emphasis is on data rather than procedure.
  2. Programs are divided into what are known as Objects.
  3. Data structures are designed such that they characterize the objects.
  4. Methods that operates on the data of an objects are tied together in the data structure.
  5. Data is hidden and cannot be accessed by external functions.
  6. Objects may communicate with each other through methods.
  7. New data and methods can be easily added whenever necessary.
Object - Oriented paradigm is the most recent concept among programming paradigms and means different things to different people.

Object - Oriented Programming is an approach that provides a way of modularizing programs by creating partitioned memory are for both data and functions that can be used as templates for creating copies of such modules on demand.

Basic Concepts of Object - Oriented Programming


"OOP is the heart of java Language"

Objects and Classes 

Objects are basic Runtime Entities  in an object oriented system. They may represent as person , a place , a bank account , a table  of data or any item that the program may handle.

Classes are the user defined data types and behave like built - in types of programming language.


Difference Between Object and Class



Data Abstraction and Encapsulation

The Wrapping up of data and functions into Single unit is known as Data Encapsulation. Data Encapsulation is most striking features of a class. The data is Not accessible to the outside world and those methods, which are wrapped in the class , can be access it. These methods provide the interfaces between the object's data  and the program. This insulation of the data from direct access by the program is called data hiding. 



Abstraction refers to the act of representing essential features without including the background details or explanations. Classes use the concept of abstraction and are defined as a list  of abstract attributes such as size, weight and cost, and methods that operate on these attributes. 


Inheritance

Inheritance is the process by which object of one class acquire the properties of objects of another class. In OOP the concept of inheritance provides the idea of reusability.  For Example Car and Truck are inherited from Vehicle, means Car and truck Acquire the properties of Vehicle. To access We have to Put extends keyword.

Example:-

Class Vehicle 
{

}

Class Car extends Vehicle
{

}

Class Truck extends Vehicle
{

}

Polymorphism 

Polymorphism is another important OOP concept. Polymorphism Means ability to make more than one form. Polymorphism plays an important role in allowing objects having different internal structures to share the same external interface. This means that a general class of operations mat be accessed in the same manner even though specific actions associated with each operation may differ polymorphism is extensively used in implementing inheritance.





Dynamic Binding


Binding refers to  the linking of a procedure call to the code to be executed in response to the call. Dynamic Binding means that the code associated with a given procedure call is not known until the time of call at runtime. It is associated with polymorphism and inheritance. 


Message Communication


An Object - Oriented program consists of a set objects that communicate with each other. The process of programming in an object - oriented language , therefore , involves the following basic steps:-

  1. Creating classes that define objects and their behaviour.
  2. Creating objects from class definitions.
  3. Establishing communication among objects.
Objects communicate with one another by sending and receiving information  much the same way as people pass message to one another as shown in fig.



Benefits Of OOP

  1.  Through inheritance, we can eliminate redundant code and extend the use of existing classes.
  2. We can build program from the standard working modules that communicate with one another, rather than starting writing code from scratch.
  3. The principle of data hiding helps the programmer to build secure programs that cannot be invaded by code in other parts of the program.
  4. It is possible to have multiple objects to coexist without any inheritance.
  5. It is possible to may objects in the problem domain to those objects in the program.
  6. It is easy to partition the work in a project based on objects on objects.
  7. Object - Oriented system can be easily upgraded from small to large systems.
  8. Software Complexity can be easily managed.

Application of OOP


  • Real - time systems.
  • Simulation and modelling.
  • Object - oriented databases.
  • Hypertext and hypermedia.
  • AI and expert systems.
  • Neural networks and parallel programming.
  • CIM/CAD/CAD system.



Post a Comment

1 Comments