0% found this document useful (0 votes)
18 views4 pages

Chap1 Introduction To Object Oriented Programming: Issues With Procedural Programming

The document introduces Object Oriented Programming (OOP) as a solution to the limitations of Procedural Programming (POP), emphasizing data protection and real-world modeling. It outlines key features of OOP such as encapsulation, inheritance, and polymorphism, contrasting them with the characteristics of POP. The document also discusses the advantages and disadvantages of OOP, highlighting its benefits in software development and complexity management.

Uploaded by

Deepen Magar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views4 pages

Chap1 Introduction To Object Oriented Programming: Issues With Procedural Programming

The document introduces Object Oriented Programming (OOP) as a solution to the limitations of Procedural Programming (POP), emphasizing data protection and real-world modeling. It outlines key features of OOP such as encapsulation, inheritance, and polymorphism, contrasting them with the characteristics of POP. The document also discusses the advantages and disadvantages of OOP, highlighting its benefits in software development and complexity management.

Uploaded by

Deepen Magar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Chap1

Introduction to Object Oriented


Programming
Issues with Procedural Programming
- In procedure oriented approach, the problem is analyzed and as a
sequence of things to be done like reading, calculating and displaying for
which functions are used.
- Some common POP programming languages are COBOL, C, FORTRAN
and so on.

Characteristics of POP
1. Emphasis is on algorithms
2. Follows top to bottom approach
3. Coding of large program is done by dividing it into smaller modules called
functions
4. Global data can be shared by any functions
5. Functions are capable of transferring data from one form to another

Limitations of POP
1. Functions are emphasized rather than data.
2. Global data are vulnerable to an inadvertent change by a functions
3. Difficulty in recognizing which function uses which global data
4. Modification in global data also requires modification in functions using it
5. Function are action oriented so can not correspond to elements of the
problem. So, it does not model the real world problems.

Basic OOP
- In other to solve the limitations of the POP, the concept of OOP arises.
- In OOP, emphasis is given to data because of which data are protected
from being accidental modification or data corruption.
- Large problem is divided into objects and then build data and function
around them.
Features of OOP
1. Emphasis is given on data rather than procedures.
2. Programs are divided into objects.
3. Function and data are tied together in a single unit.
4. Data can be hidden to prevent from accidental alteration from other
functions.
5. Data access is done through the visible function.
6. Objects can communicate with each other through functions.
7. Follows bottom up approach.

Procedure Oriented vs Object Oriented


Programming
Procedure oriented Object oriented
1. Emphasis is given on procedure. 1. Emphasis is given on data.
2. Programs are divided into functions. 2. Programs are divided into objects.
3. Data can not be hidden. 3. Data can be hidden.
4. It does not model the real world problems. 4. It models the real world problems.
5. Data moves from function to function. 5. Data and function are tied together.
6. Maintaining and enhancing code is still 6. Maintaining and enhancing code is
difficult. easy.
7. Code reusability is difficult. 7. Code reusability is easy.
8. Follows top-down approach. 8. Follows bottom-up approach.
9. Eg: COBOL, C 9. Eg: JAVA, C++

Concept of Object Oriented Programming


1. Object:
- Objects are the basic run time entities in an object oriented system.
- They represent any item that the program can handle.
- The objects are so chosen to match with the real world objects.
- When a program is executed, the objects interact by sending messages to
one another.
- Eg: Consider an object ‘student’ with data (name, roll, mark) and functions
{total(), average(), display()}

2. Class:
- Class is the user defined data type used to declare the object.
- It is possible to declare any number of objects belonging to that class.
- Each object of a class is associated with the data of that class.
- Eg: To create an object mango belonging to the class fruit;
fruit mango;

3. Abstraction:
- Abstraction is the act of representing the essential features without
including the background details or explanations.
- Classes are the concept of abstraction. So, class is a abstract data type.
- It can manage the program complexity.

4. Encapsulation:
- Encapsulation is the mechanism of combining data function together into a
single unit.
- It prevents the data being accessed by other code.

5. Inheritance:
- Inheritance is the process of creating new classes based on the existing
class such that new class acquires features from the existing class and
adds more features on it.
- The process of deriving a new class from the existing base class is called
inheritance.

6. Polymorphism:
- Polymorphism is the ability to take more than one form depending on what
they are operating on.
- It allows different objects to respond to the same operation in different
ways, the response being specific to the type of object.
- Eg: operator overloading, function overloading and so on.

Example of Some Object Oriented Languages


1. Small talk
2. Eiffel
3. JAVA
4. C#
5. D
6. C++

Advantages and Disadvantages of OOP


Advantages of OOP
1. Data hiding ensures program security.
2. Software development becomes easy as programs are divided into
objects.
3. Proper management of software complexity.
4. Ensure real world problems modeling.
5. Easy to reuse codes.
6. Techniques like inheritance and templates eliminates redundant code.

Disadvantages of OOP
1. Requires more compilation time.
2. Difficult to trace and debug errors in complex program.
3. No benefits in short run of programs.

You might also like