News  |  About  |  Tools  |  Training Courses |  Services |  Contact Us

 
 


 
 

The Refactory News
About Us
Tools
Refactoring Browser
Method Wrappers
Sharp Smalltalk
SmaCC
Training
Services
 
Tools  

  Refactoring Browser

The Refactoring Browser is an advanced browser for VisualWorks, VisualWorks/ENVY, and IBM Smalltalk. It includes all the features of the standard browsers plus several enhancements. Some of its enhancements are:

  • Buffers: You can edit many methods at the same time without opening other browsers. For example, while you are editing one method, you can switch to a new buffer to lookup some value in another method, and then return back to your edited method without opening a new browser.

  • Drag & drop: You can drag & drop methods on classes or protocols; protocols on other classes or on protocols; classes on other categories; and categories on other categories.

  • Hierarchy: You can easily switch between a hierarchy view and the normal category view without spawning a hierarchy view window. This picture shows the hierarchy view on the VisualLauncher class. Also, it shows a resource viewer displaying an icon.

  • Menus: The browser has window menus, so you can use the short-cut keys for selecting items from the menu and rely less on the mouse. Additionally, the code tools in the bottom pane of the browser have context-sensitive menus that change depending upon what is selected.

  • Multi-window: You can have many different code tools in different windows with only one navigator controlling them. In this mode, only the top most code tool will be updated when you change the navigators selection. If you want to use the multi-window browser, see the customization section below.

  • Old methods: No more accidentally accepting changed methods. Whenever you change a method in one window, all other browsers viewing the methods will turn their code tools red until you update their code or accept the method. If you do not like the color selection, you can change it in BrowserCodeTool>>modifiedTextColor.

  • Resource viewers: View resource methods in their more natural look instead of text. For example, a menu resource method appears as menu, not as text, although you can switch to a textual view if you want. This picture shows a canvas viewer viewing the ClassNavigator>windowSpec method.

  • Undo support: The Refactoring Browser can undo/redo refactorings, method changes, and class changes. The class variable, UndoSize, in RefactoringManager specifies the number of undos that can be undone. The default size is 5.

The icons signify that the feature is not implemented for IBM Smalltalk.


Joseph Pelrine has ported the refactorings from the Refactoring Browser to VSE. You can download them from ftp://st.cs.uiuc.edu/Smalltalk/STV/st_v/v_win32/refbrwsr/.

If you have problems using any of the ftp://st.cs.uiuc.edu links above, then your machine probably doesn't allow reverse DNS. In this case you can download the files by replacing ftp://st.cs.uiuc.edu with http://st-www.cs.uiuc.edu/ftp/. Also, you could use one of the mirror sites.

If you wish to see what has changed between the versions, you can look at the fixes file.


Other Refactoring Information:


User instructions:

To open the refactoring browser select the [ ]button or evaluate "RefactoringBrowser open". If you're using ENVY, then you can select the "RefactoringBrowser" from the ENVY menu in the launcher. This will open a window that is similar to this picture.


Common Questions & Answers:

  1. What does the ____ refactoring do?

    This page contains a description of the refactorings.

  2. Is there a Java (or C++) version?

    We do not have and are not currently working on a Java version. While a Java version is definitely needed, we have other things we need to do (e.g., get our degrees). However, given the right incentive (i.e., $$$), we could implement a Java version.

  3. How can I tell what version of the Refactoring Browser I currently have?

    If you are using ENVY, then you can simply look at the version number of the Refactoring Browser configuration map. It should be something like R3.0.0. If you are using the parceled version of the Refactoring Browser, you can look at the parcel versions. Finally, if you are using the non-ENVY VW2.5, you can look at the RefactoringBrowser class. It contains two class variables (Version & PatchLevel). By concatenating these two numbers together, you can get the overall version number.

  4. I've found a bug, how should I report it?

    The first thing you should do is to determine that you are running the latest version of the browser (see previous question). After seeing that you have the latest version, please try to find a simple reproduceable case that you can post to the HyperNews page. If you cannot find a reproduceable case, you can still post the problem (it will just be harder for us to find the problem). It is your responsibility to report the bugs (since we don't charge anything for the browser, you should atleast be able to report bugs). We cannot fix any problems that we don't know about.

  5. Is there a port for GemStone?

    No, we don't have GemStone on our machines, so it would be difficult for us to create one. If someone creates a version, we would be happy to include it.

  6. Can I only rename methods in my application; not the whole image?

    Currently, the Refactoring Browser renames everything when performing a renaming refactoring. Since we cannot determine which implementors of a method are polymorphic, we must rename everything (else we might miss some senders). In the future, we may relax this restriction to allow you to specify which ones to rename.

    If you are using ENVY, then you may want to follow the suggestion by Niall Ross.

  7. Does the Refactoring Browser have to format a method when it changes the method by a refactoring?

    The Refactoring Browser uses parse tree to perform its transformations on. Since parse tree are used, it is easiest to just have the parse tree to format themselves whenever they are changed. It is definitely possible to not have to reformat for every change. However, this has not been implemented and is not a high priority for us. Therefore, either some user can implement it themselves, or we would be open to implementing it if someone is willing to pay for it.

  8. What are the BR prefixes for?

    The BR prefix stands for Brant & Roberts. Only after being questioned about the prefixes did we realize that it should have been RB (which works for both Refactoring Browser and Roberts & Brant).

  9. How does the Refactoring Browser determine if a class is abstract?

    Smalltalk doesn't have any language feature that denotes an abstract class like C++ or Java. As a result, we check for a couple things when looking for an abstract class. If the class contains any method that sends #subclassResponsibility, the we consider the class as abstract. A method that sends subclassResponsibility signifies that users should override this method in every subclass to have all the class' functionality to work. Another check we use to determine if a class is abstract is to look for references to the class. If the class is not referenced then the class is considered to be abstract, since there is no way to create an instance of the class.

  10. Why does the Refactoring Browser care if a class is abstract?

    The Refactoring Browser can only perform some refactorings if the class is abstract. For example, it can only push a method down if it can determine that the method can never be called on the class that the method is being pushed out of.

  11. Are there any restrictions on the Refactoring Browser's code (e.g., GNU copyleft)?

    We don't have any restrictions on the code. You are free to use it for what ever you want. However, we do request two things if you use or modify the code. If you modify the browser, please submit your changes back to us. We will try to integrate your changes back into the browser. The other request is that if you use the code in some project, we would appreciate some recognition of its use (e.g., an acknowledgement in a readme file). It is always pleasing to see your code running in several different applications.

    While we don't expect any major problems, we assume no responsibility for any damages it may cause. We've been using it for over three years without any major problems. If you find any problems, please send us a description so that it won't happen to others.


Customization:

The new browser was designed to be extensible and customizable. There are several methods that you can modify and/or execute to change its behavior.

  • Multi-window support: You can change the browser so that each code tool is opened in a new window, instead of creating buffers for each tool. To change the browser to be multi-window evaluate "RefactoringBrowser beMultiWindow", and to change it back to single window mode evaluate "RefactoringBrowser beSingleWindow". Once you evaluate either selection, you must open a new browser.

  • Vertical navigators: You can change the navigator from it's default horizontal position to a vertical one by evaluating "RefactoringBrowser beVertical" and switch it back to horizontal by evaluating "RefactoringBrowser beHorizontal".

  • Resource editors: You can change the editor and/or viewer for a resource (menus, canvases, etc.) by changing ResourceTool>initialize method. For example, to change the menu editor, so that the new VisualWorks 2.5 enhanced menu editor is opened, change UIMenuEditor to MenuEditor, and then re-initialize the ResourceTool class.

  • Code tools: You can create a new code tool and add it to the browser by modifying the CodeModel>codeToolClass method. This method determines which code tool is used for the navigator's selection. Code tools can be created by creating a subclass of CodeTool, defining its interface functions, and defining the updateContents method. The updateContents message is sent to the code tool so that the code tool can stay current with the navigator's selection.


Bugs:

If you find a bug in the Refactoring Browser, it is your obligation to report the bug to us; don't assume that we already know about the bug. Also, if you have request for additional features or would like something changed, please let us know. We cannot guarantee that your feature will be added, but we can guarantee that it will not be added if we don't know about it.

There is one bug that appears to be a bug in the Refactoring Browser, but is really a bug in VisualWorks ENVY. Many of the refactorings on class variables will not work. The Class>>removeClassVarName: method assumes, incorrectly, that class variables are strings (which works for VisualAge, but doesn't for VisualWorks). You can fix this by changing:

        self classVarNames asOrderedCollection
                        remove: existingClassVarName asString ifAbsent:[];
                        yourself

to:

        self classVarNames asOrderedCollection
                        remove: existingClassVarName asSymbol ifAbsent:[];
                        yourself 


Comments or suggestions can be sent to brant@refactory.com and roberts@refactory.com.
Last updated on 29-Oct-1999.