Friday, March 12, 2010

Refactoring Tools Review - part II

(Cross post from IRefactor)

Oh, my God!
I am definitely in love!
I finally had the time to play with the latest DevExpress's Refactor! Pro and Code Rush.
Two distinct main features capture my eyes immediately:
  • The ability to highlight the changes/code smells and refactorings inside the Visual Studio's Editor.
    It seems that the team invested a lot of effort in order to enable painting on the Visual Studio's editor and canvas.
    This enables a smooth user experience, without prompting and stalling with unnecessary dialogs.
    The changes are visualized directly on the source code.
    Below is one of my favorite refactoring steps: "Extract Method" visualized in Visual Studio 2008.

  • A huge amount of automated tasks: navigations, refactoring steps and code improvements.
    Refactor! Pro has more than 150 refactoring steps to automate the burden of the day to day refactoring.
    Code Rush brings smooth navigation within the code, markers (like the bookmarks in VS, but they work across different files/projects), templates to enhance the development and "on the fly" static code analysis.
    Below is a partial list of the Refactoring Catalog:

    Here is a screenshot of a Code Issue found in the code, by the "on the fly" code analysis. Pay attention to the blue indicator being painted on the editor's scroll bar:

    Navigation features and Templates allow a very fast development experience.
    The CodeRush window trains and suggests interactively, templates or other actions that are applicable at the current position.

However those are the small things that make these tools so great. It's unbelievably easy to develop clean code in the first place and to refactor it later. Meet your new friend; Hit "Ctrl+`" and all your dreams will come true :)

The tools allow you to develop fast and smoothly: you will double your productivity, you will find that it is easier to navigate through the code and finally you will find that you can give up the mouse. Being a Software Craftsman it's very important to know the tools of the trade (IDE commands/shortcuts). CodeRush and Refactor! Pro can help you to achieve that. Moreover, these tools provide a good sense of living in one place. Everything is achievable through the Visual Studio Editor and accessible through one keyboard combination or another.

If you have seen my previous post, you have probably noticed the Editor layout I used in the past. Code Metrics Window, Code Definition Window and Source Length Guides hack (in the registry) were combined together to enhance the IDE. The combination, using default Visual Studio's windows, was to say the least, a bit unnatural.

Here is my Editor's layout that utilizes the CodeRush's features:

You can easily see that the code metrics are placed very conveniently adjusted to a method. The source length guides is configurable and can be easily modified (without hacking the registry) and the references window is awesome as it allows colored Code Definition Window's experience.

Notwithstanding; Though CodeRush and Refactor! Pro are great tools, there will be quite a learning curve in order to master all (or at least a great deal) of it's features. There are so many that each day I discover new and exciting ones. Therefore, in order to maximize your experience you will need to invest time learning the features. For that purpose DevExpress provides a descent help (coming installed with the tools) and also maintains a good training video series, here. In addition, as stated above, the CodeRush Window provides an interactive learning experience while you are working on your code base.

I would also suggest adding the following to the refactoring catalog:
  • "Move Method" - an ability to move a method to a different class/file.
    Refactor! Pro provides a very close feature, called "Extract Method To Type", but there are several issues with the later:
    • Sometimes the method is already given, but should be moved to a different location.
    • Extracting a method to a different type is a combination of two basic steps: Extract Method and Move Method. Refactoring usually preaches to do small changes followed by compilation and unit tests execution. Combining those two steps can affect beginners; They can either premature utilizing the refactoring or can fail, to correctly interpret the right location for the method.
  • "Remove Parameter" - an ability to remove a parameter from a method's declaration.
    Also here, Refactor! Pro provides a close feature, called "Remove Unused Parameter". Though, I easily can degenerate the use of the parameter inside the method and then use the "Remove Unused Parameter" step, I still find it useful to remove first the parameter from the method itself.
CodeRush comes with TestRunner and supports now several xUnit Test Frameworks.
A nice to have feature is also:
  • A support for a parametrized Unit Test Attribute, such as TestCaseSource.
From performance perspective, I have found CodeRush and Refactor! Pro satisfying. I didn't feel any unnecessary pauses or delays during my work, while utilizing the tools.

Finally, the most important note :). Would I consider to purchase these tools?
My answer is, it depends: As a corporate that wants to boost its developers performance, buying the whole package of CodeRush and Refactor! Pro for 249.99$ makes sense. As an individual developer, the only less expensive option is to consider a purchase of just the Refactor! Pro license for 99$. I will add, that if DevExpress will cut of the number of features in CodeRush and Refactor! Pro, but will provide a license from 50$ - 120$ it will make the individual developer's life easier.

A disclaimer: I have received a fully functional copy of the CodeRush and Refactor! Pro in order to allow the investigation of the features over the time.

No comments:

Post a Comment