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 31,702 of 33,346    |
|    Carlos Moreno to Trevor Taylor    |
|    Re: Regarding Design Pattern    |
|    28 Nov 11 22:57:39    |
      142a0ddb       From: moreno_news@mailinator.com              On 11-11-28 03:15 AM, Trevor Taylor wrote:       > If you read Design Patterns (Gamma et al), I'd suggest skipping the       > Singleton section.       >       > In my experience, the second part of the first sentence of this       > section has taken software engineering *backwards*.       >       > The first sentence starts out well enough:       >       > "Ensure a class only has one instance"       >       > ... and then unfortunately adds:       >       > "and provide a global point of access to it."       >       > That last bit has just described a global variable              Errr.... *HUH*???????              How, how, how does that describe a global *variable*?????              So, is sqrt a global variable?? (or sort, for that matter)       I mean, it is globally accessible, so it must be a global       variable, right???              > I can vividly recall 4 multi-year projects I've worked on where the       > singleton term was used to explain use of global variables, and the       > authors agreed that global variables were bad but argued that they       > were using singletons not global variables.              That says absolutely nothing about the Singleton design       pattern, or about the phrasing to describe it in GoF.       That only speaks about the incredible incompetence of       those programmers that you've encountered in those 4       projects.              I mean, the association is not met in either direction;       not only global point of access says nothing about being       *a variable*, but also, how does a global variable ensures       that a class only has one instance??? (i.e., neither a       global variable is a particular case of Singleton, nor a       Singleton is a particular case of a global variable)              > Please excuse me for humbly offering my tips for not using global       > variables              Agreed.              > (including not using singletons as global variables)              And by that, I hope you mean including not saying that       Singletons are global variables when you use them and       not saying that you're using a Singleton to justify the       use of a global variable?              Carlos       --               [ 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