Learning Functional Programming in the field. Taking examples from two chapters of my book "From Objects to Functions" (pragprog.com) we will see how using a functional approach changes the error handling and the logging parts of our application.
Using exceptions to recover from errors in our programs goes against the principle of functional programming because it will prevent us from defining the logic composing pure functions since an Exception cannot be a valid return value for a pure function.
In this talk, I'll present some possible techniques to handle errors differently and, arguably, make our code easier to read and maintain.
Functional programming also allows us to centralize the logic to log significant events with their context. Instead of using simple string messages scattered along our code, we can define more specific domain events and log them with the full context of the error, removing the need to configure log levels.
The example code presented is in Kotlin, but applying the same techniques in Java or other languages should be easy.