Procedural and Object Oriented Programming Paradigms

 

🔷 Procedural Programming Paradigm

✅ What is it?

Procedural Programming is a programming paradigm based on procedures or routines (also called functions). It follows a step-by-step approach to solving problems.

🧠 Key Characteristics:

  • Program is divided into functions or procedures.

  • Focus is on functions and the sequence of actions.

  • Data is usually global and accessed by many functions.

  • Follows top-down approach.

📌 Example (in C-style pseudocode):


int sum(int a, int b) { return a + b; } int main() { int result = sum(5, 10); printf("%d", result); }

🔷 Object-Oriented Programming (OOP) Paradigm

✅ What is it?

OOP is a paradigm that organizes software design around objects (real-world entities) that combine data (attributes) and methods (behaviors).

🧠 Key Characteristics:

  • Program is divided into classes and objects.

  • Focus is on data and how to manipulate it.

  • Promotes concepts like Encapsulation, Abstraction, Inheritance, and Polymorphism.

  • Follows a bottom-up approach.

📌 Example (in Java):


class Calculator { int add(int a, int b) { return a + b; } } public class Main { public static void main(String[] args) { Calculator c = new Calculator(); System.out.println(c.add(5, 10)); } }

🆚 Key Differences

FeatureProcedural ProgrammingObject-Oriented Programming
FocusFunctions (procedures)Objects (data + behavior)
StructureTop-downBottom-up
Data AccessGlobal/sharedEncapsulated in objects
ReusabilityLimitedHigh (via inheritance and polymorphism)
SecurityLess secure (global data)More secure (private/protected data)
Example LanguagesC, Pascal, FortranJava, C++, Python (OOP style)

✅ Summary

  • Procedural Programming is simpler and good for small programs.

  • OOP is modular, scalable, and better for complex, real-world applications.

Comments

Popular posts from this blog

Object Oriented Programming PBCST304 KTU BTech CS Semester 3 2024 Scheme - Dr Binu V P

Introduction to Java Programming

Inheritance and Polymorphism