Introduction
The MacApp Macintosh application framework [App89] always declares the abstract operation that defines the factory method as Class* DoMakeClass(), where Class is the Product class.
This quote has leaded me to the question about naming conventions for the Factory Method design pattern.
Expectations
I expect to see best practices or helpful examples, which provide clear factory methods naming.
Since it could depend on a language, let's consider a set of the most popular languages: C#, Java, C++ and JavaScript.
Context
For a context I propose to consider the following class structure. We have two abstract classes: Document and Application. The Application contains a list of documents and it should be possible to create a new document. The Application has a factory method CreateDocument()
.
Thanks
IMHO, the method name is dependent on context and the nature of the object being created. Maybe this is why you've not found any clear conventions. For example, a Create()
method might be right in one context while Open()
or Build()
might be more appropriate in others.