News for hackers. Stuff that matters.
Re:Generating a Java program with 90% less code by zzbzq on Wednesday December 04, 2019 @12:14PM (#21704169)
I strongly agree with this, but if are using an inversion of control pattern for your business logic vs. I/O, then interfaces are often needed to prevent circular references. If using multiple compilation modules, this becomes evident because the code wouldn't even compile without the interface! When using this design, interfaces can sometimes be required more often than not.

That's the litmus test I use to determine if I need an interface: Will the code compile without it? If not, the interface is declared alongside the code that depends on it, and the implementation is in a second compilation module which depends on the first. Inversion of control.

There are no comments on this comment yet.