|
|
Primer : The System Browser (Part 1)
|
|
|
|
In the VisualWorks development environment, the System
Browser allows you to view and edit the major components (namespaces,
categories, classes, protocols, methods and parcels) of the Smalltalk image.
The "image" is the actual file (with the "im" extension)
that contains these components. |
|
|
This primer gives a brief description
of what the System Browser does and an example of why it is so powerful. |
|
|
The
following exercise is designed purely to show how the four panes across the
top of the System Browser work. · Character · Date · Magnitude · Time · TimeZone This
(obviously) is the Class pane. Now click (select) Date. Note
that in the third pane is a list of Protocols. The list will vary
depending on which tab above the pane is selected. Click the Class
tab. A list of four protocols will appear: · class initializtion · general inquiries · instance creation · private Click
(select) the instance creation protocol. Note that in the next pane, a
list of six methods will appear. · fromDays: · newDay:month:year: · newDay:monthNumber:year: · newDay:year: · readFrom: · today Click
(select) the today method. Note that some text will appear in the
bottom pane. This is the actual source code for the today method of
the Date class. Date today 3.
Highlight (select) all the code, <Operate-Click> and select Print
it. Date addDays: 1 5.
Highlight (select) all the code, <Operate-Click> and select Print
it. Date today addDays: 1 8.
Highlight (select) all the code, <Operate-Click> and select Print
it. Date tomorrow 10.
Highlight (select) all the code, <Operate-Click> and select Print
it. tomorrow 15. Now <Operate-Click>
in the bottom pane and select Accept. This will "compile"
the code you just entered and barring any typos, the tomorrow method
will appear in the list of class-side methods for the Date Class. Date tomorrow 17. Highlight (select) all the code, <Operate-Click>
and select Print it. |
|
|
Summary
If you
followed the exercise above, you have learned how categories, classes,
protocols and methods are related. The System Browser allows you to
see these relationships. You also saw the difference between class-side
methods and instance-side methods. |