Prev: Evaluating expressions. Up: Using BLOX. Next: Creating classes.

Browsing classes

When you want to browse existing classes, or create new classes, you will want to look at BLOX's class browser, accessible via the ``Class Hierarchy Browser'' item in the Smalltalk menu. The window will look something like the following.

The upper left pane, labeled ``Classes'' above, lists all the classes, organized by inheritance hierarchy. You can see that True is indented below Boolean, which is indented below Object. This designates that True is a subclass of the Boolean class, which is itself a subclass of the Object class.

Scroll down in the region labeled ``Classes'' and click on True. You'll see that the lower pane, labeled ``Class Declaration'' above, changes. This is the Smalltalk expression that created the class. It says that it was created by using the Boolean class's

subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:
class method. (Whew! That's quite a mouthful!) The first two parameters are the most important. The first parameter (subclass:) is the name of the class, prefixed by a sharp (`#'). And the second (instanceVariableNames:) is a string listing the names of the various instance variables held by the class; if there should be more than one instance variable, they would be separated by spaces.

The top center pane, labeled ``Method Categories'' above, lists the different categories of methods within the class. Categorizing methods is not essential to Smalltalk, but it is useful.

Click on the ``basic'' category.

The top right pane, labeled ``Methods,'' will now display all of the ``basic'' instance methods defined in the True class.

Click on the not method. The lower pane, labeled ``Method Definition,'' will show the method's definition. In this case, the method's definition is simply: It is to return false (a globally defined instance of the False class). This is what occurred when we sent the not method to true in the worksheet, and it printed false.

Prev: Evaluating expressions. Up: Using BLOX. Next: Creating classes.