You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
Required fields*
- 5Is that explanation of Factory method correct? What's about "The factory method pattern relies on inheritance, as object creation is delegated to subclasses that implement the factory method to create objects". So the example is more like Static Factory.SerG– SerG2014-10-15 10:21:44 +00:00Commented Oct 15, 2014 at 10:21
- @SerG Well, in fairness, you've picked up that quote from Wikipedia, on a page that read very differently three years ago. I would argue that the current Wikipedia page contradicts itself in several places, but I don't have the desire to get involved in picking that apart. What I would concede, in hindsight, is that the example I've provided here is a specific kind of Factory Method, known as the Parameterized Factory Method. But the point about the difference between Factory Method and Abstract Factory holds across all types of Factory Method.pdr– pdr2014-10-15 17:41:48 +00:00Commented Oct 15, 2014 at 17:41
- 2The same statement as my quote exists in GoF "Design Patterns". And Parameterized FM is also described there.SerG– SerG2014-10-16 08:27:11 +00:00Commented Oct 16, 2014 at 8:27
- The important part is that the factory will give the caller a suitable object, depending on the particular situation, and the caller doesn't need to know what exactly the class of that object it, and doesn't need to know how the particular object was chosen, as long as the object supports an interface that the caller knows about.gnasher729– gnasher7292015-07-20 13:48:56 +00:00Commented Jul 20, 2015 at 13:48
- You should state that clear in your answer that your example is not a typical factory method pattern, but some specialization named parameterized factory method. And write about definition of typical factory method, because it is mislading right now. I was just learning about factory method pattern, I understood everything and then I read that answer which shows factory method pattern as something different and I was confused. There is no information about that example not being typical factory method pattern. Thanks to SerG for poiniting that out in the comment.ctomek– ctomek2017-02-28 15:04:27 +00:00Commented Feb 28, 2017 at 15:04
Add a comment |
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
- create code fences with backticks ` or tildes ~ ```
like so
``` - add language identifier to highlight code ```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible) <https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. design-patterns), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you