From: Sam Kong Date: 2006-03-23T01:53:51+09:00 Subject: Re: Is this a kind of design patterns? Wilson Bilkovich wrote: > That's the "Factory Method" pattern. It's handy when you want > SomeClass.new to return an instance of SomeOtherClass, or just when > you want things to be easier to read. > > One of my favorite examples (I think this is a Martin Fowler trick) is: > some_date = december(10,2006) At first I thought so. But the definition of "Factory Method Pattern" bothered me. The definition of "Factory Method Pattern" is: "Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses. " However, in my Color example, there's no subclassing involved. So the class itself is a factory as well as the product that the factory makes. Do you think that we can still call it "Factory Method Pattern"? Sam