The problems with dependency injection and service locators solved
For ant introduction to Dependency Injection and Service Locator, see the post in the bliki . The problem with dependency injection frameworks are: With the frameworks: I don't want to annotate or anything. I want to write vanilla code There should not be one single place that has to know about every thing else. It is the ultimate violation about the open-closed-principle. Even if it is in main. Configuration explodes with dependencies of nested stuff. Main is on the top level and has no idea what some low level stuff should need Allowing only two presets (like dev and prod) sounds just stupid. Tests should no have to configure anything they don't need, but should be able to configure anything they want All in all dependency injections feels soooo heavy. Service Locators on the other hand - especially dynamic ones - are very easy to implement, understand and lightweight to use. But they have two major downsides: They hide dependencies You have to implement it in a way that t...