3 ms·
Is it wrong that I judge anyone that calls DI "black magic"? Clearly it's just computers all the way down and even spring DI isn't that hard to follow. It's on
by jayd16 2y ago
Is it wrong that I judge anyone that calls DI "black magic"? Clearly it's just computers all the way down and even spring DI isn't that hard to follow.
It's one thing to call it bloated or annoying or tedious but why are we proud to announce we didn't do the work to figure it out?
- psychoslave 2y agoWhat do you call DI here? Black Magic is doubly negative here, but I guess that it can fueled with the feeling that less automagic in a codebase helps downstream debug and moving to maintenance mode, as it increase the chance to let a quick grep reveals immediately where the associated code is.
- kebsup 2y agoI'd consider a lot of spring annotations "black magic" , because you can't simply go to definition and see how/what they do.
- gf000 2y agoYou... literally can? Yeah, you may have to grep for the annotation's name, but it's not like it's hidden/closed source/whatever.
- hu3 2y agogrep for annotations... That mentality is how you get death by a thousand cuts. Cognitive load matters.
- gf000 2y agoSearch within your IDE, do a Google search, whatever suits you. What mentality? And the cognitive load is to RTFM, so that you understand what are you doing. If that leaves any questions you can attempt to do a deep dive. It's not particularly high cognitive load to know that @GET is a get rest endpoint. How is that different without annotations? Documentation is also your best bet at first in case of a normal library function call. Jumping into that codebase can also be quite involved, depending on what it does.
- hu3 2y agoThis is 2025. If you can't jump to your own code implementation without having to search for strings, your tech sucks. And most of your message doesn't even apply. How would I Google or read the manual for my own code? We're talking about different things it seems.
- pjmlp 2y agoWith a 1980's technology out of Xerox PARC, it is called IDE.
- hu3 2y agoExactly. Although from the reply I got above it seems to be alien tech to some.
- gf000 2y agoThere was a 'may' in my original comment. It is metaprogramming, so you can't see every usage automatically even with "alien tech" like IDEs, unlike in case of a normal type. Especially that we are not even talking about own code, but third-party annotations with its third-party consumers. Also, grepping is a pretty standard term, it doesn't necessarily mean literal CLI grep, but go on with your advanced tooling as if no one else would be familiar with an IDE.
- marginalia_nu 2y agoSpring's annotations arguably are black magic, but while Spring offers DI, DI is not Spring, and honestly something like Guice is a lot easier to follow since it only does annotation-based DI and not a bunch of other stuff.