0% found this document useful (0 votes)
10 views2 pages

oopVsProcedure

C++ topic

Uploaded by

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

oopVsProcedure

C++ topic

Uploaded by

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

1.

Basic Concept

 Procedural Programming:
o Focuses on functions or procedures that operate on data. Programs are structured
as a sequence of instructions or statements.
o Emphasizes a linear flow of control, where tasks are performed by calling
functions.
 Object-Oriented Programming (OOP):
o Centers around objects, which are instances of classes. Classes encapsulate data
and behavior together.
o Encourages code organization through the use of objects, allowing for
abstraction, encapsulation, inheritance, and polymorphism.

2. Data Handling

 Procedural Programming:
o Data is separate from functions. Procedures manipulate data, but data can be
accessed and modified directly by any procedure.
o Less control over data integrity and encapsulation.
 OOP:
o Data and functions are bundled together in objects. This encapsulation protects
data and only allows modification through well-defined interfaces (methods).
o Promotes data hiding and abstraction.

3. Code Reusability

 Procedural Programming:
o Reusability is achieved through function libraries and modular programming,
but it can lead to code duplication if not managed well.
 OOP:
o Supports inheritance, allowing new classes to derive from existing ones, which
facilitates code reuse and reduces redundancy.
o Encourages composition, where objects can be composed of other objects.

4. Flexibility and Maintenance

 Procedural Programming:
o Changes in data structures may require significant changes in the procedures that
operate on them, making maintenance more challenging.
o Less modularity can lead to tightly coupled code.
 OOP:
o Changes to the implementation of a class can be made without affecting code
that uses the class, thanks to encapsulation.
o OOP promotes modularity and easier maintenance, as changes can be isolated
within classes.

5. Examples of Languages

 Procedural Programming Languages:


o C, Pascal, Fortran, BASIC.
 Object-Oriented Programming Languages:
o C++, Java, Python, Ruby, C#, Swift.

6. Use Cases

 Procedural Programming:
o Suitable for tasks that can be broken down into a sequence of steps or functions,
like scripting or simple algorithms.
 OOP:
o Well-suited for complex systems, large-scale applications, and software that
requires maintainability, such as games, GUI applications, and enterprise-level
software.

You might also like