4 ms·
I agree, when learning new codebases, the ones that take me the longest time to learn are the ones with many layers of indirection. I view over-indirection as
by guntherhermann 4y ago
I agree, when learning new codebases, the ones that take me the longest time to learn are the ones with many layers of indirection.
I view over-indirection as an anti-pattern and I often see it come from engineers who take the DRY philosophy as dogma.
I have seen countless cases of your second example throughout my time programming, and I'm convinced it comes from the DRY mantra that first-year CS students get drilled into their brains.
- afarrell 4y agoDRY is the easiest rule to tell if you are following, so it is one that people are inclined to follow.
- arkh 4y agoBest example of "good practice" becoming a hassle: the "interface for everything" habit. Even when the majority of those interfaces have only one implementation.
- JamesonNetworks 4y agoI can't stand this. I once worked on a project where there were seven layers of interfaces that all led down to a wrapper around a library and each step was just adding another parameter onto the call in the library. The entire PROJECT didn't need to exist, the owning project could have easily just called the library directly as it already had all the context, maybe with one method to abstract in case we needed to swap the underlying library. I remember thinking I was a bad developer for not "getting it," but armed with 10 more years of experience I've realized it wasn't me.
- patrickthebold 4y agoI've come around on this one. I (now) like having a separate interface, having just method signatures separated out makes it easy to get an overview of the class. It also makes it a bit easier to agree on the interface.
- yCombLinks 4y agoYou have an interface already, without separating it from the implementation: the public methods of the class. In java any IDE will quickly give you the class outline showing you the public methods.