Fundamentals of Object Oriented Programming

Submitted by MoumitaMalik on Mon, 06/18/2018 - 08:13

Object Oriented Programming (OOP) is an approach to program organization and development, which attempts to eliminate some of the pitfalls of conventional programming methods by incorporating the best structure programming features with several new concepts. It is a new way of organizing & developing programs and has nothing to do with particular language. Object Oriented Programming popularly known as OOP, is used in a modern programming language like Java.

Object Oriented Paradigm :

The major objective of object oriented approach is to eliminate some of the flaws encountered in the procedural approach. OOP teats data as a critical element in the program development and does not allow it to flow freely around the system. It ties data more closely to the fiunctions that operate on it and protects it from unintentional modification by other functions. OOP allow us to decompose a problem into a number of entities called Objects. Then build data and functions (known as methods in Java) around these entities. The combination of data and methods make up an object.

 

Object = Data + Methods

 

The data of an object can be accessed only by the methods associated with that object. However, methods of one object can access the methods of other objects. Some of the features of object-oriented paradigm are -

  • Emphasis is on data rather than procedure.
  • Programs are divided in to what are known as Object.
  • Data structures are designed such that they characterize the objects.
  • Methods that operate on the data of an object are tied together in the data structure.
  • Data is hidden and cannot be accessed by external functions.
  • Objects may communicate with each other through methods.
  • New data and methods can be easily added whenever necessary.

Object-oriented programming is an approach that provides a way of modularising programs by creating partitioned memory area for both data and functions that can be used as templates for creating copies of such modules on demand.

This means an object is considered to be a partitioned area of computer memory that stores data and a set of operations that can access that data. Since the memory partitions are independent, the objects can be used in a variety of different programs without modifications.
 

Basic concept of OOP :

Object-oriented is a term, which is interpreted differently by different people. It's necessary to understand some of the cencepts used extensively in object-oriented programming. Let's discuss the general concepts of OOP, which form the heart of Java lenguage.

a) Objects and Classes - Objects are the basic run-time entities in the object-oriented system. Each object contains data and code to manipulate the data. Objects can interact without having to know the details of each other's data or code. It is sufficient to know the type of message accepted and the type of response returned by the objects. The entire set of data and code of an object can be made a user-defined data type called Class. A class may be considered as a "data type" and an object as a "variable" of that data type. A class is a collection of objects of similar type. Classes are user-defined data types and behave like the built-in types of a programming language. 

b) Data Abstractions and Encapsulation -  The wrapping up data & methods into a single unit (i,e Class) is known as encapsulation. The data is not accessible to the outside world and only those methods, which are wrapped in to the class, can access it. This insulation of the data from direct access by the program is called data hiding. Encapsulation makes it possible for objects to be treated like "black boxes", each performing a specific task without any concern for internal implementation. 

c) Inheritance -  It is the process by which objects of one class acquire the properties of objects of another class. Inheritance supports the concept of hierarchical classification. In OOP, the concept of inheritance provides the idea of re-usability i,e we can add additional features to an existing class without modifying it. 

d) Polymorphism -  It is the ability to take more than one form. An operation may exhibit different behavior in different instances. The behavior depends upon the types of data used in the operation. Polymorphism is extensively used in implementing inheritance. 

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

 

Benefits of OOP : 

  • Code recycle and reuse.
  • Wrapping up of data into a single unit.
  • Easy to partition the work in a project based on objects.
  • Message passing technique between objects for communication makes interface description with external systems much more straightforward.
  • Software Complexity can be easily handled and managed.
  • Possible to map objects in a problem domain within a program.
  • Data hiding is possible.
  • Use of inheritance can eliminate redundant codes in a program.in the

 

Applications of OOP : 

Real-business systems are often much more complex and contain many more objects with complicated attributes & methods. OOP is useful in this type of applications because it can simplify the complex problem. The promising areas for application of OOP includes - 

  • Real-time system 
  • Simulation & modelling 
  • Object-oriented databases
  • Hypertext, hypermedia and expertext 
  • AI & expert systems
  • Neural networks & parallel programming 
  • Decision support & office automation systems
  • CIM/CAD system 

 

 

Comments

Related Items

Introduction to Java Platform

Java is a general-purpose, object-oriented programming language developed by Sun Microsystem in 1991. It is one of the most used programming languages....