The enormous power of monads practically explained
One of the great things about being a programmer is that you never stop learning. Even after 40 years, I still improve in how I code. More recently, the way I write code shifted once again when I started to apply monads in my code.
During one of our projects, my team created a small library that ported the behavior of the Scala Try monad to Java. Although at first, this new monadic code didn’t appeal to me, I soon started to appreciate this style of programming, where we chain methods, using pure functions and lambda’s, avoiding abundant try-catch blocks, and many if statements and null checks.
In the meantime, we have contaminated many devs with this coding style, and we created various other monads in Typescript which we use every day (and we’ve put them in open-source in the Easy.ts framework, see https://github.com/thisisagile/easy). We made it a sport to always start methods with a return statement. This talk explains and demonstrates the power of monads in understandable language, using many code examples (in Java, C#, and TypeScript).
What you’ll learn
- A short history of coding styles
- What are pure functions?
- Why are pure functions so useful?
- What are monads?
- How do monads work
- Why would you use monads in your code?
- Showing a range of useful monads in various programming languages (such as C#, Java, Typescipt), with live coding.
As a programmer, you never stop learning. Recently the way I code changed dramatically when I consciously started to apply monads, starting with a port of Scala’s powerful Try monad. During this talk I’ll discuss lambda’s, closures, and monads, and build a simple Maybe monad, demonstrating the power of monads, using many code examples (in Java, C#, and TypeScript). Don’t hesitate to join in.