Roy Smith wrote: > The ebb and flow of technology has recently brought me someplace I never > thought I'd be. Java-land. And what I've discovered is that factories > are so last year. Apparently builders are the new thing.
I've never really understand why "abstract factory", "factory method" and "builder" are considered different design patterns. They're variants on the same idea. class Spam: def create(self, a, b, c, d): if a == "fast": theclass = FastClass elif a == "steady": theclass = SteadyClass obj = theclass(b, c, d) # obj.extra_stuff = self.get_stuff() return obj As I understand it, if FastClass and SteadyClass are subclasses of Spam, then this is the Factory Method design pattern, but if they are independent classes unrelated to Spam, then it is the Abstract Factory design pattern. But if I uncomment out the "obj.extra_stuff" line, it becomes a Builder. -- Steven -- https://mail.python.org/mailman/listinfo/python-list