newbie digging questions

Bolot Kerimbaev bolot at cc.gatech.edu
Fri Aug 20 18:22:08 UTC 1999


Answers...

On Fri, 20 Aug 1999, Jason McVay wrote:

> well, i'm a (relative) newbie and i have a few questions that i hope some of
> your can help me with...

This is a friendly list, you'll probably get a ton of answers by the
time I finish writing this email.


> How do you quickly find out what class variables in methods are (e.g.
> instance and class variables)? #self i can deal with, but how do ya quickly
> find out what some of the objects composed within the code are so you know
> which messages they accept?
> 

1. Squeak (as a Smalltalk) uses dynamic binding (etc.), so it is
generally impossible to tell what a given variable holds/will hold.
2. When you click on a class in the System Browser, it shows you the
class definition
3. For syntax highlighting, you can use:
http://www.cc.gatech.edu/~rodney/mark/SyntaxHighlighting.cs
by Helge Horch, based on Martin Wollenweber's work.
It colors temporary, instance, and class variables different colors (as
well as message sends, globabls, classes, etc.)


> and what's the quickest way to find where instance/class variables are
> assigned values?
> 

option-click/right-click on the class in the class list of the System
Browser and (each of the following presents a selection list):
1. inst var refs... - where instance vars of this name are used
2. inst var defs... - where they get assigned values
3. similar for class variables


> is there any (quick) way of seeing ALL of a class' inherited class/instance
> variables?
> 

Use the above option-click/right-click method: It will show the instance
variables of the entire ancestry of the class, separated by lines.


> in short, i just wanna know how you guys "get" (how the code fits in the big
> picture) a piece of code...
> 

We read documentation (just kidding!) Generally, it is good code that's
worth looking at. And generally, good code follows some patterns. You
may want to look at a few Smalltalk texts, notably, Smalltalk design
patterns. Streams and Collections are used extensively, etc.

For a big picture, try seeing where the code is being used. Select a
class name and apple-shift-N (alt-shift-N), this will bring up a window
with all references (direct) to the given class. Usually, it is class
methods that are used (but they frequently delegate to instance
methods).

And most importantly, experiment. When you hit a show-stopper, look
inside the Squeak image, there's probably an example of good code for
almost everything.

(I assume you saw BankAccount and Morphic tutorials at squeak.org)





More information about the Squeak-dev mailing list