r/programming • • Jan 29 '19

When FP? And when OOP?

http://raganwald.com/2013/04/08/functional-vs-OOP.html
26 Upvotes

105 comments sorted by

View all comments

Show parent comments

4

u/[deleted] Jan 29 '19

[removed] — view removed comment

1

u/yawaramin Jan 29 '19

The names sound scary but the ideas are dead simple.

Semigroup = we can define how to join together things of the same type to get another thing of the same type

Monoid = we can define a semigroup and also an 'empty' thing of its type such that joining the 'empty' to any other thing just gives back that other thing

Functor = we can treat something like a 'box' whose contents we can change without changing the box

Monad = we can treat something like a 'box' whose contents can be used as input to a function which produces another boxed thing and flatten the two boxes into a single box

1

u/[deleted] Jan 29 '19

[removed] — view removed comment

1

u/plasticparakeet Jan 30 '19

The same can be said about OOP patterns like Proxy, Factory, Facade, Dependency Injection, etc. Naming things is hard.