4 ms·
I see the dependency injection as the solution to a massive problem I couldn't see an obvious solution to with Backbone.
by afandian 13y ago
I see the dependency injection as the solution to a massive problem I couldn't see an obvious solution to with Backbone.
- camus2 13y agoYou dont need angular for dependency injection , there is a lot of JS IoC containers on npm already.
- Glide 13y agoI think that might be the main reason I find angular attractive when compared to mostly DIY approaches with backbone. Sure I can build a best of breed utilizing a wide range of libraries together with backbone... Well I would think I am intelligent enough to do that but in the end it feels like it's based a lot more on opinion rather than fact. I rewrote an admin backend in half the time it took someone to do it in backbone with their choices of libraries. YMMV, but I am loathe to get into another discussion of which templating library to use, which UI widget things, etc., etc. Just let me build it already! And take care of 90% of the annoyances for me.
- camus2 13y agoI prefer building my own stack. Refactoring is quicker down the road has I dont have to rewrite all the application.With angular you'll just be writing Angular plugins when things change ( and they will , Angular is not the ultimate JS framework ) ,you'll be stuck with Angular or waiting for an update, i'll just be swaping a layer in my application ).
- v13inc 13y agoWhat problems do dependency injection solve for you? I haven't had a chance to use it yet, and I've always been curious about its benefits in real projects.
- camus2 13y agoEverytime you pass arguments to a constructor or a method,if the parameter is itself an object you will call a method on (message passing), you are doing dependency injection. So it's a fancy word for a basic idea. The OP is talking about an IoC container or a service locator. which is a tool that will wire up and build objects on demand according to a definition. The alternative is writing factories( ex : document.createElement("DIV") is a factory method ).
- Fauntleroy 13y agoI generally use browserify to handle dependencies the same way I do in node.js. It's worked pretty well for me so far. https://github.com/substack/node-browserify https://github.com/substack/node-browserify