Notes on Concept of Object Oriented Programming | Grade 12 > Computer Science > Programming in C | KULLABS.COM

Concept of Object Oriented Programming

  • Note
  • Things to remember

Concept of Object Oriented Programming (OOP)

Introduction

There were numerous flaws encountered in the procedural programming. To eliminate such flaws, Object Oriented Programming (OOP) evolved. OOP treats data as a critical element in the program development and does not allow to flow freely around the system. It ties data closely with the functions and protects from accidental modification of data. The data and objects can be accessed within the functions. In OOP, every object is treated differently.

.

Fig: Object Oriented Programming (OOP)

Characteristics of object Oriented Programming

The major characteristics of Object Oriented Programming are:

  1. Emphasis is on doing things (algorithms).
  2. Large programs are divided into smaller programs known as functions.
  3. Most of the functions share global data.
  4. Data move openly around the system from the function to functions.
  5. Functions transform data from one form to another.
  6. Employs top-down approach in program design.

Features of Object-Oriented Programming

Although, OOP has many features, some of the important features a programmer need to understand are as follows:

  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. Functions that operate on the data of an object are tied together in the data structure.
  5. Data is hidden and cannot be accessed by external functions.
  6. Objects may communicate with the each other through functions.
  7. New data and functions can be easily added whenever necessary.
  8. Follows bottom-up approach in program design.

Concept of Object-Oriented Programming

Object Oriented is a term which is interpreted differently by different people. An object is an entity with features. In OOP, we frequently discuss the particular features or characteristics of an object. While programming, we should understand the fundamental concept of an object. It has the following basic general concepts.

  1. Objects
  2. Classes
  3. Data encapsulation
  4. Data abstraction
  5. Inheritance
  6. Polymorphism
  7. Dynamic binding
  8. Message passing

Objects

Objects are the basic run-time entities in an object-oriented system. An object may represent a person, a place, a bank account, a table of data or any item that the program must handle. They may also represent user-defined data such as vectors, time and lists.

Programming problem is analyzed in terms of objects and the nature of communication between them. Program objects should be chosen such that they match closely with the real world objects.

Each object contains data and code to manipulate the data. Objects can interact without having to know details of each other’s data or code.

Classes

We know that objects contain data and code to manipulate the data. The entire set of data and code of an object can be made a user-defined data type with the help of a class. In fact, objects are variable type class. Once the class has been defined, we can create any number of objects belonging to that class.

Each object is associated with the data of the type class with which they are created. A class is thus, a collection of objects of similar type. For example, robin, parrot, and sparrow are members of the class bird. Classes are user-defined data types and behave like the built-in types of programming language.

Data Encapsulation

The wrapping up of data and functions into a single unit (called class) is known as encapsulation. Data encapsulation is the most striking feature of a class. The data is not accessible to the outside world and only those functions which are wrapped in the class can access it. The function provides the interface between the object’s data and the program. This insulation of the data from direct access by the program is called data hiding.

Data Abstraction

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 functions to operate on these attributes.

They encapsulate all the essential properties of the objects that are to be created. Since the classes use the concept of data abstraction, they are known as Abstract Data Type (ADT).

Inheritance

Inheritance is the process by which objects of one class acquire the properties of objects of another class. It supports the concept of hierarchical classification. For example, the bird robin is a part of the class flying bird which is again a part of the class bird.

The principle behind this sort of division is that each derived class shares common characteristics with the class from which it is derived.

In OOP, the concept of inheritance provides the idea of reusability. This means that we can add additional features to an existing class without modifying it. This is possible by deriving an add additional features to an existing class without modifying it.

This is possible by deriving a new class from the existing one. The new class will have the combined features of both the classes.

Polymorphism

Polymorphism is another important OOP concept. Polymorphism means the ability to take more than one form. For example, an operation may exhibit different behavior in different instances. The behavior depends on the types of data used in the operation. For example, consider the strings, then the operation would produce a third string by concatenation. (Having Different Structures)

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 the call at run-time. It is associated with polymorphism and inheritance.

A function call associated with a polymorphic reference depends on the dynamic type of data reference. Consider the procedure “draw”. By inheritance, every object like Box, Triangle Object, and Circle object will have this procedure.

Message Passing or Communication

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

  1. Creating classes define the objects and their behavior
  2. Creating object from class definitions.
  • Establishing communication among objects.

Objects communicate with one another by sending and receiving information much the same way as people pass messages to one another. The concept of message passing makes it easier to talk about building systems that model or simulate their real-world counterparts.

A message for an object is a request for execution of a procedure, the desired result. Message passing involves specifying the name of the object, the name of the function (message) and the information to be sent.

Application Areas of OOP

OOP has become one of the powerful programming languages these days. OOP helps to develop user interfaces.It's very user-friendly. Many windowing systems have been developed using OOP techniques. Real business systems are often affected by OOP applications. The most common areas of OOP application are:

  • Real-time systems.
  • Simulation and Games.
  • Object Oriented Database programming.
  • Artificial Intelligence and Expert systems.
  • Neural network and parallel programming.

Using the concept of OOP, modern movie editing software, engineering software, web design software, e-commerce managing software, etc. have been flourishing these days.

(Khanal)

Bibliography

Khanal, R.C. Khanal, R.C. Computer Concept for XII. Pashupatigriha Marga, Thapathali, Kathmandu, Nepal: Ekta Books Distributors Pvt. Ltd., 2010.287-290.



  • An object is a piece or entity which exists physically and has some characteristics. Object Oriented Programming is an art of managing the data, class and objects itself.
  • A class is group of similar objects within the program. A function is a program which can hold data and other functions. The wrapping of data and functions in single unit is known as data abstraction.
  •  Importing the general characteristics of the previous object or function is known as inheritance. Presenting the same data in different in different program segments is known as polymorphism.
  • Dynamic binding is the act of connecting more than one object. Communication within the functions is known as message passing.

 

.

Very Short Questions

0%

ASK ANY QUESTION ON Concept of Object Oriented Programming

No discussion on this note yet. Be first to comment on this note