Skip to main content
8 events
when toggle format what by license comment
Oct 3, 2017 at 19:32 vote accept Deane
May 27, 2016 at 13:50 comment added David Arno @kai, Smurfs rule in ASP.NET MVC! :)
May 27, 2016 at 13:08 comment added sara I think that the very notion of tying the concept of DI to big XML configs, arcane conventions and all-around heavy frameworks is "harmful". It'd be like saying that "MVC is a project template by microsoft that requires you to name all your controllers 'NameController'"
May 27, 2016 at 12:23 comment added Caleth Note that for a small example, this will seem like a massive overkill. It is, but the benefit is that it forces you the programmer to think about compartmentalizing your code.
May 27, 2016 at 12:17 comment added k3b +1. to answer @Deane-s comment: Implementing “dependency injection” means that the code has an api to handle "“dependency injection” (via constructor parameter, properties, methods,....). The DI container is responsible to handle the "global state" for the "entire program" (i.e. as a singleton or "every time they're created")
May 27, 2016 at 12:14 comment added Caleth @Deane suppose you have a class Foo { List<Bar> bars; Baz baz; ... } without DI the constructor is public Foo() { bars = new ArrayList<Bar>(); baz = new SpecificBaz(); } and therefore the exact concrete subtype of List and Bar and Baz is tied to Foo. DI is allowing any List / Bar / Baz. All the other 'DI' stuff is just things trying to make life easier in that paradigm.
May 27, 2016 at 11:51 comment added Deane Do you have "pass dependencies" to every object every time they're created, or can those dependencies exist in a global state? So, you pass dependencies to the entire program, and expose them globally in such a way that multiple parts of that program can use them.
May 27, 2016 at 11:45 history answered Julia Hayward CC BY-SA 3.0