I see over and over again in projects and reviews the following "best practice":
Basically: for every interface there is an implementation with the "Impl" ending. That's not enough: sometimes both are configured in a XML-File (probably to emphasize the importance of this pattern :-)).
Service service = new ServiceImpl();
That is not only bloat (and the opposite of "Convention Over Configuration" idea), but it causes real damage:
- Imagine you get another implementation (thats the whole point of an interface) - how would you name it?
- It doubles the amount of artifacts - and significantly increases the "complexity"
- It is really funny to read the javadocs on the interface and the impl - another redundancy
- The navigation in the IDE is less fluent
I asked why developers are writing such code, but didn't got any reasonable answer, except "because of mocking".
This is, however, no more true for several years. Any ideas, why you are doing that?
NEW 2016: Java EE 7 Workshops: Bootstrap, Effective, Architectures, April, 4th-6th, Munich's Airport
On demand workshops: Java EE 7 Bootstrap, Effective Java EE 7 and NEW: Java EE 7 Testing are available for streaming