﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>João P. Bragança commented on Design patterns in the test of time: Abstract Factory</title><description>@Ed Blackburn,

That IS a container, it's just far far simpler than the ones you see out there. :) As long as Widget has no dependencies this is the way to go IMO.</description><link>http://ayende.com/159361/design-patterns-in-the-test-of-time-abstract-factory#comment16</link><guid>http://ayende.com/159361/design-patterns-in-the-test-of-time-abstract-factory#comment16</guid><pubDate>Wed, 24 Oct 2012 17:53:25 GMT</pubDate></item><item><title>Ed Blackburn commented on Design patterns in the test of time: Abstract Factory</title><description>I agree, implementing this pattern is a degree of last-resort. It has certainly been superseded (and just as abused by Containers). 

Personally I'm not a fan of switch statements - a popular hacky alternative for object creation.

For simple abstract factories I've followed this approach:

    internal abstract class Widget
    {
        internal static Widget Create()
        {
            var map = new Dictionary&lt;PlatformID, Func&lt;Widget&gt;&gt;
                          {
                              {PlatformID.Win32Windows, () =&gt; new Windows()},
                              {PlatformID.MacOSX, ()=&gt; new Mac()}
                          };

            return map[Environment.OSVersion.Platform]();
        }

        internal abstract void Action();
    }

    internal class Windows : Widget
    {
        internal override void Action() { }
    }

    internal class Mac : Widget
    {
        internal override void Action() { }
    }</description><link>http://ayende.com/159361/design-patterns-in-the-test-of-time-abstract-factory#comment15</link><guid>http://ayende.com/159361/design-patterns-in-the-test-of-time-abstract-factory#comment15</guid><pubDate>Wed, 24 Oct 2012 15:22:47 GMT</pubDate></item><item><title>Michael commented on Design patterns in the test of time: Abstract Factory</title><description>Instead of checking the OS_TYPE, I would let the Installer decide which is the correct Type to use, configure the type where Autofac (or whatever Inversion of Control Container you use) can map it to IGUI Factory.</description><link>http://ayende.com/159361/design-patterns-in-the-test-of-time-abstract-factory#comment14</link><guid>http://ayende.com/159361/design-patterns-in-the-test-of-time-abstract-factory#comment14</guid><pubDate>Wed, 24 Oct 2012 08:26:59 GMT</pubDate></item><item><title>Rafal commented on Design patterns in the test of time: Abstract Factory</title><description>Java hasn't changed that much since Joel's post. They have added a few factory factories to the standard. For example, an ORM factory [JPA] - Steve, you'll like it.</description><link>http://ayende.com/159361/design-patterns-in-the-test-of-time-abstract-factory#comment13</link><guid>http://ayende.com/159361/design-patterns-in-the-test-of-time-abstract-factory#comment13</guid><pubDate>Wed, 24 Oct 2012 04:30:12 GMT</pubDate></item><item><title>Steve Py commented on Design patterns in the test of time: Abstract Factory</title><description>My favourite flavour of abstract factories are when someone gets the idea to abstract something like an ORM/DAL, then proceed to create an abstract factory that only has one construction option with a comment that they may want to support "X" in the future. YAGNTDAF! (ya ain't gonna need that damned abstract factory)</description><link>http://ayende.com/159361/design-patterns-in-the-test-of-time-abstract-factory#comment12</link><guid>http://ayende.com/159361/design-patterns-in-the-test-of-time-abstract-factory#comment12</guid><pubDate>Wed, 24 Oct 2012 02:41:28 GMT</pubDate></item><item><title>Bertrand Le Roy commented on Design patterns in the test of time: Abstract Factory</title><description>Any thoughts about how abstract factory relates to dependency injection?</description><link>http://ayende.com/159361/design-patterns-in-the-test-of-time-abstract-factory#comment11</link><guid>http://ayende.com/159361/design-patterns-in-the-test-of-time-abstract-factory#comment11</guid><pubDate>Tue, 23 Oct 2012 17:50:04 GMT</pubDate></item><item><title>slava commented on Design patterns in the test of time: Abstract Factory</title><description>I think in general Factory pattern is just OOP alternative to Functional curry if you will.

Intuition would be to think about this pattern (or curry in OOP) as a process to shape object. 
You have some formless object (wrapped in factory pattern), you give it more specs and it starts to shape itself, and you can continue to shape it until you satisfied and it fits your needs.</description><link>http://ayende.com/159361/design-patterns-in-the-test-of-time-abstract-factory#comment4</link><guid>http://ayende.com/159361/design-patterns-in-the-test-of-time-abstract-factory#comment4</guid><pubDate>Tue, 23 Oct 2012 17:04:06 GMT</pubDate></item><item><title>Philip Nelson commented on Design patterns in the test of time: Abstract Factory</title><description>Well, yes. It does seem to point at a conflict though, and too may layers is the inevitable result. The old adage, that all problems in computer science can be solved with another layer of indirection, results in things like Abstract Pattern where you point at places in your architecture and say that all things must pass through here. What you need is a good way to say, you must pass though here when you need to, and otherwise, not so much. </description><link>http://ayende.com/159361/design-patterns-in-the-test-of-time-abstract-factory#comment3</link><guid>http://ayende.com/159361/design-patterns-in-the-test-of-time-abstract-factory#comment3</guid><pubDate>Tue, 23 Oct 2012 15:27:30 GMT</pubDate></item><item><title>Pop Catalin commented on Design patterns in the test of time: Abstract Factory</title><description>Still better than:

#if Windows
...
#elseif Mac
...

However what I've come to like allo more than abstract factories is a plugin architecture combined with a boostrapper reponsible for dynamically loading pluggins.

This way you can centralize and isolate your specific features in separate plugins, withouth having to deal with the mess of working with factory factories.
</description><link>http://ayende.com/159361/design-patterns-in-the-test-of-time-abstract-factory#comment2</link><guid>http://ayende.com/159361/design-patterns-in-the-test-of-time-abstract-factory#comment2</guid><pubDate>Tue, 23 Oct 2012 15:25:47 GMT</pubDate></item><item><title>tobi commented on Design patterns in the test of time: Abstract Factory</title><description>I think WCF would have been well off using the ASP.NET MVC filter model. WCF actions are *very* similar to REST endpoints.</description><link>http://ayende.com/159361/design-patterns-in-the-test-of-time-abstract-factory#comment1</link><guid>http://ayende.com/159361/design-patterns-in-the-test-of-time-abstract-factory#comment1</guid><pubDate>Tue, 23 Oct 2012 14:35:01 GMT</pubDate></item></channel></rss>