relationship of Factory method and singleton design patterns?
From: Matt (jrefactors_at_hotmail.com)
Date: 11/29/04
- Next message: H. S. Lahman: "Re: Implementation of State-Machine"
- Previous message: Ilja Preuß: "Re: agile/xp question (formal analysis)"
- Next in thread: karl wettin: "Re: relationship of Factory method and singleton design patterns?"
- Reply: karl wettin: "Re: relationship of Factory method and singleton design patterns?"
- Reply: Ilja Preuß: "Re: relationship of Factory method and singleton design patterns?"
- Reply: Daniel T.: "Re: relationship of Factory method and singleton design patterns?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 29 Nov 2004 07:28:20 -0800
what's the differences between factory method and singleton? and
relationships?
In the following code, Factory method getInstance() is to create new
objects like constructors.
class SingleInstance is a singleton class because it has exactly one
instance. A singleton
class has factory method getInstance(). Looks like a singleton class
always has
factory methods? Or a factory method is used in a singleton class.
public class SingleInstance
{
public static SingleInstance getInstance()
{ ...
return singleInstance;
}
private static SingleInstance singleInstance = new
SingleInstance();
...
}
Please discuss and advise. thanks!!
- Next message: H. S. Lahman: "Re: Implementation of State-Machine"
- Previous message: Ilja Preuß: "Re: agile/xp question (formal analysis)"
- Next in thread: karl wettin: "Re: relationship of Factory method and singleton design patterns?"
- Reply: karl wettin: "Re: relationship of Factory method and singleton design patterns?"
- Reply: Ilja Preuß: "Re: relationship of Factory method and singleton design patterns?"
- Reply: Daniel T.: "Re: relationship of Factory method and singleton design patterns?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|