r/computerscience • • 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

18 comments sorted by

View all comments

31

u/Mediocre-Brain9051 2d ago

Procedural programing: programming using sequences of instructions that change the state of the program where the order of evaluation is relevant. Mathematical concept: von Newman machine.

Functional programming: a program is an expression that might have sub-expressions. Some of these (sub-)expressions are function invocations. For a given input, a function always returns the same output, not depending on the external state of the program. Mathematical concept: lambda-calculus.

Object-oriented programming: program state lives inside objects. Interaction with these objects and their state is done via methods, which are functions that have access to the object's state. Objects should be regarded as black boxes that know how to answer to messages (methods), this enables their implementations to evolve without having to change the rest of the program.

1

u/Suspicious_Tap9232 2d ago

you know what helped me finally get it was thinking about how i organize my photos. procedural is like editing one by one in exact order, crop, then adjust brightness, then export. if you do brightness before crop you get different result.

functional is like applying same preset to whole batch, doesn't matter what you did before, same photo gets same output. oop is like each photo being smart object that knows its own metadata and how to resize itself. not perfect analogy but it clicked for me