This is in response to certain comments made by Zed Shaw in his blog a long while ago.
The experts will then saunter off to implement their Flaming Tower of Babel without any comments, horribly complex mock enabled tests, making sure EVERY SINGLE CLASS HAS AN INTERFACE, and ending every class with “Impl” because, well, that’s the best practice.
I use Spring and Google Guice in equal measures and I've noticed that these frameworks do use the Impl postfix but sparingly. In my code, I use interfaces everywhere because I've been told that it makes it easier to mock etc. Do I have a naive understanding of the issue ? (Perhaps mock frameworks can work with abstract classes or classes, I don't know. I have never tried) For my concrete implementations, I have chosen the Spring convention of prefixing the name of the implementation with the word Default.
e.g. BottleOpener (interface) is implemented by DefaultBottleOpener (class)
What is the best practice on this issue ?
UPDATE1 I find it useful to return an interface from a method because I can always return an anonymous class.