Hacker News new | ask | show | jobs
by VladRussian 5299 days ago
> If/when you have multiple concrete objects which share the same interface, it's trivial there to switch references from the concrete type to that of the Interface

you're a lucky person that it has been trivial for you, your teammates and all the known and unknown clients of your code and components. I can only envy your experience.

1 comments

Lots of Java development is carried out for internal business applications and like it or not they would typically be integrated with third parties using something like SOAP or a shared database. So in this type of application the choice of a concrete class over an interface probably has little impact on the known or unknown clients of your code.

However, as you point out, if you are presenting a Java API to your known and unknown clients you had better think carefully about which abstractions you are going to expose and interfaces are probably going to be very helpful.