Refactoring is one of the important processes in software development. It’s also an accessible opportunity to learn about design patterns through experimentation.
In this talk, we explore examples of code written in familiar imperative programming patterns, and refactor each one using a counterpart functional programming pattern.
Learn how to replace mutable variables with the state monad, loops with folds, thrown exceptions with sum types, dependency injection with the reader monad, and much more. As we go, we will build up a handy bidirectional map of corresponding imperative and functional patterns.
This talk uses Scala to take advantage of its hybrid object-oriented and functional design, which caters to both imperative and functional patterns.