| Online Eiffel Documentation

EiffelStudio

# 6 STARTING TO BROWSE

Help reading this manual

It was important to take a look at how EiffelStudio stores your project, but unless your idea of fun is to poke around directories to look at compiler-generated files that's not really the exciting part yet. Among the most innovative aspects of EiffelStudio is a unique set of facilities to browse through a software system.

## Browsing style

Browsing -- traversing the structure -- is particularly important in object-oriented development and especially in Eiffel because of the speed at which you can construct sophisticated class structures, making use of inheritance, genericity, the client relation and information hiding, and subjecting features to all kinds of adaptations -- renaming, redefinition, undefinition, effecting -- that are key to the expressive power of the software, but call for smart tools to keep track of what's going on. EiffelStudio's tools are second to none. Among their key properties:

- You can choose many different ways of browsing: sometimes you know the name of a class or feature, and will get to it just by typing it; sometimes you want to traverse the system through its cluster-subcluster structure ; often, you see a reference to element (class or feature) in the text of another element, and just want to get to it by following that reference, like a hyperlink. You'll be able to use all these techniques, and alternate freely between them.
- The browsing facilities are always available. There is no "browser" in EiffelStudio; you just browse when you want to, by looking at the information you need. You can do this while editing, debugging, or performing any other of the analysis, design, implementation, extension and maintenance tasks of system construction.
- Although classes are stored in files and clusters in directories, you can for the most part forget about the file system. Unlike most environments, which let you manipulate files containing software texts, EiffelStudio lets you concentrate on your development objects -- the units that make sense for you: features, classes, clusters, systems. You think in terms of those conceptual units, and don't have to worry about where they are stored. Most of the time, you'll just forget about files and directories.
- You can produce many views of the development objects. For a class, you may see the full text, the interface only, the inheritance structure, the clients, the features, and many other views. You can even display graphical views along with textual ones. All these are fully browsable; you can go from one to the other as you please.

## A Development Window

Let's see how this works. First, take a look at the EiffelStudio window:

If some parts are too small, just resize the window to arrive at something like what's on the figure. When it first comes up, EiffelStudio initially uses a fairly small window, because it's designed to run on a 800x600 display, although of course a bigger display is recommended. But as soon as you have resized it, EiffelStudio will come up, in the next session, with the size you've set.

You can see five panes, marked on the figure: Features , Class , Properties , Clusters , Context . There will be others, such as Search , and you can remove any of them, except Class , at any time to make room for the others.

So far we have talked about "the EiffelStudio window", but in fact that's not correct. What you see is one "Development Window", of which you can have as many as you wish. Some people prefer to use a single development tool, avoiding screen clutter; others don't think twice about having lots of windows, taking the "desktop metaphor" to its full conclusion (some non-computer desktops are quite cluttered). There are many ways to start a new Development Window; for example if you look at the entries in the File menu at the top left -- don't select any of these entries yet, just look -- you'll see, among others, New window , which would create a new Development Window.

Whether you have one Development Window or many, each may have as its target an element of the system: system, cluster, class (the most common case), feature, run-time object. This simply means that the tool displays information about that element.

## Retargeting by name

Our first example screen was targeted to the whole system. To retarget it to a particular class, you can just type the class name -- if you know it -- into the Class Field at the top left:

Let's use one of the most basic classes, STRING from the Kernel Library of EiffelBase. Bring the cursor to the Class Field, click to make it active, type string (or STRING ) and the Enter key. As shown on the next figure, this retargets the tool to class STRING . Note that you didn't have to worry about where the class resides in the files of your computer. Also, the Class Field will now show the target's class name, STRING , in upper case, since that is the standard Eiffel convention for class names. It doesn't matter, when you enter the name into the field, whether you use lower or upper case, or some mix; EiffelStudio will show the name back in all upper case.

The Development Window is now targeted to class STRING . Each of the four panes contains a tool:

- Features Tree, top-left: a tree view of all the features of the class, grouped by the feature categories ( Initialization , Access , ... ) as they appear in the class.
- Editing Tool, top-right: the source text of the class, editable. For the moment the pane is too small to display much of interest -- it only shows the very first few lines -- but we'll enlarge it when we need to modify class texts. (Not STRING , though, as it's not the kind of class you want to change during your first session with EiffelStudio, so just wait a bit.)
- Cluster Tree, bottom-left: a tree view of the clusters of the system.
- Context Tool, bottom right: a bag full of neat tricks. At the moment it just shows some general information about the system (where it resides, the name of its root class TESTROOT ), but more generally it's there to give you all kinds of interesting views of the system, through the various tabs at the bottom: Output , Diagram , Class , Feature , Metric , External Output , C Output , Errors , Warnings .

## A peek at diagram

There's indeed a lot in the Context Tool, too much to see right now, but to feed our curiosity let's just take a peek at the Diagram View. Click the Diagram Tab at the bottom:

This displays a class diagram in the Context Tool:

If nothing appears in the Context Tool when you click the Diagram Tab, that's because the Context Tool and the Class View are not linked. Linking the two tools together will ensure that whenever a change is made in one tool the other will update to reflect that change. To link the tools select the menu entry View --> Link context tool ; this will display the diagram as shown. We'll see the explanation for this behavior in Isolating the context, pg 68

The diagram is cropped to the available area; to get the whole picture, resize the window from the bottom-right corner. You can now see the inheritance structure:

The red arrows show inheritance relations: STRING inherits from INDEXABLE and so on. We'll see later how to display the other key inter-class relation, client, but it's not particularly interesting for STRING . The default placement of the classes is quite good in this case, but if you don't like it you can change it; your changes will be retained the next time you bring up this diagram, in this session or a later one. (That's part of the information the Diagram directory keeps.) It will also be used in Web diagrams if you choose to generate an HTML form. To move a class bubble, just use standard drag-and-drop. For example you may move everything to the left and make the figure more compact:

Later on you will learn how to use the Diagram View not just to display system structures graphically but also to build and modify systems. EiffelStudio indeed integrates the functionality of a CASE (Computer-Aided Software Engineering) workbench, seamlessly integrated with the programming facilities. But for the moment this peek at the Diagram View is enough, so let's get back to browsing.

## Retargeting from the Cluster Tree

Your first browsing action used a class of which you knew the name, STRING . What if you don't know what's in the system and want to explore it? Among other techniques, you can let the Cluster Tree, in the Cluster Tool at the bottom left of the Development Window, guide you through the system's structure:

An Eiffel system, as you know, is organized into clusters and libraries (and assemblies on some .NET systems), clusters can be structured hierarchically into subclusters. Here we see one cluster: root_cluster , containing the few classes specific to our Guided Tour system. There are also two libraries precompile which does not provide any classes and base which provides the base classes. Let's go into base , ISE's open-source library of fundamental reusable mechanisms. Click the little + sign to the left of its name; this expands the clusters and libraries in the base library. Expand now the base cluster and you will see the its six subclusters: event for event handling, kernel for the Kernel Library, refactoring for help with refactoring, serialization for serialization, structures for the Data Structure Library, and support for additional supporting mechanisms.

The most extensive of these EiffelBase libraries is structures , which contains implementations of major data structures and algorithms of computing science. Click the + next to structures to see its own subclusters:

If you initially don't see as many details as shown on this figure, you may get them by resizing the window, moving the vertical pane boundary, and possibly scrolling.

The EiffelBase Data Structure library and its subclusters are described in the book Reusable Software. Let's go to one of the most frequently used subclusters, list , containing implementations of list structures. Click the + next to list . This time, since list is a terminal cluster, it's not subclusters you'll see, but classes, identified by small ellipses:

The ellipse, or "bubble", is indeed throughout EiffelStudio, as in the Business Object Notation (BON, the underlying graphical convention), the distinctive symbol for classes; remember the larger bubbles showing classes in the Diagram View a few moments ago.

Our second technique for retargeting a Development Window to a class (other than typing the class name as we did before) is to click the class in the Cluster Tree. Do this now: click LIST in the tree. It doesn't matter whether you click on the class name or the adjacent bubble. This retargets the tool to class LIST . Because the Context Tool is still in Diagram view, it will display the inheritance structure for the new target class:

While this view is being produced you may see (or just get a glimpse of, if your machine is fast) messages indicating that it's producing the diagram for LIST . In a moment we'll switch views in the Context Tool as we won't need the diagrams.

As the tool is now targeted to LIST , the Class Field at the top left now shows the name of that class, exactly as if we had typed that name, the way we did with STRING in the previous method of retargeting.

## Moving back and forth

Here now is a third way to retarget. Towards the top-left part of the Development Window there are Back and Forth buttons, which will enable you to revisit classes already seen during the current session:

Click the Back button. This retargets the tool to the class you visited previously: STRING . The Forth button, immediately to the right of Back , becomes active. Click it to retarget back to LIST .

Note that all buttons of the interface have a "tooltip": if you move the cursor on a button, without clicking, and wait a second or so, a small message comes up, explaining the purpose of the button. You may try this now on the Back and Forth buttons.

## The Target History

As a fourth way to retarget -- there are more, and after this one we'll stop counting -- you can also use the Target History menu, which you can bring up through the little arrow to the right of the Class Field:

If you click this arrow -- the little black triangle -- you will see a menu of all your recent targets. Doing this now will only show the two classes visited so far, STRING and LIST , but later on there will be more entries. By default EiffelStudio remembers 10 classes; this is one of the settings you can change later if you wish, through the menu Tools --> Preferences . (There's no point in doing this now.)

## Adding to Favorites

If you find yourself often needing to examine a particular class, you can add it to your "Favorites", similar to the favorites, also called bookmarks, which you use to retain interesting pages in a Web browser.

It's easy to add the current target -- currently, LIST -- to your Favorites. Do it now: go to the Favorites menu and select Add to favorites . Now display the favorites; one way is to go back to that same Favorites menu and select Show favorites . The Favorites Tool appears below the Cluster Tree:

This also means one more way to retarget a Development Window: click a class in the Favorites Tool. Two ways actually, since even if you don't see the Favorites Tool the class will appear in the Favorites menu and you can select it there.

Right now we don't need the Favorites Tool, so you can get rid of it by either selecting Hide favorites in the Favorites menu or clicking the little Close icon at the top right of the Favorites Tool:

## Starting a new tool

With all the techniques seen so far, you were able to retarget the current Development Window to a new class. As noted, you may also wish to have two or more Development Windows targeted to different classes; this is useful to keep track of several things at one. A simple way to start a new tool on a class is to find the class somewhere in the interface and control-right-click it.

Here, for example, the editor lists CHAIN , as a parent of LIST. Go to that word and control-right-click it, that is to say, click with the rightmost button of the mouse while holding the CONTROL key on the keyboard. This starts a new Development Window, targeted to the chosen class, CHAIN :

The place where we found the class CHAIN in the original tool (the one targeted to LIST ) was the bubble representing the class in the Diagram View. But that's just one possibility. A general principle of EiffelStudio is semantic consistency : when you want to work with a development object -- a class, a feature, a cluster -- you can grab it wherever it appears in the interface, and in whatever format it is displayed: you might have spotted it be in the Diagram View, in the text of a class in the Editing Tool, in the Cluster or Feature Tree, or in any of the class documentation formats that we will soon see; and the form under which you found it may be text -- the name of the class in a text document -- or some graphical representation, such as a class bubble in a diagram. These variants don't matter: if the class or other development object catches your fancy, you can do whatever operations make sense for it, such as Control-right-click to start a new development object targeted to it, or any of the other operations we'll see next.

While you are at it, try a couple of other ways to create a new Development Window. Go to File --> New window ; this creates a new tool, untargeted. The title bar says " Empty development tool #1 ". You can get the same effect by clicking the Create New Window icon, leftmost on the top row of buttons, just below " File ". The corresponding keyboard accelerator is CTRL- N .

<< Previous Next >>