Tapestry, and Less Configuration Tangosol Info via RSS
Aug 16

Explaining why Dependency Injection is good

Tech Add comments

Rickard has done a really good job and explaining why DI is good.

In a very simple, scientific way, he details the simpliest of examples (Foo depending on Bar), and shows how the properties of different designs affect your agility.

I really like how he explains these properties:

This code has the following properties:

Bar can be a class, an abstract class, or an interface
Foo does not need to know how Bar is instantiated
The Bar instance can be used by other components
Bar can have any configuration needs
The user of Foo needs to know how to provide a Bar

Many people know that they enjoy moving to this model when designing their code, but don’t know how to explain why they like it so much. On one hand people say “it is just a constructor / setter / …”.

Leave a Reply

Spam is a pain, I am sorry to have to do this to you, but can you answer the question below?

Q: What are the first four letters in the word British?