Jump to content

Talk:Factory method pattern

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Petur Runolfsson (talk | contribs) at 18:31, 23 June 2005. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

This article is wrong (see for example the discussion of this pattern in the Gang of Four book or the article at the Portland Pattern Repository).

It is true that the term Factory method is often used to refer to any method (static, polymorphic or otherwise) whose main purpose is to create objects, but the Factory Method pattern (as described by the Gang of Four) is specifically about the case where a superclass defines a factory method which subclasses can override to create objects of appropriate types.

A good example of the Factory Method pattern can be found in ADO.NET: IDbCommand.CreateParameter - Each class that implements IDbCommand creates parameter objects of the correct type for that command object. --Petur