DEV Community

Discussion on: What programming concept did you struggle the most with?

Collapse
 
vtrpldn profile image
Vitor Paladini

I share the experience with OOP, it took me a lot of "this pen is an object, it has a method write() and an attribute color" example for me to finally learn it.

Considering monads, I have yet to step into FP for that sole reason, some concepts look real hard.

Collapse
 
pj profile image
Paul Johnson

I feel with monads experience using them in a variety of ways might be more useful than reading about it. My explanation of them would be "they're a reification of computation", which is totally useless unless you've already spent a bit of time with them practically.

Thread Thread
 
vtrpldn profile image
Vitor Paladini

Makes sense, oftentimes some concepts only "click" for me after a few weeks applying it naively.

GraphQL is a recent example, I was weeks into a project when I finally realized: "Oh, THAT'S why it is better than REST in this situation".

Collapse
 
austindd profile image
Austin • Edited

Monads aren’t nearly as complicated as people make it seem. It’s literally just a generic interface. Kind of like how you can have array.map, linkedList.map, or promise.map... all those types have a sort of common interface. Those are all “functors”. Monads are the same kind of thing, except in addition to map they have flatmap, which is basically just a different version of map which flattens nested results. This allows certain operations to be easily “chainable”. And that’s pretty much it.

Boom - monads!