RSS

Visual Studio Add-in Comparison: CodeRush & Refactor! Pro

02 Feb

I know, I know…I should’ve post this weeks ago, but it took me more time due to some personal and business reasons. Anyway, now the article’s here and it’s time to rock the world with with CodeRush and Mark Miller. Enjoyed the movie? I’m sure you did. Let’s see what are we able to do with keyboard, but step by step.


Table of Contents

First-time Configuration
Templates
Refactoring
Navigation
Code Analysis
Visual Impact
Unit Testing
Performance & Memory Consumption
Ease Of Use
Extensibility
Final Thoughts

First-time Configuration

I’ll skip the installation as it takes just a few click and run the Visual Studio 2008 SP1. After the very first startup (with CodeRush and Refactor! Pro installed) you face up with the following dialog.

Welcome Dialog

The dialog allows you to switch between “New user” or “Expert user” modes and gives you an option to run the tools manually instead at startup.

If you’re a new user of CR, then just accept the predefined settings. As you’ll see later, using “New user” mode will shorten your learning time.

The first two things you’ll notice (once everything is loaded) are:


The DevExpress menu
. Trough the menu you can access add-in related windows, configure options and check for updates. However, this menu doesn’t bring any additional functionality to Visual Studio, so you won’t need it many times.

DevExpress Menu

The DXCore Visualize toolbar.

DXCore Toolbar

The toolbar contains a set of toggle buttons allowing you to turn of/off the following features:

- Code Issues
- Spell Checker
- Member Icons
- Flow Breaks Indications
- Code Metrics
- Structural Highlighting
- Region Painting
- Right Margin line
- Step Into Member

All of these features (except “Step Into Member” – which is being used in Debug Mode) are related with code editor. I’ll return back to them when writing about Code Issues and Visual Impact.

I think that the most important thing for many developers is Coding Assistance, that’s why I’ll start with that first. As this is a set of categories like templates, refactoring, code issues detection and others, it would be great to put them all under one roof. In CodeRush this is done trough the tool window, like the one bellow.

CodeRush Window

Moving the caret around the code gives you some tips, as we’ll see that during the review.

Note: this windows is turned of by default, so you need to open it manually by going to “DevExpress\Tool Windows” menu and selecting “CodeRush”.

Now it’s time to put templates under the pressure.

Templates

As a developer I want to produce more code in less time, that’s why templates are very important for me. I believe many developers thinks the same. Visual Studio templates are useful, but not as much as I want, so something more powerful would be more than welcomed. I open up the CodeRush window to get some help around the templates. I want to create a Collection<string> property inside my class. As I have no idea how to use templates, I follow CR assistant. Here’s an example of how CR assistant will help me writing my code.

Property Template

Method TemplateAs you can see, it was pretty easy to create property. How about a method? Same technique, just instead of p (as property) I used m (as method). I don’t want to spend a day writing about templates only, so you’ll have to believe me on word, that CR templates truly rocks. I’m impressed with them, especially as it’s possible to use my own classes in them. To do that I needed just to right click on the class I wanted to use in CodeRush templates and click on “Use Type in Templates…”. Great isn’t it? Well there’s one thing that bothers. I didn’t find a way to remove my class from templates. However, this doesn’t change my opinion about CodeRush templates. They’re just awesome.

Refactoring

Refactoring is another important word in developer’s dictionary. I will show just some of the refactorings Refactor! Pro provides. As you can see, list of refactorings is very long, but does that mean we can take full advantage of them? No, unless you find a way to do that. What bothers me in Visual Studio is the way how to execute refactoring. I need to use menu or remember all shortcuts, which is pretty silly. Why we can’t have one keystroke to rule them all? So I went to CR Options hoping to find something to ease my life. After spending a few minutes in “IDE\Shortcuts” section, I found what I was looking for. Ctrl+` is a default hotkey to bring up all possible refactorings under caret position. Yes!

Time to see how refactorings in action. I press the magic hotkey to bring refactorings popup in front. Something I haven’t been used to see before, is a preview showing what each refactoring will do.

Refactor #1

Do you like the it? I do and I do from the whole begin. It was a great help to understand what will happen in the code once an action is taken. Moving among possible refactorings will reflect in preview. Here are some of other possible refactorings:

Refactor #2

Refactor #3

…and another one in VB.NET:

Refactor VB.NET

Do you often search for a class or a file in your solution? You want to quickly find all references? I do. And using Visual Studio native support is more or less awkward. CodeRush has answer to that, and that’s a pretty good one.

  1. Quick Navigation: provides you a way to find members and types, by accessibility and scope. Search works very well even on large projects. The most fabulous thing about that is “T-SQL LIKE” search and uppercase search, seen on the image bellow shows.Quick Navigation
    Holding Ctrl key will give you a preview of selected member (text in blue rectangle).
  2. Quick File Navigation: will allow you to easily find files within the solution. This search is very similar to previous one.
    Quick File Navigation
  3. Jump to menu: This menu allows you to jump to specific part in your code with respect to your current position."Jump to" Menu
  4. Tab navigation: This is something you’ll love it. Pressing a Tab key when your beam cursor is on member in the code will highlight all references of current member. Pressing Tab again will move you to next occurrence, while Shift+Tab will navigate you back.Tab Navigation
  5. Uppercase navigation: Another thing I love as well is uppercase navigation. By holding Alt key when using arrow keys left/right will move cursor to previous/next uppercase character in the word. En example of this functionality can be seen on pictures below.
    Navigate Right
    Alt+Right 

    Navigate Left
    Alt+Left

    Navigate with Selection

    Alt + Left Using Shift key along will give you another option with selection

  6. Show References: Not much to say about it. This is a good looking window, but it doesn’t bring any functionality that’s worth a mention except the preview. It’s UI and performance are way ahead of Visual Studio’s, but it has some deficiencies as well. I really miss a shortcut/hotkey to navigate up and down among the results, just like support for multiple results. Another thing I’d really like to see is support for interface references if class implements an interface. However, we’ll have to wait for that a little bit longer. Maybe someday this will be all implemented, but until then I find this dialog pretty much useless.Show References
  7. Markers: Does it happen to you that you don’t know where you ended up before using “GoToDefinition” a few times? So far Visual Studio’s navigate backward menu served me pretty well, but I hated one thing. Whenever I changed cursor position, a record was added to history. This means that every time I wanted to go back to where I left, I had to go trough long history. I think this should be done more simple. CodeRush provides Markers. Markers allow you to remember current cursor position, so you later return to it very quickly. For easier understanding, imagine markers as a LIFO stack of bookmarks. So how do they works? When you execute “GoToDefinition” action for example a blue triangle is being dropped as you can see on the picture bellow.

    Markers

    Create a MarkerWhen marker is collected a blue circle (like on image above) appears and starts narrowing until it finally hides. I like animation as it catches my attention, so I can know what happened instead of looking around the screen where my beam cursor ended up. Another cool feature about markers is that are heavily used in CodeRush templates. This allows you to quickly jump into another block like in try-catch template.Note: Use Alt+Home shortcut to create your own marker.

Code Analysis

Once I ran Visual Studio with CodeRush installed I’ve noticed a vertical bar on the right side of code editor. This bar is visible when code analysis is turned on. So I moved my mouse to the bar and hovered over one of the red lines. A very nice popup jumped up showing what error are present in code.

Code Analysis

Moving a cursor to each “notification box” on popup window will give you preview of code where an error has been found. If you click on it, your caret will jump to error location. This “notification boxes” contains some links – suggestions to fix the problem.

All issues are accessible in code editor as well.

Issues Solutions

So what kind of stuff CA – Code Analysis reports:

  • Errors
  • Warnings
  • Information
  • Redundancies

Code Analysis provides 120+ code issues detections which is great. However. CR issue detection engine isn’t as good as it looks at first sight. Sometimes it reports false issues and some suggestions need improvements.

Visual Impact

Depending on what we’ve seen so far, we can say just WOW! Visual impact in CodeRush is at highest level. No doubt about that. If you don’t believe me, then take a look what’s left for this section:

  1. Structural Highlighting: gives you great overview in codeStructural Highlighting
  2. Member Icons: represents type of member (method, property, field, class, …)
    Member Icons #1If you click on member icon you get the following menu:
    Member Icons #2
  3. Flow breaks: as you can see on the image bellow, addition icons appears in editor. Those icons represents spots in code where flow break is possible. Hovering any of this icons will trigger a nice animation showing you where the code will continue after the break. If you click on it, the caret will jump to that location and a marker will be left in case we need to return back.
    Flow Breaks
  4. Code Metrics: Those who put some attention to metrics, will love number of metrics CodeRush provides. Some of them are visible in editor…
    Code Metrics in Editor
    …and the rest of them are accessible trough metrics window, which can be opened trough “DevExpress\Tool Windows\Metrics” menu.Code Metrics Window
  5. Region Painting: Does this reminds you at Visual Basic? Even if I never liked VB at all, I find region painting very useful, especially when code is full regions.

    Region Painting

  6. Spell Checker: is a great addition to CodeRush. Unfortunately it works only in comments, but even that is good help.

    Spell Checker

  7. Important Informations: won’t get unnoticed in CodeRush. Some of them are exposed trough additional window which appears in the bottom right corner…Notifications
    … some of them are OSD text.OSD Notifications

Unit Testing

Do you write unit tests on a daily basis? If you don’t then it’s time you start it. Those who are writing them, which one do you like the most? Nun it, Mistiest, Mount or unit? Does it even matter? Well maybe for each of us it does, but it certainly doesn’t for CodeRush as it supports al of them. Don’t event know if there’s anything else good out on the market as I’ve been using Mistiest all the time. However. Let’s see what’s the real benefit of CodeRush unit test against native Visual Studio support.

One thing that will catch your attention for sure is a new icon in front of “Test” attributes and at the end of namespace. By clicking on this icon a context menu appears giving us two options to go for it.

Unit Test #1

So what happens after that? Instead of seeing results in the “Test Results” window, we do seem them straight in the code. This visualization provides better overview which tests need to be run again. Hovering the icon will show you a message, where test has failed.

Unit Test #2

Ok this way we get great overview in code, but what about overall? CodeRush provides a window name “Unit Test Runner” which allows you to see all available unit test.

Unit Test Window

Tests can also be run straight from context menu:

Editor's Context Menu Solution's Context Menu

Performance & Memory Consumption

For some people this might be the most important part as not everyone can afford a high-tech workstation to run such monster. Should we see how CodeRush performs on a big stage?

I took a source of Enterprise Library 4.1 to run some test as I count it as a big enough solution having 1600+ files, 170.000+ lines of code across 42 projects. My first expectations are that both performance and memory consumption will rise in heights.

The first thing CodeRush will do when solution is opened, is complete parse of source code. A window like this should appear.

Processiong Dialog

Once the source is parsed and cached in memory we can start working. I think there’ no need to spend much words about the testing itself, as I’ve just added a few classes, methods, properties,…

I have tested CodeRush on my home workstation. Here are specs:

Processor: Intel i7 920 @ 2.66 GHz
Memory: Corsair Dominator 3 x 2GB DDR3 @ 1600 MHz

On this machine CodeRush works like a charm. No delays, or anything worth a mention, but I’m pretty sure many of you don’t use such configuration to work at, or do you?

That’s why I made a test of CodeRush at my work machine as well.

Processor: Intel Core2Duo @ 2.66 GHz
Memory: 2 x 2GB DDR2 @ 800 MHz

Difference between both machine is pretty obvious, but the results aren’t that much worse on this machine. You might notice some delays from time to time, but in general your work won’t suffer of bad performance.

How it should suffer when everything is kept in memory right? I’m not quite sure where actually is being kept, but if that’s in memory then something must be wrong.

CodeRush uses only 47MB to be aware of all 170k+ lines of code? At first I couldn’t believe it, but it’s true.

Memory Lab Dialog

Of course this usage varies depending on what you’re doing in the code, but in my case it never crossed 80MB, what’s damn good.

More about memory consumption can be read on this blog post: http://community.devexpress.com/blogs/markmiller/archive/2009/06/17/performance-and-memory-milestones-in-coderush-and-refactor-pro-preview-of-9-2.aspx

Ease of Use

There’s not much to say about that. This depends on each user itself and a how natural he feels the way CodeRush works. For me it’s brilliant as it provides many ways to quickly learn it. We have at our disposal “CodeRush training window”, tons of visualization effects and at last Dev Guide – a great guide trough all of CodeRush features.

Guide Dialog

Extensibility

We’re getting close to the end and this is the last section. If you feel CodeRush doesn’t provide enough functionalities out of the box, you have ability to extend it by yourself as much as you want it. Of course there are quite a few CodeRush extensions out on the web.

I think this is also official site for CodeRush extensions: http://code.google.com/p/dxcorecommunityplugins/

Final Thoughts

There are many things I could talk about CodeRush, but I’ve pointed out the most important. This tool has some black spots, which needs better implementation (like “show reference” or “navigation from/to interfaces”) but overall this tool is just brilliant.

Next review will be about ReSharper 5.0 Beta, so keep reading.

About these ads
 
9 Comments

Posted by on February 2, 2010 in Tools

 

Tags: , ,

9 responses to “Visual Studio Add-in Comparison: CodeRush & Refactor! Pro

  1. Mark Miller

    February 2, 2010 at 17:16

    Hi Danijel,

    Great review! I appreciate the depth of the analysis.

    > remove my class from templates

    When you specify to use a type with the templates, it adds that type name (and the shortcut you connected to it) to the Dynamic Lists options page. If you want to later change the shortcut or delete the entry, you can do this on the Dynamic Lists options page:

    1. From the DevExpress menu, select “Options…”.
    2. In the tree view on the left, navigate to this folder:

    Core

    3. Select the “Dynamic Lists” options page.
    This page level is Advanced, and will only be visible if the Level combo on the lower-left of the Options dialog is set to Advanced or Expert.
    4. Make sure the Language combo box at the bottom of the dialog is set to Neutral.
    5. Select the “Custom Types” list.
    6. Find your type in the list and specify a new mnemonic or press Delete to remove it.

    > I really miss a shortcut/hotkey to navigate up and down among the results

    You can press the up/down arrow keys here when the reference window has focus. If the editor has focus, you can press the Tab key to invoke Tab to Next Reference.

    > just like support for multiple results.

    We expect to add support for multiple tabbed result sets to the References Window in a future release.

    The spell checker works in strings, code comments, and XML doc comments. You can configure these settings on the Editor | “Spell Checker” options page. Unresolved issues with the spell checker can be sent to support@devexpress.com.

     
  2. Danijel Malik

    February 2, 2010 at 18:02

    Hi Mark,

    Thanks for your additions to this review. It’s great to see you commenting on my blog.

    When I started writing this post I thought it will take me 4-5 days and then I’m done. After a few days of testing I realized that it will take me much longer as list of features never ended up. I felt like I could write about it for ages.

    It’s very likely that once I’m done with other add-ins I’ll make a podcast about it.

     
  3. Kevin White

    February 3, 2010 at 02:05

    Hi Danijel – can we chat about your review above? If possible can you send me a note via my email address.

    Thanks,
    Kevin

     
  4. Jura Gorohovsky

    February 3, 2010 at 19:49

    Hi Danijel,

    Thanks for the great review!
    If you have any questions while you’re reviewing ReSharper, drop me a line and feel free to ask them!

     
  5. Masroor Ehsan

    March 6, 2010 at 08:24

    Hi Danijel – thanks for the extensive review!

    I loved the screenshots – they augment the text very nicely. Maybe devexpress should hire you into their documentation team ;)

    Eagerly awaiting your review of ReSharper!

     
  6. jennifer

    June 23, 2010 at 23:11

    I love this website, the information is great and I have bookmarked it in my favorites. This is a well organized and informative website. Great Job!

     
  7. Jack

    November 9, 2010 at 08:13

    Great post! I like the add-in, it improve the effeciency a lot.

     
    • Danijel Malik

      November 9, 2010 at 09:22

      @Jack I’m glad you like the post. If you’re intersted in knowing more about VS add-ins, feel free to read the series about ReSharper. Posts about R# will continue very soon now when I have a little bit more time to write them.

       

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: