From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b88383a5d9c51aa0 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!w35g2000yqm.googlegroups.com!not-for-mail From: "patrick.gunia@googlemail.com" Newsgroups: comp.lang.ada Subject: Re: Ada-Singleton-Why does it work like this? Date: Wed, 25 Mar 2009 04:37:57 -0700 (PDT) Organization: http://groups.google.com Message-ID: <14672a25-24e6-4b04-8556-c58690d8f3d3@w35g2000yqm.googlegroups.com> References: <5a7a870c-40e2-4803-8753-0f9cfd2b800f@k2g2000yql.googlegroups.com> <13su65cm8b5ov$.1198qla32cc3i$.dlg@40tude.net> <1bf21w38d0xy6.1jeyl0h376pe7.dlg@40tude.net> NNTP-Posting-Host: 78.34.66.221 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1237981077 32668 127.0.0.1 (25 Mar 2009 11:37:57 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 25 Mar 2009 11:37:57 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: w35g2000yqm.googlegroups.com; posting-host=78.34.66.221; posting-account=D7TrwwoAAAAVyN71CASRiSp392RIjlsB User-Agent: G2/1.0 X-HTTP-UserAgent: Opera/9.64 (Windows NT 6.0; U; de) Presto/2.1.1,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:5261 Date: 2009-03-25T04:37:57-07:00 List-Id: On 25 Mrz., 12:10, "Dmitry A. Kazakov" wrote: > On Wed, 25 Mar 2009 03:07:18 -0700 (PDT), patrick.gu...@googlemail.com > wrote: > > > Maybe I=B4m getting something wrong, but from my point of view, > > Singleton offers more possibilities than just the execution of some > > code on elaboration of some module.I like the dynamic version Ludovic > > described. It also offers the possibility to change the number of > > instances later on and thus increases the adaptability. > > Sorry, but a singleton with more than one instance is not a singleton. This is arguable. Gamma et al. tell explictily in their work, that it =B4s one advantage of the Singleton-pattern that the number of creatable instances can be fixed later on without major code changes. Thus I think of the pattern more like a possibility to gain control over the number of instantiations of a concrete class, not necessarily restricted to one, though limited. > > When you say > > that Singleton isn=B4t necessary in Ada this might come from the fact > > that it can=B4t be implemented as in other languages, though using such > > a construct might increase readability of the code. > > No, it is rather so, that the problems solved in other languages using th= e > singleton pattern, in Ada are solved using different patterns. > > There is a general note about software design patterns, that they usually > indicate some language deficiency. If a language has a construct to expre= ss > the idea behind the pattern, then it is not a pattern anymore. Pattern > assumes some manual, yet routine work on the programmer side, which canno= t > be taken over by the language, because ... This might be true for some simple patterns like Singleton, though I think that most patterns solve problems which are language independent, thus not aiming at a language deficiency. For example patterns for using frameworks or letting different interfaces communicate with each other. It seems to me that this is an architectural question, not a language question.