Commonly Compared
Dependency Injection
vs
Review of Dependency Injection powered by the Slant community.
For a basic example in C# using Castle Windsor, see here.
Ranked in these QuestionsQuestion Ranking
Pros
Pro More decoupled code
Since the class doesn't have to know anything about the outside world, everything is more decoupled. If your class would have to fetch its own dependencies then it would have to know where to find them, and as a result, it would have to know about the larger application.
Pro More flexible code
Since your class doesn't have to know about the concrete implementation of the dependencies, it makes them very flexible.
Cons
Con Steep Learning Curve
Significant effort is needed to grasp DI and use it correctly.
Commonly Compared
Dependency Injection
vs