You said OOP is easy to grasp because it mimics the way people think about the world.
Ihe Onwuka
2

Hi Adam,

Functional vs OO programming is really about how you organise problem solving.

OOP organizes processing around data types. You declare a data type and then have methods for each thing (function) it is supposed to do.

FP organizes processing around functions. You declare a function and then methods for each data type saying how to do the thing for that data type.

OOP
Class Egg
Scramble()
Poach()
Boil()

FP
fn Boil
Egg()
Potato()
Spinach()

If you are talking about how people think most people think about writing programs to do things. If someone asks you to write a program to calculate a square root the first thing most people think about is a square root function, not a number class that has to have a square root method.

The reason people don’t do functional programming is not because of how they think programs should be organised, it is because they usually don’t understand it’s idioms.

Show your support

Clapping shows how much you appreciated Ihe Onwuka’s story.