Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #3714

Globals/"static" access in OO languages. (Was: Singleton quintessence)

From Daniel Pitts <newsgroup.nospam@virtualinfinity.net>
Newsgroups comp.programming
Subject Globals/"static" access in OO languages. (Was: Singleton quintessence)
References <179c6d53-7d84-438d-8047-b7fd8038a2cf@googlegroups.com> <l0kvqd$gqn$1@speranza.aioe.org>
Message-ID <iGrXt.29592$PB4.5568@fx03.iad> (permalink)
Date 2013-09-09 15:09 -0700

Show all headers | View raw


On 9/9/13 10:17 AM, Ney André de Mello Zunino wrote:
> On 07/09/2013 22:36, bob wrote:
>> So, I was asked in an interview to name a situation where you would
>> use a singleton.  I was at a loss for coming up with a "good" answer.
>>
>> Anyone know of a "good" answer as to when you would use a singleton?
>>
>> Thanks.
>
> <mild-irony>
>      When you feel like giving globals an OO treatment.
> </mild-irony>

This got me thinking. Would a language be utterly incapacitated if you 
were to eliminate static/globals from its capabilities?

I'm thinking of a case where you replace static/global access with a 
"container" pattern (for example from Spring or Symfony).

The container object would have to be passed around everywhere, or 
accessible through objects that were passed around. Some developers 
might be annoyed by this, but would it be enough to kill the language as 
a general purpose language?

Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Singleton quintessence bob <bob@coolfone.net> - 2013-09-07 18:36 -0700
  Re: Singleton quintessence Geoff <geoff@invalid.invalid> - 2013-09-07 18:49 -0700
    Re: Singleton quintessence Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-09-07 22:12 -0700
  Re: Singleton quintessence Ney André de Mello Zunino <zunino@softplan.com.br> - 2013-09-09 14:17 -0300
    Globals/"static" access in OO languages. (Was: Singleton quintessence) Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-09-09 15:09 -0700
      Re: Globals/"static" access in OO languages. (Was: Singleton quintessence) Richard Damon <Richard@Damon-Family.org> - 2013-09-14 14:14 -0400
        Re: Globals/"static" access in OO languages. (Was: Singleton quintessence) Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-09-14 11:31 -0700
          Re: Globals/"static" access in OO languages. (Was: Singleton quintessence) Robert Miles <milesrf@Usenet-News.net> - 2013-09-14 23:50 -0500
            Re: Globals/"static" access in OO languages. (Was: Singleton quintessence) Ian Collins <ian-news@hotmail.com> - 2013-09-15 17:18 +1200
  Re: Singleton quintessence "Charles Richmond" <numerist@aquaporin4.com> - 2013-09-10 17:34 -0500
  Re: Singleton quintessence Öö Tiib <ootiib@hot.ee> - 2013-09-14 11:34 -0700

csiph-web