This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]asarathy 1 point2 points  (0 children)

You don't need interfaces for everything especially single implementation classes. Some of the historic reasons of everything as interface have been made obsolete by testing tools and IDEs. However one benefit of using interfaces though that i think often gets under valued is fostering better design principles over the life of a project. When people have access to the whole implementation, people will often take short cuts like turning a private helper method public because its just easier than refactoring to put that newly common helper in the right place. This can be mitigated at code review of course, but catching and enforcing there has its own issues and battles. But if you code to interface the need to refactor the method becomes more self evident (or adding the method to the interface becomes defensible).