Programming Paradigms
1 Structured 2 Procedural
Programming Programming
Focuses on breaking Organizes code into
down code into smaller, functions and procedures,
modular units. with a focus on sequence
and control flow.
3 Object-Oriented Programming
Emphasizes data encapsulation, abstraction, and inheritance
using objects and classes.
Procedural/Structural Programming
Features
Procedural programming is a paradigm that is derived from structural programming.
It is a programming paradigm that is based on subroutines or procedure calls also known as functions.
They consist of a sequential step that perform some specified tasks. It can be called from any program to any program
during program execution.
A program in a procedural language is a list of instruction where each statement tells the computer to do something.
The focus is on the processing the algorithm needed to perform the desired computation.
Procedural programming is the standard approach used in traditional computer language such as C,
Pascal, FORTRAN & BASIC.
Procedural/Structural Programming
Features Diagram
1. The POP concept divides the program into set of functions.
2. It uses top-down approach.
3. This paradigm gives unrestricted access to the global variable.
4. Its major part is function.
5. In this, we can not bind data and functions.
6. It is difficult to develop complex applications.
7. It does not help us with new functionality.
8. In this paradigm, s/w maintenance is difficult.
9. We can not protect data from inadvertent changes.
10. It does help us to use features such as polymorphism, encapsulation class, object etc
Object-Oriented Programming
Object-Oriented Programming (OOP) is a programming paradigm that
organizes software design around objects and data, rather than functions
and logic alone.
At its core, OOP revolves around the concept of "objects," which encapsulate
both data and the methods or functions that operate on that data.
These objects interact with one another through defined interfaces,
facilitating modular and reusable code.
Key principles of OOP include encapsulation, inheritance, and
polymorphism. Encapsulation ensures that the internal workings of an object
are hidden from the outside world, promoting code security and
maintainability.
Inheritance allows objects to inherit properties and behaviors from other
objects, fostering code reuse and simplifying software design.
Polymorphism enables objects to take on multiple forms, allowing for flexible
and dynamic behavior within a program. OOP promotes modular, scalable,
and maintainable codebases, making it a widely adopted paradigm in
modern software development
by tech savant
Object-Oriented Programming
Features:
Emphasis is on data rather than procedures.
Programs are divided into objects.
Data structures are designed such that they characterize the objects
Object-Oriented Programming (OOP) 313Approved by CDC, Nepal
Functions and data are tied together in the data structures so that data
abstraction is
introduced in addition to procedural abstraction.
Data is hidden and can’t be accessed by external functions.
Object can communicate with each other through functions.
New data and functions can be easily added whenever necessary.
•Follows Bottom up approach
by tech savant
Introduction to Object
Oriented Programming
1 Real-World Objects
OOP models real-world objects as software objects,
with attributes and behaviors.
2 Classes as Blueprints
Classes act as blueprints for creating objects, defining
their attributes and methods.
3 Code Reusability
OOP promotes code reuse through inheritance and
polymorphism.
Key Features of OOP
Objects Classes
Instances of a class, Blueprints for creating
representing real-world objects, defining their
entities with attributes and structure and functionality.
behaviors.
Data Abstraction
Hides internal implementation details, exposing only relevant
information to users.
Encapsulation Polymorphism and Inheritance
OOP Feature:
Encapsulation
Data Hiding
Private variables are inaccessible outside the class,
enforcing data integrity.
Public Methods
Public methods provide controlled access to internal
data, ensuring data security and integrity.
OOP Feature:
Polymorphism
Type Description Example
Compile-Time Multiple methods Methods for
Polymorphism with the same adding integers
(Overloading) name but and floats.
different
parameters.
Run-Time Methods in Animal class with
Polymorphism derived classes a 'speak' method,
(Overriding) redefine methods overridden in Dog
inherited from and Cat classes.
base classes.
OOP Feature: Inheritance
Single Inheritance
A subclass inherits from a single parent class.
Multiple Inheritance
A subclass inherits from multiple parent classes.
Hierarchical Inheritance
Multiple levels of inheritance, creating a hierarchical structure.
Application of OOP
Web Development Mobile Development Software Engineering
OOP is widely used in web OOP is essential for building robust OOP is a fundamental paradigm in
development for building interactive and user-friendly mobile software engineering, enabling
and dynamic web applications. applications. large-scale software projects.