[[Property:title|Browsing Features]]
[[Property:weight|-6]]
[[Property:uuid|2c0b0a6c-08e8-fdbc-1eab-e2d87b01ce48]]
Let us get back to EiffelStudio. Before studying the documentation generation we saw how to display properties of '''classes'''. It's also interesting to explore the properties of '''features'''.  

There are two tools with similar sounding names that we will use to explore features:
# The [[Features Tool|Features tool]] (plural) which provides a list of the immediate features of the class on which the development window is targeted. This tool is located by default in the vertical pane on the right hand side of the development window.
# The Feature tool (singular) which allows you to explore the properties of some particular feature. By default, the Feature tool is available as a tab on the lower pane of the development window along with the Class tool, Outputs tool, and others.

Your Development Window should still be targeted to class <code>LIST</code>, from the last view, <code>Routines</code>, that you displayed on it. If you've lost it, just retarget a Development Window to this class. 

Let's start by making the [[Features Tool|Features tool]] visible. To see the Features tool click on the tab labeled [[Image:features-tab]] (note that this is the plural "Features" versus the singular "Feature").

If the tab for the Features tool is not visible, bring it back by following the menu path:
<code lang="text">
View --> Tools --> Features
</code>

While we are at it, let's get make the Feature tool visible as well. Click on the tab on the lower pane that's labeled [[Image:feature-tab]]. As with the Features tool, if the Feature tab is missing, you can use the menu path to restore it. 

One more thing, and we'll look at some features. If you restarted EiffelStudio since you worked through the [[Viewing Classes]] section, you may have to select <code>Link Context Tool</code> again from the <code>View</code> menu.


==Targeting to a feature==

The list of features, organized by feature clauses, appears in the Features tool:

[[Image:es gt features tool 01]]

The class only has a few immediate features because most of its interesting features are inherited. Make sure the Editor tool is tall enough (as on the above figure) and click the feature <code>forth</code>, the last one, in the Feature Tree on the left. This makes the feature the Editor tool's current target, and scrolls the text to its declaration: 

[[Image:es gt features tool 02]]

Note how both of the top target fields are now filled: the first one shows the target class, <code>LIST</code>, and the second one shows the target feature, <code>forth</code>. 


==Basic feature information==

Now let's look at the views of the feature <code>forth</code> provided in the Feature tool. 

A view of <code>forth</code> is already visible in the Feature tool. By default, it is the <code>Flat</code> view. 

[[Image:es gt feature tool 01]]

The flat view of a feature, similar in concept to the flat view of a class, gives the full text of a feature, taking into account any inherited precondition or postcondition clauses. Here the feature as declared in the class appears in the top Editing Tool, with no precondition and an <code>ensure then</code> postcondition clause. But it's a redefinition of an inherited feature; the flat view in the bottom Context Tool shows the full precondition, inherited from the ancestor <code>LINEAR</code>, as well as the postcondition from <code>LIST</code>. 

<code>Flat</code> is just one of the available Feature Views, shown by the buttons on the toolbar of the Feature tool. 

[[Image:es gt feature tool toolbar buttons 01]]

You can mouse-over the different buttons to see the views they represent.

Just to the left of <code>Flat</code>, <code>Basic Text</code> gives the feature text, fully clickable. 


==Who calls this feature?==

To the right of <code>Flat</code> is <code>Callers</code>. Try it now by clicking the corresponding button. You may have to scroll down some in the display to see the series of entries show in the image below;

[[Image:es gt feature tool callers 01]]

This view shows all the places in the system that call the routine, or one of its redefinitions. Such information can be invaluable for debugging in particular. The successive paragraphs correspond to the various versions of <code>forth</code> in class <code>LIST</code>, its ancestors and its descendants. Reading from the top we'll examine a few entries: 
* The version from <code>LIST</code> is called in <code>LIST</code> itself by the function <code>is_equal</code>. 
* The version from <code>LIST</code> is called in routines in two debugger classes <code>RT_DBG_CALL_RECORD</code> and <code>RT_DBG_COMMON</code>
* The version <code>forth</code> from <code>MULTI_ARRAY_LIST</code> is a version in a descendant of <code>LIST</code>,  and is called by three routines of <code>MULTI_ARRAY_LIST</code> itself:  <code>duplicate</code>, <code>put_right</code>, and <code>remove_right</code>.
* Although it is not shown in the figure, if you scroll around some, you will find cases in which a descendant of <code>forth</code> has been renamed and that renamed version is called. For example <code>child_forth</code> from <code>LINKED_TREE</code> is descendant version of <code>forth</code> and is called by routines in <code>LINKED_CURSOR_TREE</code> and <code>LINKED_TREE</code>.
 
The following five view buttons are similar except that they let you specify what kind of callers you are looking for, or what is being called by the currently selected feature. Feel free to explore these views.


==What happens to my feature through the inheritance hierarchy?==

After the caller/callee views, the next view button is <code>Implementers</code>. 

This is a very useful view, showing all the ancestors and descendants of <code>LIST</code> that provide a separate version of <code>forth</code>, including the original introduction of this feature in <code>LINEAR</code> and subsequent redeclarations (redefinitions or effectings). The mention <code lang=text>(version from)</code> signals the version applicable to the current class, here <code>LIST</code>. 

Since all class and feature names on these views are hyperlinks, you can display any of the listed versions in a new Development Window by control-right-clicking it (we will see shortly how to display it in the ''same'' tool). Right-click on the feature name <code>forth</code> on the line that reads <code>MULTI_ARRAY_LIST forth</code>. This brings up a context menu and chose <code lang=text>Show --> Text</code>. The tool is now targeted to the routine <code>forth</code> from <code>MULTI_ARRAY_LIST</code>, so that you can see the implementation of the routine in that class. 

We still have two unexplored views, <code>Ancestor versions</code> and <code>Descendant versions</code>. Click the first of these to obtain the ancestor versions of <code>forth</code> from <code>MULTI_ARRAY_LIST</code>. 

The format is self-explanatory: for each ancestor of <code>MULTI_ARRAY_LIST</code> that has a version of <code>MULTI_ARRAY_LIST</code> 's <code>forth</code> feature, it indicates the name of that feature -- which could be something else than <code>forth</code> as a result of renaming, although here this happens only in descendants, not ancestors -- and the version of the feature applicable to the given class. 

In the case of feature merging (combining several features inherited from different parents, in conformance with the rules of the language) there could be more than one history branch, in this case each branch is labeled <code>Branch #X.</code> 

The next button, <code>Descendant versions</code>, similarly tells you all that happens to a feature in the descendants of the current class. 

 
==Who has the same name?==

The last button, <code>Homonyms</code>, displays all the features of the system which, related or not to the current feature by redeclaration, have the same name. You can then explore any such feature to see if the relationship is more than casual. 

In any system or library that takes advantage of inheritance and its associated mechanisms -- renaming, redefinition, effecting, undefinition, multiple and repeated inheritance, polymorphism, dynamic binding -- the feature browsing facilities that we have just explored are invaluable to track what happens to features. What makes them even more precious is their connection with the rest of the browsing and documentation capabilities, especially the pick-and-drop which we will now study.



