Talk: You're Doing Exceptions Wrong
Abstract
Exceptions are powerful and valuable, but we frequently misuse them and destabilize our applications. We fear users seeing an error message, so we swallow the exception, creating troubleshooting nightmares down the road. We fail to check inputs and throw them at all, letting garbage into our databases that ruins our application’s correctness. When we do actually get around to throwing an error, we use unclear messages that mislead and distract or we go overboard and cover our entire codebase with annoying try-catch blocks that make the code impossible to read.
It doesn’t have to be this way! This talk will tell you about numerous exception-related antipatterns and how to fix them. You’ll get practical examples born of real-world codebases that show you how to design your systems in ways that are easy to troubleshoot. If you’re new to object-oriented programming with exceptions, you’ll get a lot out of this talk: you’ll learn how to do exceptions the right way and enjoy safer and more maintainable code.
Background
When I first started programming, I was terrified of a user seeing an error message. I’d catch exceptions everywhere I could and hope to keep fumbling through. But handling the exceptions that way didn’t make the system more stable; it just swept the problem under the rug. Troubleshooting was difficult, and data became corrupted and caused bugs days or weeks later.
When I consult with clients having problems with large enterprise systems, poor error handling is a significant contributor to slow velocity and customer complaints. I’ve learned to embrace and use exceptions effectively: not hiding them but exposing them to the light of day to ease troubleshooting and remediate issues faster.
Agenda
This is a 1-hour session aimed at developers who are newer in their careers and working primarily with object-oriented back-end languages like Java or C#.
I plan to cover:
- A taxonomy of exception types
- Writing good error messages
- Collecting good debugging context
- Catching the right exceptions in the right places
- Making exceptions impossible
- Validating inputs
- Error logging
You can still get tickets at https://codemash.org — I hope to see you there!