Monad for Scala Newbies
Intended audience: People who come from Java background and just starting to explore Scala/FP and wanna learn what’s a Monad in the simplest way possible.
Intro to Monad
There are plenty of articles in the Internet about Monads but nothing is simple enough to understand for such specific set of audience I mentioned above (like the past me several years back or like my newly joined colleagues).
So in this article I’ll try to explain Monads in a way that is easily understandable for them.
For the intended audience, after reading this article, I suggest to have a look at this video from an expert about the same topic..
I hope the video will be much clearer after reading this article first. Without further ado, here we go..
First lets think about these two jargons — “Imperative Programming” and “Declarative Programming”
Imperative Programming is what you do when you explicitly type instructions for things to happen inside the world of processors, memory and file system etc. Like define this variable, set that value to it, define another variable, increment some counter — all these technical instructions. For eg. Your quick sort or fibonacci program…