Procedure Oriented Programming VS Object Oriented Programming

Procedure Oriented Programming VS Object Oriented Programming

Feature / गुण

Procedural Programming 

Object-Oriented Programming 

Definition

Program को functions/procedures में divide किया जाता है, और data के operations को step-by-step execute किया जाता है।

Program को objects में divide किया जाता है, जिसमें data (attributes) और methods (functions) together होते हैं।

Focus

Functions और logic पर focus होता है।

Objects और real-world modeling पर focus होता है।

Data Handling / Data Management

Data generally global variables में store होता है।

Data encapsulation के साथ objects के अंदर सुरक्षित रहता है।

Modularity

Function के रूप में modules create होते हैं।

Class और object के रूप में modules create होते हैं।

Reusability

Function reusability limited होती है।

Classes और objects के जरिए high reusability possible है।

Maintenance

Large program maintain करना difficult हो सकता है।

OOP programs maintain करना easy और scalable होता है।

Examples

C, Pascal, Fortran

C++, Java, Python (OOP style), C#

Inheritance

Supported नहीं

Supported – code reuse के लिए possible

Polymorphism

Not supported

Supported – same function different objects में अलग behavior दिखा सकता है

Encapsulation / Data Hiding

Mostly नहीं

Supported – data और functions को object में hide किया जा सकता है

Real-World Mapping / Real-Life Modeling

Real-world entities को directly model करना Difficult

Real-world objects और relationships को आसानी से model किया जा सकता है

Key Points :

  • Objects : Real-world entities (जैसे Car, Student, Bank Account)
  • Classes : Objects का blueprint या template
  • Attributes : Object की properties
  • Methods : Object के actions

Example :

  • Class : Car
  • Object: Red Honda Car
  • Attributes : color = red, brand = Honda
  • Methods : start(), stop(), accelerate()
error: Content is protected !!