Friday, June 10, 2005

Dependency Injection

It started with an article listed in the IBM developerWorks technology newsletter - Secrets of lightweight development success, Part 2: How to lighten up your containers
which was interesting enough, but at the end there was a link to Martin Fowler's article on dependency injection. I always like Fowler's writing so I followed the link and printed the article to read later. I read it last night and, as usual, he does a great job of explaining the topic, including alternatives.

I'd read about dependency injection in Spring in Better, Faster, Lighter Java, but I don't think it sank in until reading Fowler's article. I also found an article in Ruby Garden about it. It talks about HiveMind which is one of the Java dependency injection packages (Pico is another).

Dependency injection also ties in with breaking dependencies for testing as explained so well in Working Effectively with Legacy Code by Michael Feathers.

I'm not sure how I can apply dependency injection in Suneido, but I'm going to keep it in mind. It would be easy enough to implement - it's more a question of where it would be useful.

2005-6-11 Another good article - Dependency Injection in Ruby

No comments: