Screaming Coder

Adventures in the land of extreme programming.


In short, decouple external stuff from your business logic. Here’s a comprehensive description.

External stuff:

  • DB
  • web (and other) frameworks
  • HTTP clients
  • file system
  • third party APIs

Decouple this by using adapters – classes that are POJOs at first glance, but their internals hide hideous stuff like JDBC connections, HTTP clients, arcane code snippets from Stack Overflow for handling third party crap, you get the picture.

Adapter classes should be very small because ideally they shouldn’t have tests. If they had tests, the tests would have to use the external stuff, which would make them slow. You don’t want slow tests. All your tests (not each, all) should execute in 1.5 secs. Or how ever long you’re prepared to wait every time you run them. Which should be very, very often (think twice per minute).

%d bloggers like this: