Failure Patterns in Java

When: 7th Jun 2017, 18:30 - 7th Jun 2017, 20:00
Where: BCS, 1st Floor, The Davidson Building, 5 Southampton Street, London, WC2E 7HA
Town/City: London
Organiser: BCS SPA SG
Price: Free
Further Information: Further Information


As developers, we have a tendency to focus on what our code is supposed to do, the happy path. Unfortunately, the real world is rarely that simple. Our code fails: it fails frequently, in many different ways. Code that is simple when expressing the happy path very quickly becomes complex and cumbersome when expressing the reality of the situation.

One approach to this rising complexity which has proven attractive in functional languages is railway-oriented programming: a way of representing two parallel paths through the code, one for success and one for failure. I'll be discussing a way to do this in Java, why it's desirable over more traditional approaches, and how it solves some Java-specific issues like exception-handling when using Streams.

Once you have this concept of railway-oriented programming, you start to see common patterns of failure that crop up time and again. I call these failure patterns, and taking a functional approach to Java makes it much easier to abstract over these, creating reusable solutions. I'll talk through a couple of examples, showing how you can easily build good DSLs that are highly specific to the use case, while still integrating well with basic constructs.

About the Presenter

Tom Johnson is a born-again software developer: having left insurance to study computer science, he has since worked in pensions administration, then at LMAX exchange, and now at Unruly, where he tries to balance his interest in functional programming with the fact that we're working in Java by building and evangelising as much of a functional approach as Java allows.