Relative Content

Tag Archive for dependency-injection

DI: Can a stable dependency have a volatile dependency?

I’ve recently been reading through Mark Seemann’s Dependency Injection in .NET and have been attempting to apply some of what I’ve learned in a new project I’m working on, and I’m stumped on a particular scenario trying to determine what dependencies I should and should not inject. I’ve read several other questions on SO and elsewhere that discuss similar scenarios but in a roundabout manner, and I think I’ve narrowed the underlying conceptual question to that which is in the title:

Does following TDD inevitably lead to DI?

I learned to do Test Driven Development (TDD), Dependency Injection (DI) and Inversion of Control (IoC) all at the same time. When I write code using TDD I always end up using DI in my class’s constructors. I am wondering if this is because of how I learned to do TDD, or if this is a natural side-effect of TDD.

Who should initialize dependencies in a TDD application?

I’m trying to learn implementing TDD with mocking/fake objects. One of the questions I have is how to initialize a dependency in an application which implements TDD? An example from this article
Beginning Mocking With Moq 3 shows:

How to use DI and DI containers

I am building a small PHP mvc framework (yes, yet another one), mostly for learning purposes, and I am trying to do it the right way, so I’d like to use a DI container, but I am not asking which one to use but rather how to use one.

How to use DI and DI containers

I am building a small PHP mvc framework (yes, yet another one), mostly for learning purposes, and I am trying to do it the right way, so I’d like to use a DI container, but I am not asking which one to use but rather how to use one.