Preferences

If the rules of the dependency injection framework are well understood, the IDE can build a model in the background and make it navigable. I can't speak for C#, but Spring is navigable in IntelliJ. It will tell you which implementation is used, or if one is missing.

In a Spring application there are a lot of (effective) singletons, the "which implementation of the variable that implements Foo is it" becomes also less of a question.

In any case, we use Spring on a daily basis, and what you describe is not a real issue for us.


Is it ctrl+click takes you to the main implementation directly? If not it is reaaaaaallly annoying
I think so.

Also, what I think is also important to differentiate between: dependency injection, and programming against interfaces.

Interfaces are good, and there was a while where infant DI and mocking frameworks didn't work without them, so that folks created an interface for every class and only ever used the interface in the dependent classes. But the need for interfaces has been heavily misunderstood and overstated. Most dependencies can just be classes, and that means you can in fact click right into the implementation, not because the IDE understands DI, but because it understands the language (Java).

Don't hate DI for the gotten-out-of-control "programming against interfaces".

In every language/IDE I've ever used ctrl-click would take you to the interface definition, then you have a second "Show implementations" step that lists the implementations (which is usually really slow) and finally you can have to select the right implementation from the list.

It's technically a flaw of using generic interfaces, rather than DI. But the latter basically always implies the former.

Maybe you should read the manual then. Or change to a better Ide. Both Rider and IntelliJ can do this with no frills.
I’m not sure why you’re being down voted despite being correct.

If there are multiple implementations it gives a list to navigate to. If there’s 1 it goes straight to it. Don’t know about IntelliJ but rider and vs do this. And if the solution is indexed this is fast.

This is the point, you need an IDE with advanced features while a text editor should be all you need to understand what the code is doing..
Why, as a professional, would you not use professional tooling. Not just for DI, but there are many benefits to using an IDE. If you want to hone your skills in your own time by using a text editor, why not. But as a professional, denying the use of an IDE is a disservice to your team. (But hey, everyone's entitled their opinion!)

Edit: upon rereading I realize your point was about reading code, not writing it, so I guess that could be a different use case...

Being able to understand a system under fire with minimal tooling available is a property one must design for. If you get woken up at 3am with a production outage, the last thing you want to do is start digging through some smart-ass framework's idea of what is even running to figure out where the bug is.

There's nothing wrong with using an IDE most of the time, but building dependence on one such that you can't do anything without it is absolute folly.

This item has no comments currently.

Keyboard Shortcuts

Story Lists

j
Next story
k
Previous story
Shift+j
Last story
Shift+k
First story
o Enter
Go to story URL
c
Go to comments
u
Go to author

Navigation

Shift+t
Go to top stories
Shift+n
Go to new stories
Shift+b
Go to best stories
Shift+a
Go to Ask HN
Shift+s
Go to Show HN

Miscellaneous

?
Show this modal