4 ms·
> I need to know everything that’s going on in my code. I need simple, straightforward function calls. Nothing else! I want to be able to start at main() and tr
by orobinson 4y ago
> I need to know everything that’s going on in my code. I need simple, straightforward function calls. Nothing else! I want to be able to start at main() and trace through the code. I want to look at callers and find where every parameter came from. Reading code is hard enough already. Magic frameworks make it harder.
But these frameworks aren't magic. They're just code. Sure it means you have a bit more code to read through to work out what's causing a problem but it's still just code. The time cost of potentially more difficult debugging when things go wrong is nothing compared to the time saved not having to wire things together manually.
I also find DI frameworks actually encourage good design by making it easier to write small, single purpose classes. You don't need to spend time working out where to initialise them so they can be passed to all the dependent classes.
- pydry 4y ago>But these frameworks aren't magic. They're just code. "Magic" in framework parlance doesnt mean hocus pocus. It just means concealed abstraction.
- orobinson 4y agoYes I’m aware. My point was it’s not that concealed once you’ve invested the time to read the docs and peek at the code of whatever framework you’re using. The time to do that is nothing compared to the time saved using these frameworks. I wasn’t sitting there thinking Harry Potter wrote Spring Boot.
- hot_gril 4y agoSometimes you can easily peek at this, sometimes you can't. I can see there being a good DI framework, but there's easy potential for them to be terrible. Like one of them used at my job cannot be understood from code at all (it uses special build rules) and has awful documentation. The recommended way to understand it is by copy-pasting what others have done. Once you do that, it's tolerable.
- nitwit005 4y ago> But these frameworks aren't magic. They're just code Some of them definitely go beyond "just code", in the sense that they actually change the normal behavior of the code. They intercept method calls, replace classes, etc. Spring is sort of famous for this: https://docs.spring.io/spring-framework/docs/3.0.0.M3/reference/html/ch08s06.html https://docs.spring.io/spring-framework/docs/3.0.0.M3/refere...
- hot_gril 4y agoOr they use macros (e.g. in C++) to create something you can't reasonably read through.
- greenmartian 4y ago> Or they use macros Dark magic is still magic...
- IIsi50MHz 4y agoUntil it's Heavy Wizardry and/or Deep Magic.