Ok, so I previously stated that adding ‘Impl’ to the end of your service implementation would get you on my ‘people to kill list’, and that was all I had to say.
Well, although I don’t have anything original to say on the topic, I feel like elaborating.
Disclaimer: if some points sound like lessons in egg-sucking, then that’s because some readers may be currently learning to suck eggs; I’m not necessarily assuming that you need to be told : )
I’m coming at this from a Java perspective – although it probably applies to many other languages too.
Java gives us concrete types, abstract types, and interfaces. Bear in mind that…
- If java supported multiple inheritance then we wouldn’t need interfaces – an abstract class full of abstract methods would make interfaces redundant if not for that shortcoming.
- You don’t need a Java Interface to have an interface. All classes with public methods have an implicit public interface which looks exactly the same as that of a Java Interface.
- At compile time, clients of an interface don’t care whether it’s an implicit public interface on a concrete class, abstract class, or an actual Interface type – the whole point of interfaces (and polymorphism in general) is that client code shouldn’t even need to be aware that they are, or aren’t, using an Interface / concrete class / abstract class.
- Some time back in the day, someone invented sliced bread. Since then, IDEs have been able to extract interfaces – or convert between class interfaces & actual Interfaces – at the click of a button.