Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About Using Singleton class

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all ,

Can anybody please tell me where exactly a Singleton Class would be useful in a Web Based Appliction ??


I know this :

"Singletons are truly useful when you need only one instance of a class, and it is undesirable to have more than one instance of a class."

But where actually this is a case ?
please tell me an example .

Thanks in advance .
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I google for "use of singleton" I get a *lot* of hits--which ones have you looked at so far and/or what about them didn't you understand?
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi David ,
Thanks for the response
When it is required for a single point of entry in a Application ??
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure I know what you're asking; sorry!
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



Hi , i want to know in what situation ,In fact we should restrict the maximum number of object of a class.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ravi Pavan wrote:
i want to know in what situation ,In fact we should restrict the maximum number of object of a class.

That's an impossible question--there could be any number of reasons why we'd want to restrict the number of class instantiations. The most common would be because we only need one instance. Singletons are, however, frequently debated.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic