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. Uberto Barbini Uberto is a polyglot programmer with more than 20 years of experience designing and building successful software products in (too) many industries. He discovered his love for programming when he wrote a video game on the ZxSpectrum in the 8-bit era. He is still very passionate about writing the best code to deliver value to the business, in the shortest time, and not only once but at a regular pace. When not coding, Uberto loves public speaking, mentoring, and writing. He wrote about Functional Programming in Kotlin (https://pragprog.com/titles/uboop/from-objects-to-functions/), O'Reilly 97 Things (https://www.oreilly.com/library/view/97-things-every/9781491952689/) and DDD (https://leanpub.com/cronache-di-domain-driven-design) You can read his blog here: https://medium.com/@ramtop ------------------------------------------------------------ INTRO * visuals & editing by @Mercator * music : Avocado by Ephixa
Get notified about new features and conference additions.