0% found this document useful (0 votes)
9 views

Difference Between Procedural Programming ,Object-OrientedProgramming

Uploaded by

rjohar369
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)
9 views

Difference Between Procedural Programming ,Object-OrientedProgramming

Uploaded by

rjohar369
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

Difference between Procedural Programming ,Object-OrientedProgramming

(OOP) in Salesforce:

Aspect Procedural Programming Object -Oriented Programming (oop)

Programming Style Follows a linear and Organizes code around objects and
sequential execution flow. classes representing real-world
entities.

Code Structure Code is organized into Code is organized into classes and
functions or procedures objects that encapsulate both data
that operate on data. and behavior.

Modularity Limited modularity; High modularity; data and behavior


procedures are are bundled into reusable objects.
independent and may not
share data.

Reusability Code reuse is difficult; Encourages reusability through


functions need to be inheritance, polymorphism, and
rewritten or copied. encapsulation.

Maintainability Hard to maintain as Easier to maintain due to clear


application size grows; structure, modularity, and separation
code is scattered. of concerns.

Extensibility Difficult to extend; adding Highly extensible; new functionality


new features often requires can be added by creating new
modifying existing classes or extending existing ones.
functions.

Scalability Limited scalability; High scalability; OOP promotes


procedural code can better organization, making it suitable
become difficult to manage for large applications.
as complexity increases.

Data Management Data and logic are typically Data and logic are combined within
separated; functions objects, enhancing encapsulation
operate on external data and security.
passed to them.

N.Veera Raghavamma
Aspect Procedural Programming Object -Oriented Programming (oop)

Real-World Modeling Less suitable for modeling Perfect for modeling real-world
real-world scenarios. entities through objects and classes.

Use Cases Best for simple tasks, Ideal for complex business logic,
one-off processes, or small large applications, or reusable
scripts (e.g., basic Apex components (e.g., Visualforce
triggers, utility methods). controllers, Lightning Components).

Flexibility Less flexible; changes in More flexible; changes can be


one part of the code can isolated to specific classes or objects
have widespread effects. without affecting other parts of the
system.

Example in Salesforce Simple function to perform Class-based design, where an object


a task like updating a list of can encapsulate contact update
contacts behavior.

Error Handling Functions handle specific Objects ensure data consistency


cases, but there’s a higher through encapsulation, and errors
chance of data are often handled within the scope of
inconsistency if global data the object.
is improperly managed.

State Management The state is managed Each object manages its own state,
globally or passed explicitly which can be accessed or modified
between functions. by its methods.

Primary Components Functions and procedures Classes and objects with attributes
that manipulate global (fields) and methods (functions).
data.

Code Readability Can lead to scattered code Higher readability as it models


as functions are invoked in real-world entities, with clear
different parts of the structures of objects and classes.
program.

N.Veera Raghavamma

You might also like