1 November 2024 Modern Java Exception Handling

It’s well known that some of the hardest code to write well is the code that handles things going wrong. In some systems, a special return value indicates a failed function call, Java uses exceptions, and–essentially unique among languages with widespread use–introduced checked exceptions. The checked exception idea is widely criticized, but if used well, it can be very effective in creating more reliable and maintainable code.
More recently, the trend in programming has been towards a more functional programming style, and Java 8 encouraged this with new language features and APIs. Unfortunately, exceptions (whether checked or not) are fundamentally incompatible with pure functional programming, and can be very messy even in a pragmatic “somewhat functional” style.
This session examines the foundations of handling situations that deviate from the “happy path” of our program code, builds a strong understanding of how, when, and whether, to use checked exceptions, and explains how to handle these situations in functional code such as Streams. The session also builds a practical, reusable, approach to solving the problem of integration exception-based code into newer functional code.

Learn more: Modern Java Exception Handling

Also, you might like to subscribe to Heinz Kabutz’s monthly email listing his favorite upcoming courses on the O’Reilly platform. Sign up here