title: What are the benefits of AngularJS dependency injection?
body: <p>I have been working with Angular for some time now, and I fail to see how it is an improvement from my previous way of coding.</p>
  <p>First, I can't see what's wrong with having a central object to hold your project. After all, the injector is a singleton that looks up your dependencies into a central place, so Angular does have a central object, it's just hidden. Namespacing doesn't necessarily mean coupling, if it's done properly. And even when it's done, you don't need every single object of your code to be loosely coupled with the others. Besides, anytime you create a standalone JS script, you have to wrap it into Angular to make them play nice together.</p>
  <p>Second, it's very verbose to declare all your dependencies everytime (especially with minification), so there is no gain from the readability point of view compared to proper namespacing.</p>
  <p>Third, the performance gain is minimal. It forces me to use singletons everywhere, but I can do that on my own if I need to, and most of the time, I don't (network and DOM manipulations are my bottleneck, not JS objects).</p>
  <p>In the end, I like the &quot;enhanced&quot; HTML and the automatic two-way bindings, but I can't see how the injection makes it any better than the way other frameworks deal with dependencies, given that it doesn't even provide dynamic loading like require.js. I haven't see any use case where I say to myself &quot;oh, this is where it's so much better than before, I see&quot; while coding.</p>
  <p>Could you explain to me what benefits this technical choice brings to a project?</p>
  <p>I can see only one for now: convention and best practice enforcement. It's a big one to create a lib ecosystem, but for now I don't see the fruit of it in the Angular community.</p>