A big teacher wish

Richard A. O'Keefe ok at cs.otago.ac.nz
Wed Nov 27 01:32:41 UTC 2002


"Alejandro F. Reimondo" <aleReimondo at smalltalking.net> wrote:
	I am not a teacher, but... I would love to rename:
	    instanceVariables ---> parts (of an instance)
	    classVariables    ---> parts (of the class)
	    sharedVariables ---> shared objects
	
A core idea in Smalltalk practice is "intention revealing names".

instanceVariables: takes as argument a string that contains names
for instance variables.  The things named *ARE* variables that
are associated with instances of the class in question.
They are *NOT* parts.  (Not of these objects anyway.)

classVariables: takes as argument a string that contains names
for class variables.  The things named *ARE* variables that
are associated with the class in question.  They are *NOT* parts.

I have no idea what 'sharedVariables' means; it's something I've never
seen in Squeak and Squeak 3.2 doesn't seem to know about them either.
Can this possibly be a reference to 'poolDictionaries:', whose
argument is a string that contains names of global variables that
are (or at least, had BETTER be) dictionaries?

	Because they are not "variables", they are
	 only "names" of well known objects.

No, instanceVariables: does *not* provide '"names" of well known objects'.
It provides *variable names*.

	I think they are not variables, because the named
	 object is replaced entirely by other (like a focus change)
	 and do not change "in-memory" as occurs in memory
	 dependent languages (assignment is a name change,
	 not a variable overwrite... it is a very important thing
	 to teach).
	
I am having serious trouble making sense of that.  Instance variables
in Smalltalk are essentially the same thing as data members in C++ or
instance variables in Java.  Instance variables, class variables,
class instance variables, and variables held in pool dictionaries
act *precisely* the way variables in traditional languages like Pascal
or Fortran.  They are boxes whose contents can be fetched (by mentioning
the variable name) or replaced (by using an assignment statement).

	Variables refer to a position, an area that can change contents.

A position is not an area.  Smalltalk instance variables *ARE*
precisely areas that can change contents.

	So, you can associate a type/size to a variable.

It so happens that in Smalltalk every variable has the same size
(a machine 'word') and the same type (reference to object).
There is no interesting theoretical difference between a Smalltalk
variable and a Pascal pointer variable.  (Memory management is interestingly
different, yes, but the variables *themselves* are not interestingly
different.)

	A class definition message can be specified as:
	
	Morph
	    subclass: #MyMorph
	     parts: ' myTarget lastTime '
	     share: ' CloseBoxImage '
	     pools: ' Colors '
	     category: 'Morphic-Samples'!
	
	MyMorph class parts: ' defaultInstance '!
	
Now I am confused more than ever.  It seems that when
Alejandro F. Reimondo wrote "classVariables" he *meant*
class instance variables, and when he wrote "sharedVariables"
he *meant* class variables.

Since people do not type the words 'instanceVariables:',
'classVariables:', or 'poolDictionaries:' there is no point in
making them shorter UNLESS you can make things clearer.

This change-for-the-sake-of-change does NOT make anything clearer.
It describes as "parts" what are in fact instance-local variables.
The word "share" conveys NOTHING about what is shared or what it is
shared with.  And so on.  It creates confusion that did not previously
exist.







More information about the Squeak-dev mailing list