is the singleton pattern creates one instance for all users or one instance of credential per user?? please suggest
Does the Singleton pattern create one instance for all users or one instance per user?
The purpose of this pattern is to limit the number of instances of a class. A single instance is typically what is implemented. However, the design pattern can be used to limit the number of instances to three or four as well.
i am planning to make the credential class singleton since i need only one instance per user.
This is not a correct way to implement the Singleton design pattern. The purpose of the pattern is to limit the number of instances in an application, not per user. If you implement the credential class as a Singleton, each user will get the same credential as there will only be one instance.
Forget about the Singleton design pattern. It comes from non object-oriented roots and is typically a flaw whenever it is used, in my opinion.
[ September 02, 2008: Message edited by: James Clark ]