Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c++.moderated    |    Moderated discussion of C++ superhackery    |    33,346 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 32,690 of 33,346    |
|    fmatthew5876 to All    |
|    Re: Singletons    |
|    25 Nov 12 18:10:05    |
   
   From: fmatthew5876@googlemail.com   
      
   { Please limit your text to fit within 80 columns, preferably around 70,   
    so that readers don't have to scroll horizontally to read each line.   
    This article has been reformatted manually by the moderator. -mod }   
      
   >   
   > I think Singleton is now officially an anti-pattern, bad for testability   
      
   Anti-pattern or not there will always be a need for managing global   
   state. Some applications like games use the singleton or global variable   
   pattern if you will to great effect. If I have a function that needs to   
   render an object, play a sound, and add physics object to the collision   
   system, I don't want to create 3 new function parameters for the   
   managers of all of these sub systems.   
      
   I guess the term "singleton" is a bad use of words here because it   
   implies the a class that can only be instantiated once by hacking around   
   the dark corners of the language.   
      
   The real question is how do we effectively expose and encapsulate global   
   state.   
      
      
   --   
    [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
    [ comp.lang.c++.moderated. First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca