5 The Class Browser
Figure 5.6 Browsing the animal
class.
The class browser provides two other views that depict class relationships in a graphic form which is easier to understand, but less detailed, than the textual view. These are views of the class's superclasses and subclasses.
You can swap between views using the View menu. Consider the following example:
CL-USER 5 > (defclass dog (mammal) (barks)) #<STANDARD CLASS DOG 004CA73C> CL-USER 6 >Here, a subclass of mammals is defined: the
dog
. This gives us a three level structure as depicted in Figure 5.7, below:
Figure 5.7 The example class hierarchy with subclass dog
added.
To see how the class browser can view this class structure in different ways, follow the instructions below:
1. Examine the class mammal
by typing mammal
into the name area of the class browser.
The usual textual view is used to describe the class.
Figure 5.8 Browsing the mammal subclass.
2. Select View > Graph Subclasses in the class browser.
The relationships between mammal
and its subclasses are depicted in a graphic form, as in Figure 5.9, page 67.
Figure 5.9 Graphical depiction of the mammal
-dog
class relationship.
3. Select View > Graph Superclasses in the class browser.
The relationships between mammal
and its superclasses are depicted in a graphic form, as in Figure 5.10.
Figure 5.10 Graphical depiction of the mammal
class and its subclasses.
Note: When you click on the View menu in the menu bar, a tick shows which is the current view. This is often useful to know when using the graphical views.
Note: Whilst in a graphical view, you can browse through the structure of related classes as you did in the textual view, by double-clicking on a superclass or subclass.
Generated with Harlequin WebMaker