Joined February 2014
·

James Hancock

US
·
·

Posted to File nesting with interfaces over 1 year ago

I've worked on these projects where this is done. What you get is code that you can't ever discover what's going on because when you right click and go to definition you get an interface and can't find the implementation that is going to actually execute. If there is one, all you've accomplished is to make debugging and finding code MUCH harder.

This makes new team members and people that have to maintain your code have A HUGE LEARNING CURVE and basically makes your code impenetrable.

Worse, doing Unit Tests based on mocked/stubbed functions defeats the concept of "unit tests"

So again, you're looking for a solution caused by a problem that should never exist.

DI and IOC work well for plugins. I.e. functionality where you need to blind call on an interface and have it point to something that was dynamically loaded.

If that's not the problem you're solving, then you're missing the point and causing yourself a ton of extra work and making your project incredibly hard to maintain for absolutely 0 benefit (And if your reason for doing something that makes all of your coding and maintenance vastly harder is to make testing easier, then you've just shot yourself in the foot.)

Posted to File nesting with interfaces over 1 year ago

If you only have one implementation of an interface, why would you ever induce the complexity of debugging and following code logic? DI and IOC are useful tools in some scenarios, however using them for the sake of using them like this is just a waste of time and effort.

Achievements
1 Karma
0 Total ProTip Views