3 ms·
One reply to address the others. Yes, Spring does not require iface proliferation - it just makes life easier when you decide you need different implementations
by locopati 17y ago
One reply to address the others. Yes, Spring does not require iface proliferation - it just makes life easier when you decide you need different implementations of the same idea if you've committed to ifaces up front. YAGNI still holds true since it's usually easy enough to refactor in an interface when it does become necessary.
As far as comments about the ugliness of Java in this regard, I couldn't agree more. However, Java is Java and Python is Python, etc. If you are working in Java, and a lot of people are and don't have the option of switching to something else (think corporate, where what is common and familiar is good), if you are committed to Java, then you must embrace its paradigms. Interfaces and implementation classes are one of those. Enjoy it without fuss and focus on the problem at hand. You'll lose less sleep that way.