VISIT GITHUB TO SEE MY PROJECTS GO

DIFFERENCE BETWEEN PROCEDURAL AND OBJECT ORIENTED PROGRAMMING LANGUAGES | survnor.blogspot.com

Please wait 0 seconds...
Scroll Down and click on Go to Link for destination
Congrats! Link is Generated



 One way to explain the difference between procedural and object-oriented programming is to use an analogy. Imagine that you want to make a cake. In procedural programming, you would follow a series of steps or instructions, such as:


1. Preheat the oven to 180°C.

2. Mix flour, sugar, eggs, butter, and baking powder in a bowl.

3. Grease a cake pan and pour the batter into it.

4. Bake the cake for 25 minutes or until golden brown.

5. Let the cake cool down and decorate it with frosting and sprinkles.


In object-oriented programming, you would think of the cake as an object that has data (such as ingredients, shape, size, color, and flavor) and behavior (such as mixing, baking, cooling, and decorating). You would create a class called Cake that defines the data and behavior of all cakes. Then you would create an instance of the Cake class, which is a specific cake object that you can customize with your own data and behavior. For example:


Cake myCake = new Cake(); // create a new cake object

myCake.setIngredients("flour", "sugar", "eggs", "butter", "baking powder");  // set the ingredients data

myCake.setShape("round");  // set the shape data

myCake.setSize("large");  // set the size data

myCake.setColor("yellow");  // set the color data

myCake.setFlavor("vanilla");  // set the flavor data

myCake.mix();  // call the mix behavior

myCake.bake(180, 25);  // call the bake behavior with parameters for temperature and time

myCake.cool();  // call the cool behavior

myCake.decorate("frosting", "sprinkles");  // call the decorate behavior with parameters for topping and decoration


The main difference between procedural and object-oriented programming is that in procedural programming, you focus on the sequence of actions or instructions that are performed to achieve a task, while in object-oriented programming, you focus on the objects that represent the entities or concepts involved in the task and how they interact with each other. Some of the advantages of object-oriented programming over procedural programming are:


- It allows you to model complex systems more naturally and intuitively by using real-world concepts and entities.

- It promotes code reuse and modularity by allowing you to create classes that can be inherited or extended by other classes.

- It provides data abstraction and encapsulation by hiding the internal details of an object from other objects and exposing only the relevant data and behavior.

- It supports polymorphism and dynamic binding by allowing you to use different implementations of an object's behavior depending on its type or context.


SOME PROCEDURAL-ORIENTED PROGRAMMING LANGUAGES:


1. C
2. FORTRAN
3. ALGOL
4. COBOL
5. PASCAL

SOME OBJECT-ORIENTED PROGRAMMING LANGUAGES:

1. JAVA
2. C++ 
3. PYTHON
4. JAVASCRIPT
5. C#

You can learn more about procedural and object-oriented programming from the below sources. I hope this helps you understand the difference between them. 😊

(1) Differences between Procedural and Object Oriented Programming.


(2) Difference between procedural programming and object-oriented ....


(3) What's the difference between a procedural program and an object ....


(4) Object-Oriented vs Procedural Programming: Difference and Comparison.


(5) Procedural Programming and Object Oriented Programming in C++ - Scaler.


Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.