3 ms·
I've had some luck with just hand-rolled DI in certain cases (e.g. a class that I know is mostly coordinating other classes; in that case, I might just inject a
by iainmerrick 7y ago
I've had some luck with just hand-rolled DI in certain cases (e.g. a class that I know is mostly coordinating other classes; in that case, I might just inject all the dependencies manually for easy testing but provide a default constructor for actual production use)
Same here! I think that approach works really well when you’re able to use it.
I’d love to try removing the DI framework and see what you get just rolling it all by hand, but that’s a tough sell in a large pre-existing project.
- Tainnor 7y agoyou could do it as a personal side project without merging it into the mainline and you might learn one of three things: - handrolled is better and the framework stinks - there are some disadvantages to the framework, but after doing it all by hand you also understand how it makes a lot of things easier - it's a tradeoff that largely amounts to which kinds of problems you're personally more willing to put up with (quite likely outcome) in any case you would learn something