INTRODUCTION TO PROGRAMMING PARADIGMS
Programming paradigms are approaches or styles of programming based on distinct concepts.
The are two main paradigms
1. Procedural programming- can be defined as a programming model which is derived from
structured programming, based upon the concept of calling procedure. Procedures, also
known as routines, subroutines or functions, simply consist of a series of computational
steps to be carried out. During a program’s execution, any given procedure might be
called at any point, including by other procedures or itself.
Languages used in Procedural Programming includes:
FORTRAN, ALGOL, COBOL,
BASIC, Pascal
2. Object oriented programming- Object-oriented programming can be defined as a
programming model which is based upon the concept of objects. Objects contain data in
the form of attributes and code in the form of methods. In object-oriented programming,
computer programs are designed using the concept of objects that interact with the real
world. Object-oriented programming languages are various but the most popular ones are
class-based, meaning that objects are instances of classes, which also determine their
types.
Languages used in Object-Oriented Programming:
Java, C++, Python, PHP, JavaScript, etc.
Procedural Programming vs Object-Oriented Programming
Below are some of the differences between procedural and object-oriented programming:
1. In procedural programming, the program is divided into small parts called functions
while in object-oriented programming, the program is divided into small parts called
objects.
2. Procedural programming follows a top-down approach while Object-oriented
programming follows a bottom-up approach.
3. There is no access specifier in procedural programming while Object-oriented
programming has access specifiers like private, public, protected, etc.
4. In Procedural Oriented Programming Adding new data and functions is not easy while in
Object-Oriented Programming Adding new data and function is easy.
5. Procedural programming does not have any proper way of hiding data so it is less secure.
Object-oriented programming provides data hiding so it is more secure.
6. In procedural programming, overloading is not possible while in Overloading is possible
in object-oriented programming.
7. In procedural programming, there is no concept of data hiding and inheritance while In
object-oriented programming, the concept of data hiding and inheritance is used.
8. In procedural programming, the function is more important than the data while In object-
oriented programming, data is more important than function.
9. Procedural programming is based on the unreal world while Object-oriented
programming is based on the real world.
10. Procedural programming is used for designing medium-sized programs while Object-
oriented programming is used for designing large and complex programs.
11. Code reusability is absent in procedural programming while Code reusability is present in
object-oriented programming.
Overview and Importance of OOP in Software Development
Key Concepts of OOP:
Class – class can be defined as a template/blueprint that describes the behavior/state that the
object of its type supports.
Object – An instance of a class.
Encapsulation – Bundling data and methods together.
Abstraction – is a process of hiding the implementation details and showing
only functionality to the user or simply hiding unnecessary details and showing only relevant
data.
Inheritance – Allows a class to inherit properties and methods from another class.
Polymorphism – Same method name behaves differently based on context (overloading and
overriding).
Importance of OOP:
Modularity: Code is divided into independent modules (classes).
Reusability: Existing code can be reused through inheritance.
Scalability: Easy to maintain and scale software.
Real-World Modeling: Naturally maps to real-world entities (e.g., Car, Bank Account).
Security: Data hiding using access modifiers (private, public).
Real-World Analogies of OOP Concepts
Class - A blueprint or recipe (e.g., Car blueprint)
Object - A specific car built from the blueprint (e.g., a red Toyota with license KAA123)
Encapsulation - A capsule containing medicine only the needed parts are exposed
Abstraction - A car dashboard you see the speed and fuel, not the internal engine details
Inheritance - A child inheriting traits from a parent (e.g., eye color, hair type)
Polymorphism - A smartphone camera that behaves differently in photo, portrait, or night mode