// Without Dependency Injection var Foo = function() { this.bar = new Bar(); } var foo = new Foo(); // With Dependency Injection var Foo = function(bar) { this.bar = bar; } var bar = new Bar(); var foo = new Foo(bar); Pretty simple. You’ll notice that dependency injection requires more code. Well, pretty much anything you do to decouple code will end up with more code in the end, but it’s the main