newbie digging questions

Dwight Hughes dwighth at ipa.net
Sat Aug 21 02:44:35 UTC 1999


Jason McVay wrote:
> when looking at a new piece of Squeak code, how do YOU get the gist of it?
> More specifically...
> 
> 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?
>
> and what's the quickest way to find where instance/class variables are
> assigned values?
>
> is there any (quick) way of seeing ALL of a class' inherited class/instance
> variables?

Most "variables" with capitalized names can be inspected (Alt-i) and
will give useful values -- thru which you can drill down or browse or
whatever (well, _everything_ can be inspected - it's just that some
things have more interesting contents that others). If you want to know
what instance variables are defined in a class, go up to the class list
in the System Browser and pop up the context menu there. Several items
of interest there: "hierarchy" will give an indented list of the class
and its superclasses with the instance variables listed with each class
(note - if you have the class list pane button set to "class" and do
this, you get the metaclass hierarchy for the class); "spawn protocol"
will give the messages that can be sent to an instance of the class (or
to the class if the button is set to class) - the protocol list for
instances includes all subclasses of Object down to the class you
selected, but not Object itself (that's a given of course); "instance
var refs.."/"instance var defs.." will give all the instance vars of the
class and its superclasses - clicking on one will give you all the
places where it is used defined in the class and superclasses (or it is
_supposed_ to - right now it just does a simple text search and comes
back with all string matches in the source code for these classes -- so
you will get some hits that are not relevant, but you also get the
relevant ones); similarly for "class var refs...", "class vars", and
"class refs".

Also, for the code pane in the browser (or most any text pane for that
matter) -- check out the various goodies in the "more..." menu: "browse
it", "senders of it", "implementors of it", "references to it",
"selectors containing it", "method strings with it", and "method source
with it". Just about anything can be selected and some or all of these
applied to it. See a menu or a notifier come up and wonder where it came
from and where and how it's implemented? Just type out a string you saw
in that menu or window and do "method strings with it"....

Enjoy.

-- Dwight





More information about the Squeak-dev mailing list