From: Enrique Comba Riepenhausen Date: 2007-05-11T01:00:43+09:00 Subject: Re: The Factory Method On 10 May 2007, at 17:00, Robert Klemme wrote: > I'd go even further and point out that *every* class[1] in Ruby is > a concrete factory - maybe even at the start of the article. In > the most general way the interface is new() i.e. what you would > call a "default constructor" in other languages. Few know that > classes usually also provide method #allocate to create an instance > of the class but without invoking #initialize. So that would be > the second factory method that all classes support. :-) > > Also, you can create any number of additional factory methods on a > class, if you wish so. > > And finally, since there are no interfaces in Ruby the pattern > might be less obvious, even if implemented "properly", i.e. with > concrete creation methods. (I think you do mention that on the Wiki > already.) > > Kind regards > > robert > > > [1] excluding classes that do not support #new. Thanks for the clarification Robert! I included it actually in the Wiki as I think it'll help to further understand this concepts in Ruby...