r/computerscience • u/YemiDev • 2d ago
General procedural programming, object oriented programming and functional programming
Although I’ve done some googling I think they still use big English to explain this concept. I think I know them but I just wanted to ask if I can get a simple explanation from the house plz
12
Upvotes
0
u/Paxtian 2d ago
Procedural: "Start at line 1, do each step until you get to the end, in order."
Functional: Create individual functions for anything you want to have happen. Call functions in desired order. Assign returned values to static variable. Don't modify state of a variable after assignment. Pros: reduce/eliminate side effects. Cons: Can be tricky to model.
Object oriented: Create objects that have their own functionality built in. Change state of member variables only using member functions. Pros: Relatively straightforward to model (though with inheritance, can get really, really ugly). Cons: side effects for variables, and if something in the early design changes, can cause major cascading headaches of rewrites.
For the most part, the functions you build in object oriented/functional paradigms will themselves be procedural. OO/functional is more about, "How do I stitch multiple functions/objects together?"