Skip to Content
View all events

Modern Java Exception Handling

Published by Pearson

Intermediate content levelIntermediate

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.

What you’ll learn and how you can apply it

  • Distinguish different categories of things that go wrong
  • Apply appropriate handling and recovery techniques to each of the categories
  • Build maintainable checked-exception handling code
  • Handle problems in code with an approach suitable for functional code
  • Integrate exception-based code into functional code such as Streams

This live event is for you because...

  • You want to create more reliable and maintainable code, particularly with respect to handling errors and exceptions
  • You want to write more functional code, for example using the Streams API
  • You want to integrate code that throws exceptions into functional code, for example the Streams API
  • You’re a college student looking for additional learning resources to help you with a Java course you’re taking

Prerequisites

You should be comfortable writing code in the Java programming language and able to read code of intermediate complexity. Basic familiarity with generics and lambda expressions will help you get the most from this course, but is not essential.

Materials, downloads, or Supplemental Content needed in advance

  • While not required for participation, it’s a good idea if you have a Java development environment (e.g. NetBeans, Eclipse, Intelli-J IDEA or similar) so that you can experiment with the material you learn in the class.

Recommended Prep:

Java Programming Basics

This course provides an introduction the Java Programming Language and would be particularly appropriate for anyone with minimal background in Java before attending this live training.

Modern Java Collections

This course addresses Java’s collections API in detail and builds basic understanding of the generics mechanism from the usage perspective.

Functional Design for Java 8

This Safari-live course explains how to use Java 8’s syntax and new features but is primarily focused on giving you a practical understanding of the deep power of functional programming. In addition, the advent of Java 8 brought syntax that supports and simplifies coding of many key functional programming concepts into what is surely one of the most-used languages of today.(Live class presented at intervals--search Safari for latest calendar)

Schedule

The time frames are only estimates and may vary according to how the class is progressing.

Note: This course is delivered using a story-telling style, so topics are not handled in isolation, but interleaved so as to introduce new ideas in the appropriate context, and allow understanding to build incrementally.

  • Differentiating problem types
  • Three and a half ways of handling problems
  • Three ways of controlling execution path in the face of problems
  • Principles for maintainability

Break (10 minutes)

  • Effective checked exceptions
  • When to use unchecked exceptions

Break (10 minutes)

  • Reliable handling of problems without using exceptions

Break (10 minutes)

  • Integrating exception-based legacy code into functional systems
  • Q&A

Your Instructor

Simon Roberts

Simon Robert's philosophy in training is "understanding is greater than knowledge" meaning simply that although learning facts might be helpful, they can often be looked up. By contrast, it's understanding that allows us to make effective use of those facts, and to extrapolate to new puzzles. Simon is also an FAA certificated flight instructor for Airplane Single Engine and Instrument Airplane, and an avid sailor. He loves to travel and practice speaking French.

linkedinXlinksearch

Skill covered

Java