<div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
1: My favorite at the moment is by Martin Fowler at<br>
<a href="http://www.martinfowler.com/articles/injection.html" target="_blank">http://www.martinfowler.com/<u></u>articles/injection.html</a>.<br>
</blockquote>
<br></div>
Thanks for your explanation and links Stuart. I haven't read all your emails yet, but I will. I just wanted to throw in an off-the-cuff remark about this quote from Fowler:<br>
<br>
"In this article I dig into how this pattern works, under the more specific name of "Dependency Injection", and contrast it with the Service Locator alternative. The choice between them is less important than the principle of separating configuration from use."<br>
<br>
So it seems like the object of IoC is to separate configuration from use, and my knee-jerk reaction to that would be to use a factory. So from your example you would configure Notifier to use a factory to create its IMessageClient (which concretely might be a EmailSender) and if you want to configure Notifier some other way (for testing or improvement) then you could just create a different factory that created the new IMessageClient. In your testing code you'd configure a mock message client that just logged to the console or something like that, and in your production system you'd use a real IMessageClient implementation handed out by the factory.<br>
<br>
So far I don't see what IoC buys me, but I'll keep reading.</blockquote><div><br>I thought I knew what IoC was about, however some back reading about it - and Stuarts great writeup - not so certain any more. Certainly factory methods seem to be a type of IoC from some descriptions?<br>
</div></div><br>