Home » OBJECT ORIENTED PROGRAMMING

Category Archives: OBJECT ORIENTED PROGRAMMING

WHAT IS OBJECT ORIENTED PROGRAMMING (OOP)

DEFINITION OF OBJECT ORIENTED PROGRAMMING (OOP)

OOP is a programming approach to organise and develop programs that attempts to eliminate some of the backwards of conventional logic programming. This approach provides the best structure programming feature with new concept of organising and developing programs. This
programming approach is not related to any programming languages or all other languages are not suitable to implement the OOP concept. The languages those implement the OOP approach is called object oriented programming languages. The major motivation of designing and development of object oriented approach is to remove shortcomings associated with procedural approach.
OOP treat data as critical element in the program development and does not allow the data to flow freely around the system. It ties the data more firmly to the functions that operate on it and prevent it from accidental change into external function. OOP allows decomposition of a problem in to a number of entities called OBJECT. The data of an object can be accessed by the function associated with that object.

CHARACTERISTIC OF OBJECT ORIENTED PROGRAMMING

  1. Functions that operate on data of an object are tied together in a data structure.
  2. Data are hidden and cannot be accessed by the external functions.
  3. Objects may communicate with each other through functions.
  4. New data and function can be easily added whenever necessary.
  5. It follows bottom up approach in program design.
Object oriented programming is an approach that provides a way module raising a program by creating partition memory area for both data and function that cannot be used as a template for creating copies of such modules on demand. Thus an object can be considered as a partition area of computer memory that stores data and set of operations that can access that data. Since the memory partitions are independent, the object can be used in verity of program without modification. When procedural programming focuses on doing things or function oriented, OOP approach focuses on object. This programming increases security of local data in each sub task of a complex problem. So, this programming approach can map real world compel problems in a better way. In OOP, object contains a set of secure data which stores the properties of that object along with a set of actions or methods that access that data. Here, objects hide much of the details of an overall application. Programmers can focus on modifying one object without worrying about the effect of on another object.

BENEFITS OF OBJECT ORIENTED PROGRAMMING

OOP provides several benefits to both the program and the user. 
  1. This approach provides an effective and efficient way of mapping real world complex problems. 
  2. This approach provides better quality of software and lesser maintenance cost.
  3. Principal of data hiding helps the programmer to build secure program.
  4. Software complexity can be easily managed.
  5. This programming approach allows us to have multiple instances of an object to co-exist without any interference.
  6. This approach is easy to partition the work based on objects.

OBJECT IN OBJECT ORIENTED PROGRAMMING

Objects are primary run time entities in OOP approach. An object is a physical thing, they represent a person, bank account etc. They may also represent user defined data such as vector, time, list. Programming issue is analysed in terms of object and the time of communication between them. Here, the program objects are similar to the actual word problems. Objects occupy space in memory. Every object has its own properties or features. Program object should be chosen in such a way that they match closely to the real world objects. Here, student is an object which stores the local data name, roll, D.O.B., address (ADD), and marks for corresponding student. These are the attribute of the object student. A student object S1 (say) cannot access the properties or attributes of another object student S2 (say) but S1 can access its own local data by calling method or functions of its own like total, average, display, etc. Here attributes or properties of each object are kept protected or private from others access and in this way it hides its details from others object. So, each object has a code to manipulate its own data.
  • Object: Student
  • Data: Name, Roll Number, D.B.O., Address, Marks Obtained.
  • Functions: Total, Average, Display, etc. 

ENCAPSULATION IN OBJECT ORIENTED PROGRAMMING

The wrapping up of data and function all together into a single component is known as encapsulation. Data encapsulation is the most important feature of a class. The data is not accessible to other objects but the functions which are wrapped in the class can access it. These member functions provide an interface between the object data and the program. This situation of data from direct access by the program is called data hiding or information hiding.

DATA ABSTRACTION IN OBJECT ORIENTED PROGRAMMING

Abstraction refers to the act of representing essential feature without including background details or explanation. Class use the concept of abstraction and define as a set of properties called data members. It has few methods or functions to operate on these abstraction properties. Data abstraction is the procedure of identifying properties and methods related to a specific entity as applicable to the application. 

CLASS IN OBJECT ORIENTED PROGRAMMING

A class is a collection of similar type of objects having identical properties, common behaviour and shared relationship. A class is the blue print of an object. A class creates a user defined data type. Once a class has been defined, we can create any number of objects belonging to that class and the objects are variable type class. An object is an instance of class. As for example, mango is an object of type fruit because mango belongs to the class fruit. 

INHERITANCE IN OBJECT ORIENTED PROGRAMMING

Inheritance is a process by which object of one class acquired the property of objects of another hierarchical classification. As for example class vehicle can be divided into a number of classes based on their number of wheels as for e.g. two wheeler, three wheeler, four wheeler, etc. But each object belong to the sub-class has the common properties of a vehicle like model, colour, capacity, speed, etc. In object oriented programming, the inheritance provides the use of re-usability. This means that a programmer can add new features to the existing class without modifying. The new class will have the features of the class which is hierarchically above. example of inheritance structure:

EXAMPLE OF INHERITANCE STRUCTURE IN OBJECT ORIENTED PROGRAMMING