Message-ID: <32DAABCD.232@mail.amsinc.com>
Date: Mon, 13 Jan 1997 16:40:29 -0500
From: John Heidelberger <john_heidelberger@mail.amsinc.com>
Reply-To: john_heidelberger@mail.amsinc.com
Organization: American Management Systems
X-Mailer: Mozilla 3.01Gold (WinNT; I)
MIME-Version: 1.0
Newsgroups: comp.lang.smalltalk
Subject: Re: Globals in the Smalltalk Dictionary
References: <32D80084.4EDF@mail.davis.uswest.net>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: cstansbury.amsinc.com
Lines: 37
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!cam-news-feed3.bbnplanet.com!news.bbnplanet.com!cam-news-hub1.bbnplanet.com!news-xfer.netaxs.com!news.maxwell.syr.edu!insync!uunet!in2.uu.net!162.70.244.3!dns.amsinc.com!cstansbury.amsinc.com

SRandy A. Ynchausti wrote:
> 
> Can anyone explain the technical reasons why it is considered "bad form"
> to instantiate a singleton object (only one instance of a class) and
> register it in the Smalltalk dictionary?  If there really are no
> compelling technical reasons, in a realistic world, there must be
> advantages and disadvantages to both approaches.  Parcplace does this
> with the class ProcessScheduler and the instance Process, as an
> example.  PPD always recommends that the instance be jammed into a class
> variable.  While this prevents name-space pollution, it seems to create
> a very tight bond between the class and the instance that is a bit
> bothersome also.
> 
> Thank you for your responses, in advance.
> 
> Regards
> 
> Randy Ynchausti
> mickeyz@davis.uswest.net
Aside from the name space pollution reason, I can see two reasons:

1) It would seem that placing instances in the system dictionary would
not guarantee that you only have one instance (i.e, you could place
multiple instances in teh dictionary.  By confining the instance to
a class variable you will only have as many instances as variables.

2) Readability - Although not that obscure, an instance of a class
placed in the system dictionary can be confusing.  What is it?  What if
someone changes what it is?  How do I know I shouldn't create more of
them?  By placing the singelton in a class variable some of this
confusion may be eliminated.

Just some thoughts...
-- 
John Heidelberger
American Management Systems, Inc.
Object Technology Practice
