Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Introduction to Object Oriented Programming

Object Oriented Programming:


Object-oriented programming (OOP) is a programming language model organized around objects rather than
"actions" and data rather than logic. OOP focuses on the objects that developers want to manipulate rather
than the logic required to manipulate them. While it’s not as simple and intuitive, it makes coding huge
complex application an ease. OOP basically breaks the application into individual components that can interact
with each other.

Object oriented approach


Object oriented approach provides a way of modularizing 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. OOP
treats 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 functions that operate on it, and protects it from accidental
modification from outside functions. OOP allows decomposition of a problem into a number of entities called
objects and then builds data and functions around these objects. The data of an object can be accessed only
by the functions associated with that object.

Features of object oriented programming

1. Emphasis is on data rather than procedure.

2. Programs are divided into 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 each other through functions.

7. New data and functions can be easily added whenever necessary.

8. Follows bottom-up approach in program design.


Advantages of OOP
 OOP provides a clear modular structure for programs which makes it good for defining
abstract data types where implementation details are hidden and the unit has a clearly defined
interface.
 OOP makes it easy to maintain and modify existing code as new objects can be created with
small differences to existing ones.
 OOP provides a good framework for code libraries where supplied software components can
be easily adapted and modified by the programmer. This is particularly useful for developing
graphical user interfaces.
 The message passing technique for communication between objects makes the interface
description with the external system much simpler.

The main advantages are: (Another Answer)


 It is easy to model a real system as real objects are represented by programming objects in
OOP. The objects are processed by their member data and functions. It is easy to analyze the
user requirements.
 With the help of inheritance, we can reuse the existing class to derive a new class such that the
redundant code is eliminated and the use of existing class is extended. This saves time and cost
of program.
 In OOP, data can be made private to a class such that only member functions of the class can
access the data. This principle of data hiding helps the programmer to build a secure program
that cannot be invaded by code in other part of the program.
 With the help of polymorphism, the same function or same operator can be used for different
purposes. This helps to manage software complexity easily.
 Large problems can be reduced to smaller and more manageable problems. It is easy to
partition the work in a project based on objects.
 It is possible to have multiple instances of an object to co-exist without any interference i.e.
each object has its own separate member data and function.

”Comparison between Procedural programming and Object-oriented


programming.
The focus of procedural programming is to break down a programming task into a collection
of variables, data structures, and subroutines, whereas in object-oriented programming it is to
break down a programming task into objects that expose behavior (methods) and data
(members or attributes) using interfaces. The most important distinction is that while
procedural programming uses procedures to operate on data structures, object-oriented
programming bundles the two together, so an "object", which is an instance of a class,
operates on its "own" data structure.”
Benefits of OOP
 Through inheritance, we can eliminate redundant code and extend the use of existing
classes.
 We can build programs from the standard working modules that communicate one
another, rather than having to start writing the code from scratch. This leads to saving
of development time and higher productivity.
 The principal of data hiding helps the programmer to build secure programs that cannot
be accessed by code in other parts of the program.
  It is easy to partition the work in a project based on objects.
  Object -oriented systems can be easily upgraded from small to large systems.
 The data-centered design approach enables us to capture more details of a model in
implementable form.
 Message passing techniques for communication between objects makes the interface descriptions
with external systems much simpler.

Disadvantages of OOPs
1. Compiler and runtime overhead. Object oriented program required greater processing
overhead-demands more resources.
2. An object's natural environment is in RAM as a dynamic entity but traditional data storage
in files or databases.
3. Requires the mastery in software engineering and programming methodology.
4. Benefits only in long run while managing large software projects.
5. Re-orientation of software developer to object-oriented thinking.

Application of OOPs
1. User interface design such as windows.
2. Used in real time system or real business system environment.
3. Simulation and modeling.
4. Object-Oriented databases.
5. Al and expert systems.
6. Neural networks and parallel programming.
7. Decision support and office automation system.
8. CAM/CAD systems.

Characteristics of Object Oriented Programming (Elements of OOP)


1. Objects
2. Class
3. Encapsulation
4. Data Abstraction
5. Inheritance
6. Polymorphism

C++
C++ is a general purpose object-oriented programming (OOP) language, developed by Bjarne Stroustrup
at Bell Labs beginning in 1979.

Advantages of C++

 C++ offers the feature of portability or platform independence which allows the user to run the
same program on different operating systems or interfaces at ease.
 C++ is an object-oriented programming language and includes concepts like classes,
inheritance, polymorphism, data abstraction, and encapsulation which allow code reusability
and makes programs very maintainable.
 C++ is a multi-paradigm programming language. Generic, imperative, and object-
oriented are three paradigms of C++.
 C++ allows exception handling, and function overloading which are not possible in C.
 C++ is a powerful, efficient and fast language. It finds a wide range of applications – from GUI
applications to 3D graphics for games to real-time mathematical simulations.
Difference Between Structured Programming Language and Object Oriented
Programming Language

Structured Programming Language Object Oriented Programming Language

1. It is a procedure language emphasize on 1. It is an object oriented technique in


doing the things only i.e. it focuses on which emphasis is on data rather than
procedure or algorithm.
algorithm.

2. Larger programs are divided into smaller 2. Programs are divided into object.
programs known as functions.
3. Most of the function shares the global data. 3. Object may communicate with each other
Function transforms the data from one to through function.
another.
4. Data undervalued. 4. Data are more valued.
5. It is very difficult to add the new function 5. New data and function can easily be added
and data once the program is completed. whenever the need arises.
6. It follows top-down approach. 6. It follows bottom-up approach
7. Example C,COBAL,FORTAN etc. 7. Example C++, JAVA.Cri etc.

End Semester Questions:


1. What is Object Oriented Programming (OOP)? Also explain main features of OOP.
2. Define computer program. Why we need computer program? Mention the benefits of
Object Oriented Programming (OOP).
3. What is Object Oriented Programming (OOP)? What are the advantages of Object
Oriented Programming?
4. Differentiate between object oriented programming paradigm and structured
programming paradigm.
5. Compare C language with C++ language.

You might also like