[ProgClub list] What is IoC?

John Elliot jj5 at progclub.org
Thu Oct 13 03:24:01 AEDT 2011


On 13/10/2011 3:18 AM, John Elliot wrote:
>
> public sealed class ProductionMessageClient : IMessageClient {
>    private ProductionMessageClient() {}
>    public IMessageClient Create() { return new ProductionMessageClient(); }
>    void IMessageClient.Notify( IUser user, String message ) {
>      // send email
>    }
> }
>
> public sealed class TestMessageClient : IMessageClient {
>    private TestMessageClient() {}
>    public IMessageClient Create() { return new TestMessageClient(); }
>    void IMessageClient.Notify( IUser user, String message ) {
>      // log to console
>    }
> }

Bah! The factory methods are supposed to be static! :P

I have to say I found it a very complex blend of familiar and unfamiliar 
writing that C# code just now. I'm really not writing enough C# these 
days and I'm out of practice... but on the other hand it seemed a little 
like riding a bike.



More information about the list mailing list