Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news4.ner.bbnplanet.net!news.ner.bbnplanet.net!news.mathworks.com!newsfeed.internetmci.com!swrinde!cs.utexas.edu!news.ti.com!ticipa!clw
From: clw@ticipa.works.ti.com (Chris Winemiller)
Subject: Re: [ALL] Global Variables
Message-ID: <1996Jan2.145256.301@ticipa.works.ti.com>
Organization: None
References: <4c6vrn$195o@watnews1.watson.ibm.com>
Date: Tue, 2 Jan 1996 14:52:56 GMT
Lines: 46

In article <4c6vrn$195o@watnews1.watson.ibm.com> David N. Smith <dnsmith@watson.ibm.com> writes:
>A few questions for discussion:
>
>(1) When is it ever OK to use global variables in an application?

Rarely, if ever.  I prefer holding the singleton object in a class
variable and access it via class method #current, as in 'MyClass current'.

>
>    (a) If it is OK, can you give a compelling example where your have
>done so?
>
>(2) When should Pool Dictionaries be used to:
>
>    (a) hold read/only items?

Whenever there are a significant number of 'constants' you wish to
access by a more meaningful 'alias' name.  But I avoid pool use wherever
possible.

>    
>    (b) to hold changable (read/write) items?

Never.

>    
>(3) Does anyone ever use class instance variables (with accessor methods)
>instead of class variables?

Yes.  Class instVars can be very useful.

>
>(4) How about using prefixes on pool dctionary names. (In pool dictionary
>PhysicalConstants one might start each constant with PhCon).

Ugly.  I wouldn't do this.  As I mentioned above, I'd only use pool
entries to get an 'aliasing' effect; I don't want the name to mention
anything about the implementation such as which pool dictionary it's
defined in.

Regards,
Chris
==============================================================
Chris Winemiller               Internet: clw@works.ti.com
Disclaimer: I do not speak for TI.
==============================================================
