PMBottas (4) [Avatar] Offline
#1
Hi,
old programmer, new to DI...
In section 1.3.2 you state:
"Ironically, DI CONTAINERS themselves will tend to be STABLE DEPENDENCIES, because they
fit all the criteria. When you decide to base your application on a particular DI CONTAINER,
you risk being stuck with this choice for the entire lifetime of the application..."


As you are ...stuck with this choice... isn't this more of a VOLATILE DEPENDANCY?

Message was edited by:
PMBottas

Message was edited by:
PMBottas
mark.seemann (383) [Avatar] Offline
#2
Re: DI CONTAINER are STABLE DEPENDENCIES
Hi

Thank you for writing.

The distinction between Stable and Volatile Dependencies isn't about the degree of coupling. The distinction is about the degree of pain, if you will. The more pain a dependency will tend to cause, the more you'd want to decouple the rest of the code from the dependency.

Stable Dependencies tend to cause little pain, while Volatile Dependencies tend to cause more pain.

The distinction between the two can be used as a selection criterion to figure out where to put Seams in your system.

HTH

Mark Seemann
PMBottas (4) [Avatar] Offline
#3
Re: DI CONTAINER are STABLE DEPENDENCIES
Thanks Mark,
After re-reading these sections three or fours times, (esp. the criteria bullets) the distinctions between the two became clearer. I've been programming since 1978, so I've got a lot to un-learn before I start to learn again.

For any given programming solution, there are some things you have just got to make a choice and stick with and then, from that point on, they are there for the life of the solutiuon, short of a total rewrite (like which language to implement in.) It appears that the choice of a particular DI framework/CONTAINER is one of them. But as you said it helps to keep their usage to the COMPOSITION ROOT

BTW, great book! I'm on vacation this week but it's not what most people would call relaxing. Typically, I've been up to 2 or 3 AM reading and coding, no thanks to you and your book smilie
mark.seemann (383) [Avatar] Offline
#4
Re: DI CONTAINER are STABLE DEPENDENCIES
Wow, you've been programming for a long time!

I'm glad that you find the book inspiring. FWIW, after I wrote the book, I felt the need to clarify when to use a DI Container at all, so I wrote this piece: http://blog.ploeh.dk/2012/11/06/WhentouseaDIContainer