tl;dr When tests are hard to write, it’s because they are trying to tell you how the production design can be improved. Probably the biggest breakthrough during my Unit Testing workshop is to realize that …
best practices
Pragmatic Dependency Injection
Any non-trivial codebase out there benefits from Dependency Injection, for two main reasons: to be able to pass in a proxy or a decorated version of the target dependency, or a mock for unit testing …
The Clean Switch Rules
From all the syntax constructs of modern programming languages, the switch construct is the most prone to degenerate into an unmaintainable mess unless we take aggressive actions. This article introduces the rules to follow to …
Exception Handling Guide in Java
This article presents a pragmatic, clean approach to working with exceptions in the Java applications we build today.
Presenting Exceptions to Users
Many applications want to present the errors to their users in a nice human-readable form. This article covers some widely used best practices on this topic. Before we even start, let’s make it clear: NEVER …