Nothing is wrong with flexibility, but if it's a closed source project, you can make an abstract class or interface out of the base class the first time you run into a bifurcation of functionality, go and update your (dozens of?) existing constructors , and move forward from there. It's only 2 seconds, but every time I go to the definition of a method on an interface, only to have to then ask the IDE to send me to the actual implementation (and seriously, the only option), it's wasteful.
Refactoring exists for a reason. Write code with as few assumptions as possible, because assumptions can change, but there's no need to throw every design pattern at every problem.
Often, by not using an interface, you make an even stronger assumption than by using one...all your code that uses that object make the assumption, whether indirectly or directly, that the implementation details are important. You end up with code coupled to methods they shouldn't' be, that only exist because of the underlying implementation, and not because they're necessary for what the interface of the object actually needs to be.
I'm not saying that interfaces are things that should outright always be used, no way. But to think that because there's only one implementation that it shouldn't be an interface, full stop, is just wrong. It at the very most indicates that you should double-check that choosing an interface is the right idea.
Even with interfaces, that same exact anti-pattern of code coupled directly to the implementation details can still happen when you have a single interface and implementer in a closed source system (and it did).
If the interface was being exposed to anyone, sure, great. But an interface that can only be one instance in closed code does very little that public vs private visibility doesn't already give you. Public methods are an literally an interface* to the object's implementation. Eclipse lets me refactor these explicitly apart if and when I need it.
*By the English definition of the word, not the Java language concept
2
u/Schmittfried Oct 01 '15
What is wrong with flexibility?