Why do default implementations have such bad names?
Small rant about class names in Java, or more specifically classes who are the sole implementation of a particular interface. You go to the effort of coming up with a good name for your interface, e.g. IndexSearcher, but then the class name is enevitably one of:
- SimpleIndexSearcher
- IndexSearcherImpl
I’m guilty of this. There must be a better way to name our classes!?!
Don’t forget the other pattern, if IndexSearcher is your class, then IIndexSearcher is your interface. I hate that one too.

June 17th, 2006 at 9:25 pm
Hungarian notation has fallen out of favour for a reason. .NET appears to have brought back the I prefx for interfaces and there is no need for it.
June 19th, 2006 at 9:04 am
I don’t see what’s wrong with those two names… Why would you have something intentionally as the “sole implementation of a particular interface” with no intention of adding further implementations? Which means either of the two names suggested might be OK (although ‘SimpleIndexSearcher’ is more descriptive than the ambiguous ‘IndexSearcherImpl’).
Or you could have done with it and name classes after random European cities
June 19th, 2006 at 11:58 am
I just feel it’s a code smell, normally indicating that there was no reason for the interface and implementation to be split in the first place.
June 19th, 2006 at 2:22 pm
What about places where you want to have alternative implementations, but only provide one. Two examples spring to mind. DateFormat/SimpleDateFormat and Calendar/GregorianCalendar. Obviously if there will only be one implementation then you’ve designed it badly.
June 19th, 2006 at 2:58 pm
If there are other possible implementations, e.g. Calendar/GreogorianCalendar, then the split is justified. But creating an interface with just one implementation can lead to implementation details in the interface. e.g. In the Calendar interface you have constants representing months that belong to the GregorianCalendar, but Lunar calendars have 13 months so you get the silly UNIDECEMBER constant. IBM’s icu4j project reimplemented Calendar to better support subclassing for different calendar types.
I don’t like the name SimpleDateFormat because the class is anything but simple. It’s a comprehensive implementation of a date formatting language, and its name should reflect that.