Why do we need this? One of the most difficult aspects of a leadership role is striking a balance between giving direction and encouraging teams to make decisions for themselves. While experience may suggest that a particular solution is likely to be the most effective, it’s unlikely to be successful unless the team commits to it. There’s also a chance that better solutions exist, and given the right environment, teams will often discover these themselves.
Learning (and subsequently trying to explain) monads has become something of a rite of passage in functional programming. Burrito analogies aside, the most helpful description I have come across is given by Noel Welsh and Dave Gurnell in Scala with Cats:
“A monad is a mechanism for sequencing computations.”
Case classes provide a convenient way of working with immutable objects in scala. Manipulating fields within them can be tedious, however. In this post, we will look at how lenses can be used to abstract over this complexity while preserving the benefits of immutability.