OOP has hammers, functional programming has the ability to smash things.
Advocates of OOP, like having specific things to smash with. Advocates of functional programming think just being able to smash is enough because they aren’t throwing thunderbolts, like hammers also can do.
When it comes down to it, if we measure by smash, both Hulk and Thor do it quite well.
It really just comes down to the style of smashing you like to do.
Data-scientist who loves to use #datascienceforgood, especially in ecology, energy and the environment. Bonsai, gardening, bikes and music when I'm not at a keyboard.
In FP functions without arguments are code smell because most probable they contain side effects. So in FP it would be:
const mjölnirSmash = smash(mjölnir);
const newGround = mjölnirSmash(currentGround);
Or with ADT something like this:
const ground = Functor(/* some data */);
const newGround = ground.map(smash(mjölnir));
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
OOP has hammers, functional programming has the ability to smash things.
Advocates of OOP, like having specific things to smash with. Advocates of functional programming think just being able to smash is enough because they aren’t throwing thunderbolts, like hammers also can do.
When it comes down to it, if we measure by smash, both Hulk and Thor do it quite well.
It really just comes down to the style of smashing you like to do.
mjölnir.smash() or smash()
OOP: mjölnir.smash()
// mjölnir is an object
FP: mjölnir.smash()
// mjölnir is a namespace
From Nidavellir import mjölnir as stormbreaker
Stormbreaker.smash()
In FP functions without arguments are code smell because most probable they contain side effects. So in FP it would be:
const mjölnirSmash = smash(mjölnir);
const newGround = mjölnirSmash(currentGround);
Or with ADT something like this:
const ground = Functor(/* some data */);
const newGround = ground.map(smash(mjölnir));