next up previous contents
Next: IntelliJ Renamer (Java) Up: A Short Look on Previous: Refactoring Browser (Smalltalk)

JRefactory (Java)

 

  figure271
Figure 2.1: JRefactory UML Interface, including Metrics and Package Selector

JRefactory [JRefactory] is a tool provided under the GPL written in Java by CHRIS SEGUIN to allow easy application of refactorings by implementing a user interface that is based on UML diagrams as visualization of the concerned Java classes. It can cooperate with the JBuilder [JBuilder IDE] and Elixir [Elixir IDE] IDE's but also be used in a command line variant. When using with an IDE the tool supports switching to the appropriate code line for a method or field of a class.

These diagrams are compiled out of the Java source files. The incorporation of the supplied source files of the Java Development Kit [JDK] is also required (it takes a long time). The user interface allows zooming (in certain steps), moving classes and changing association lines.

Refactorings are applied by selecting the class(es) to be modified and selecting the appropriate refactoring in a pop-up menu.

The program supports the following refactorings:

A feature that is more interesting than really helpful are the metrics supplied. It is possible to show the metrics for a package or a class, including absolute and average numbers of classes, methods, statements each averaged for the higher structural units (e.g. average statements per class, or per method). The metric information highlights problem classes and methods with with either to much methods or to much statements per method. See code smell LongMethod (see 1.6, p.gif). Unfotunately the averaged numbers are shown with up to 10 decimal places which does more hindering than helping. I think it would be helpful if the numbers that exceed certain ranges (low and high) were highlighted.

When testing the program the limited possibilities of interfering with the user interface showed up to restrict its usefulness. As the classes of a whole package are shown in one UML class diagram, it easily gets confusing because there are too many classes shown at one time. The fixed step zooming possibilities are of no help either. The class names can only be read at the highest magnification and have to be guessed at the other steps. No class can be hidden to allow focusing on problem areas and packages with many classes slow down the user interface very much.

The classes are arranged in a very inconvenient way - they are just lined up horizontally. It would be very useful if the tool would incorporate the functionality of any UML diagram editor that is required for useful operation on the diagram (e.g. continuous zooming, automatic ordering, possibility to hide classes/methods per diagram or per class or template, etc.) or even better if if was incorporated in a UML tool itself.

It also produced several exceptions partially originating from the JDK-classes. The refactorings which were applied to the test package worked quite well. The newly implemented Move Method refactoring was everywhere disabled, therefore it could not be tested. The Renaming worked only with classes. When refactorings were applied to the test package they didn't show up on the diagrams, not even after reloading them. Only after exiting the tool and restarting it, the applied refactorings got visible.

As the tool does not operate on source code level, only general restructuring refactorings can be used. Therefore it would be necessary to use another tool to do the source code level refactorings as Extract Method or Decompose Conditional.


next up previous contents
Next: IntelliJ Renamer (Java) Up: A Short Look on Previous: Refactoring Browser (Smalltalk)

Michael Hunger
Mit Okt 25 00:48:16 MEST 2000