permaculture playing cards*
The moose likes OO, Patterns, UML and Refactoring and the fly likes what is a factory method? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "what is a factory method?" Watch "what is a factory method?" New topic
Author

what is a factory method?

kwame Iwegbue
Ranch Hand

Joined: Sep 02, 2000
Posts: 197
Can someone please give me a good definition of "factory method", with an example? i come across it a bit in my readings, but not yet clear on its meaning.


Who dares, wins! (SAS motto)
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

http://en.wikipedia.org/wiki/Factory_method


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by marc weber:
http://en.wikipedia.org/wiki/Factory_method


Ouch, that description actually is *wrong*! Take a look at my comment in the discussion.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
The notion of Design Patterns is *wrong*, so the article is destined to be wrong

Where *is* this divine authoritative source of Truth anyway?


Tony Morris
Java Q&A (FAQ, Trivia)
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Tony Morris:
The notion of Design Patterns is *wrong*, so the article is destined to be wrong

Where *is* this divine authoritative source of Truth anyway?


Design Patterns don't have anything to do with authoritative sources of truth. If you want to start a discussion about what design patterns *are*, the OO forum probably would be a good place.

The article is wrong because, independently of wether you find it to be *useful* or not, it doesn't describe the design pattern as documented in the GoF book.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Ilja Preuss:
Ouch, that description actually is *wrong*! Take a look at my comment in the discussion.

Ouch, you're right.

Perhaps, Ilja, you should take a stab at editing that Wiki page?
[ November 12, 2005: Message edited by: marc weber ]
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
Originally posted by Ilja Preuss:


Design Patterns don't have anything to do with authoritative sources of truth. If you want to start a discussion about what design patterns *are*, the OO forum probably would be a good place.

The article is wrong because, independently of wether you find it to be *useful* or not, it doesn't describe the design pattern as documented in the GoF book.


I didn't mean to suggest that design patterns are indeed related to authoritative sources of truth. But to suggest that something is *wrong* without supplying an axiom indeed is related, since only a divine force could make such a claim (GoF perhaps?). That I claim that the very notion itself is wrong is using an assumed axiom (that software should be valid (which relies on some unstated definition)). If you provide an axiom, I'll invalidate it for you I don't want to discuss it really; I was just making claims to the contrary in the hope that the absurdity might come to the fore. I'll get back in my box now
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by marc weber:

Ouch, you're right.

Perhaps, Ilja, you should take a stab at editing that Wiki page?


Perhaps I will do that. I'm not sure about the etiquette at wikipedia, though.
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

Originally posted by Ilja Preuss:
Perhaps I will do that. I'm not sure about the etiquette at wikipedia, though.

How to edit a page -- go for it Ilja!
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Yeah, you should edit it out. I almost did. But since you saw it first.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

Moving this discussion to the OOP forum.


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Mark Spritzler:
Yeah, you should edit it out. I almost did. But since you saw it first.


Don't hold back! I'm currently not sure when I will find the time, and I can still copyedit your's...

For what it's worth, I'd probably add a link to a (probably not yet existing) article describing the Creation Method pattern, as described in "Refactoring to Patterns".
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
In my view, the term "Factory Method" is a name, given to a specific pattern as described in the GoF book, by the GoF authors, accepted that way by the patterns community.

Therefore an article trying to explain the term "Factory Method", in the context of Design Patterns (a concept that got coined by the GoF book!), but failing to describe something that matches the description in the GoF book, in my opinion *is* wrong - in a similar sense than a US travel guide describing "Washington DC" as "a term generally referring to a town or a village at the east coast". Without any divine force being involved (at least not verifiably ).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what is a factory method?
 
Similar Threads
design pattern for Strings to Objects
Factory methods
ClassLoader question
What is the need for a pattern like factory Pattern?
Abstract Factory Pattern Vs Factory Pattern