Object Oriented Programming




Basic Introduction

The term Object Oriented programming is frequently heard in the programming arena. Object oriented approach was started to overcome the limitations of the earlier programming approaches. It is popularly known by its acronym OOP. It is used to develop reliable and reusable software. The programming technology is continuously developing since the start of the computer and related technologies. New tools and techniques are included in programming in each phase of their development. Such enhancements increased complexity in programming and design of large software. Similarly, the users' requirements change and increase after the software is brought into operation. The software may need maintenance and enhancements after the regular feedback from the users. There could be problems to represent real life entities of problem while analyzing and designing system. While improving the software work may need to begin from the scratch that may increase software cost too. To incorporate users' demands and enhancements in software with such complex systems was difficult. To overcome such problems software developers were forced to develop new programming method. OOP was introduced to solve such programming problems.

1.1 Software Evolution
The software evolution occurred in several phases. Since the beginning of the first computer, programming for the computer started to develop software. The earlier electronic computer ENIAC was programmed in machine language by using switches to enter 1 and 0.

1.2 Basic of Object Oriented Programming
Objects are the entities that can be uniquely identified from others. They have their unique identity and found everywhere. In real world system everything exists in the form of objects. For example desk, bench, blackboard, student, teacher, car, tree are objects. Every object has two things, firstly its properties we call attributes and second its behavior we call function. For example a car is an object. It has attributes like color, number of seats, chassis number, engine number etc and behavior like move, stop, accelerate, turn etc. The Object Oriented Programming is developed to model such real world system. Its sole objective is to overcome the limitation of Procedure Oriented approach. Before discussing various features of Object Oriented Programming, it is wise to discuss characteristics of Procedure Programming and its limitations.

1.2.1 Procedure Oriented Programming In procedure oriented programming a large program is broken down into smaller manageable parts called procedures or functions. In procedure oriented programming priority is given on function rather than data.
In procedure oriented programming language, a program basically consists of sequence of instructions each of which tells the computer to do something such as reading inputs from the user, doing necessary calculation, displaying output. When a program becomes larger, it is then broken into smaller units called procedure or functions. A number of functions are supposed to be written to accomplish such tasks. The primary focus of procedural oriented programming is on functions rather than data. These functions do not let code duplication. This technique is only suitable for medium sized software applications.
The procedure oriented programming can be diagrammatically represented as follows:
In procedure oriented programming two types of data local and global are used. Data within the function are called local data and the data which are not within any function are called global data. Global data are accessible to the only function where it is declared. So each function may access its local data as well as global data. The local data of one function is not accessible to other functions. If any data is to be accessed by two or more functions it should be made global. However, global data are vulnerable to another programmer to be changed unknowingly. Functions are action oriented and do not correspond to the element of the problem. The separate arrangement of data and functions does a poor job of modeling things in the real world. That’s why procedure oriented programming approach does not model real world system perfectly.
High Level Programming Languages like COBOL, FORTRAN, Pascal, C are common procedure oriented programming languages.

Characteristics of POP
The characteristics of procedure oriented programming are listed as follows:
 A large program is broken down into small manageable procedures or functions.
 Procedure oriented programming focuses on procedure or function rather than data.
 For sharing a common data among different functions the data is made global.
 Since global data are transferred from function to function; during the course of transformation the global data may be altered by the function.
 The program design of procedure oriented programming follows top down methodology.

Limitation of POP
Even though procedure oriented programming approach is still used in software industry it has following limitations.
 Focus on functions rather than data.
 In large program, it is difficult to identify belonging of global data.
 The use of global data is error prone and it could be an obstacle in code maintenance and enhancements.
 The modification of global data requires the modification of those functions using it.
 Maintaining and enhancing program code is still difficult because of global data.
 It does not model real world problem very well. Since functions are action oriented and do not really correspond to the elements of problem.

Object oriented programming (OOPS)
The errors faced in the procedure oriented programming approach are the motivating factor in the invention of objected oriented approach. In OOP, data are treated as a critical element in the program and restricts freely transformation of data around the system. Instead, data are associated with functions that operate on it and protect it from accidental modification outside functions. OOP approach permits decomposition of a problem into entities called objects and then build data and function around them. Data of an object are accessible only by the function belonging with the object. But function of one object may access the function of another object.
Object-Oriented programming is a programming methodology that associates data structures with a set of operators which act upon it. In OOP, an instance of such an entity is known as object. In other words, OOP is a method of implementation in which programs are organized as co-operative collections of objects, each of which represents an instance of some class and whose classes are all members of a hierarchy of classes united through the property called inheritance.

Characteristics of OOPs
OOP is most sophisticated programming methodology among other methodologies by far. Some noticeable characteristics of OOP are as follows:
 Emphasis is on data rather than procedures.
 Programs are divided into objects.
 Function and data are tied together in a single unit.
 Data can be hidden to prevent from accidental alteration from other function or objects.
 Data access is done through the visible functions so that communication between objects is possible.
 Data structures are modeled as objects.
 Follows Bottom up approach of program design methodology.


Download the pdf file to get all the unit wise notes.
Try to save your valueable time!