I was recently cleaning up some Scala code I’d written a few months ago when I realized I had been structuring code in a very confusing way for a very long time. At work, we’ve been trying to untangle the knots of code that get written by different authors at different times, as requirements inevitably evolve. We all know that code should be made up of short, easily digestible functions but we don’t always get guidance on how to achieve that. In the presence of error handling and nested...