Design as If Testing Matters

James Robertson posted today on API Design as if Unit Testing Mattered. If there was ever a way to sum up a topic, this was it. I've designed a few APIs in my day, and in my experience everything in James' post rings true (James is summarizing a talk by Michael Feathers at a conference). The big point is in the title. If you've written tests for your API, then you have experienced your API as a client. I just can't stress how important this is. If writing tests for your API is painful, then how will it be for API customers to use your API?

On the other hand, unit tests aren't a panacea, either. Unit tests are limited in scope, not fully-featured applications. Your tests will likely not run into issues that a fully-featured application would. Still, it's about the best place to start, when it comes to design.

— Gordon Weakliem at permanent link