Ok, I’m about to go on a rant, because I come across something regularly that really, really, REALLY irritates me:
Whenever you see a class that implements an interface SomeName, and the name of that class is SomeNameImpl.
Guess what folks, EVERY implementation of an interface is an ‘Impl’. If you suffix ‘Impl’ at the end of your class name, you’re being short sighted and portraying a potential lack of understanding of Interface-Driven Design: that you can have more than one implementation.
What if you ever create a new implementation? What if, when testing other components, you create a TestSomeName implementation or a MockSomeName implementation? Then the SomeNameImpl doesn’t make much sense anymore, does it? It could be a cause of confusion as to why you have more than one ‘Impl’, or, worse, perhaps it might make people think that you should only ever have one ‘Impl’.
Instead, if you need a default implementation, and can’t yet think of other cases where you might have other implementations, just call it DefaultSomeName. Then you’re telling the world, “Hey, this is our default implementation of this interface, and if any more ever are needed, we can create them, prefixed with a more meaningful name.”.
Yes, I’m an OO naming zealot, but you’d be surprised at how this little change, in conjunction with other ‘trivial’ changes, make code more readable, easy to understand, and most important, adaptable to change over time.