Skip to main content
Engineering LibreTexts

2.10: The System Browser

  • Page ID
    39728
    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    The System Browser, also known as ”Class Browser”, is one of the key tools used for programming. As we shall see, there are several interesting browsers available for Pharo, but this is the basic one you will find in any image. The current implementation of the System Browser is called Nautilus (this is the name of the Jules Verne’s submarine).

    Opening the System Browser on a given method

    This is not the usual way that we open a browser on a method: we use more advanced tools! Now for the sake of this presentation, execute the following snippet:

    Nautilus openOnMethod: Integer>>#factorial
    

    It will open a system browser on the method factorial. We should get a System Browser like in Figure \(\PageIndex{1}\). The title bar indicates that we are browsing the class Integer and its method factorial. Figure \(\PageIndex{1}\) shows the different entities displayed by the browser: packages, classes, protocols, methods and method definition.

    System Browser showing the factorial method of Integer.
    Figure \(\PageIndex{1}\): The System Browser showing the factorial method of class Integer.

    In Pharo, the default System Browser is Nautilus. However, it is possible to have other System Browsers installed in the Pharo enviroment such as AltBrowser. Each System Browser may have its own GUI that may be very different from the Nautilus GUI. From now on, we will use the terms Browser, System Browser and (occasionally) Nautilus interchangeably.

    Navigating using the System Browser

    Pharo has Spotter (see below) to navigate the system. Now we just want to show you the working flow of the System Browser. Usually with Spotter we go directly to the class or the method.

    Let us look how to find the printString method defined in class Object. At the end of the navigation, we will get the situation depicted in Figure \(\PageIndex{2}\).

    System Browser showing the printString method of Object.
    Figure \(\PageIndex{2}\): The System Browser showing the printString method of class Object.

    Open the Browser by selecting World > System Browser. When a new System Browser window first opens, all panes but the leftmost are empty. This first pane lists all known packages, which contain groups of related classes.

    Filter packages. Type part of the name of the package in the left most filter. It filters the list of packages to be shown in the list under it. Type ’Kern’ for example.

    Expand the Kernel package and select the Objects element. When we select a package, it causes the second pane to show a list of all of the classes in the selected package. You should see the hierarchy of ProtoObject.

    Select the Object class. When a class is selected, the remaining two panes will be populated. The third pane displays the protocols of the currently selected class. These are convenient groupings of related methods. If no protocol is selected you should see all methods in the fourth pane.

    Select the printing protocol. You may have to scroll down to find it. You can also click on the third pane and type pr, to typeahead-find the printing protocol. Now select it, and you will see in the fourth pane only methods related to printing.

    Select the printString method. Now we see in the bottom pane the source code of the printString method, shared by all objects in the system (except those that override it).

    There are much better ways to find a method and we will look at them now.


    This page titled 2.10: The System Browser is shared under a CC BY-SA 3.0 license and was authored, remixed, and/or curated by via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.