CodeRush Review Part 1


I decided to give the full CodeRush + Resharper! suite a go, with a view to upgrading from the free (and excellent) CodeRush Express Visual Studio 2010 plugin.

I really like CRX, to the extent that in the past I have explicitly removed an install of Resharper because it interfered with CRX too much. So, I was hoping that CR would be more of the same sort of goodness that CR has.

Well, it has lots of things in it, some that I like a lot – but also some things that I’m not a big fan of and that I think still need some work on.

Unfortunately when I tried running it last week I completely gave up on it after an hour or so, and ended up uninstalling it completely. I then caught my breath and decided to give it another go…

As I’m writing this over a period of time, my intention is to give feedback on it over the coming days / weeks as I get to grips with it more and more. So, without further ado, here are my initial thoughts a few days later after install: –

The good

 

Extra refactorings

There are a multitude – dozens, if not more – of new, and mostly excellent refactorings ranging from creating an “else” statement to splitting conditionals to combining return statements. And now I can also rename a class and automatically rename the associated file. As always, you need to spend some time to learn what they are and how to use them – I certainly haven’t found them all – but if you liked the ones in Code Rush Express, then you will be very happy at what is in here.

Tab to next reference

Taken out of CRX since VS2010, this is now back. Wahey!

IDE enhancements

You get a load of addition icons and such added alongside your methods, fields, properties etc. – much like the (sadly no longer free) VS10x Edit View Enhancer. These are a handy way of visually making a large class easier to navigate.

Code Metrics in the IDE

Each method can now also have a little number next to the declaration which represents a code metric e.g. cyclomatic complexity or maintainability index. A nice feature – and it would be nicer if this existed at the class level, too.

XML editor enhancements

I noticed a number of refactorings when editing XML files, such as splitting attribute declarations over multiple lines, expanding selections (as per C# with the numlock keys), and even things like underlining colour declarations in XAML with the colour itself; clicking it brings up a colour mixer – nice.

The not-so-good

 

Installation

The install proceeded without a hitch (having unchecked CRX and just left CR and Resharper!) in there. However, immediately after install and starting VS, I noticed that the usual CTRL ‘ keyboard shortcut wasn’t working – I needed to restart VS again before it woke up. Not the best start.

Intellisense enhancements

There’s an Intellisense enhancement which sometimes tries to guess what symbol you’re trying to type. So if you have declared a variable called  myFirstSetOfResults and start typing “myFi”, CodeRush will try to fill in the variable – you can press Enter and carry on, or Escape to cancel it. (This is effectively a shortcut for pressing CTRL + Space and then Enter which is built-in to Visual Studio). Unfortunately, however, CR had a habit of kicking this in whilst creating a foreach declaration e.g.

foreach (var myFi...)

At this point CR will try to finish off this declaration as well – when you obviously want to enter a new, unique variable name for the temporary variable. It confused me, and shouldn’t have been popping up at this point in code. So far I’ve had mixed feelings about this feature – it’s sometimes handy, other times it just got in my way.

Test Runner

I tried this for about an hour and then gave up. The results window looks nice – sort of like the Resharper one, with a split window for the failed tests and the stack trace etc.. However, the default behaviours are somewhat annoying if you’re used to the VS test runner: double clicking does not go to the test; it reruns it.

It also adds some nice artefacts to the VS IDE – alongside each test (in code) it shows an icon whether it passed or not on the last run, and you can mouse over it to get more details of the test. This is handy (especially if you can bind it to a keyboard shortcut). However, I ended up stopping using the runner for a couple of small but annoying reasons. Firstly, every time I ran a unit test VS decided to do the “ping” error sound – annoying; secondly, and more importantly, CR didn’t always rebuild my assemblies after I made code changes so unit tests were failing even though I’d fixed my code – so I needed to keep manually doing a rebuild and then running the unit tests.

Maybe I’ll try this again in a week or so.

Find All References Dialog

The standard “find all references” dialog has been replaced by a new CR one. I didn’t like it and removed it almost immediately – primarily because they’ve only replaced half of it i.e. SHIFT + F12 goes to the show references dialog, but F8 doesn’t cycle through each reference in the code window. This is something that I simply could not understand – why replace just half of the use case by default? As it stands, the new dialog (which seems to be a sort of find all references / call hierarchy hybrid view) ends up removing functionality because of the lack of this shortcut.

Notifications

You get a massive “Build Failed” banner on the screen when you try a build via the test runner and it fails. I ask you, what exactly is the point of this? It stays on screen for about 5 seconds and then disappears. I found it extremely annoying. Why not just do the usual display of the error dialog tool window? Yes, you can remove it – but why put it there in the first place.

Keyboard shortcuts

This has been the most annoying part of the install so far. CR replaces your keyboard shortcuts with its own, without first bothering to check if they are in use. For example, if you have the VS Productivity Power Tools installed, it comes with a useful “find” feature which has the shortcut CTRL + 3. CR replaces this with a “create region” enhancement – which is a nice feature, but it’s not what I wanted when I hit CTRL + 3. There were a few of these scattered throughout and really drove me mad, as I had to go through the overly-complicated options screen to remove the shortcut from CodeRush. CR simply should not be replacing keyboard shortcuts with anything other than something that does the same as what it did before (e.g. as they have done with the F2 rename refactor), or not doing anything at all.

This is similar to one of the primary reasons why I didn’t like Resharper – it contained a non-standard set of keyboard shortcuts that ended up slowing me down, and I felt like I was learning something that would mean I would end up relying on them and not being able to code effectively without them.

Live Code Analysis

This is a good idea in principle, similar to the resharper one – although I need to find out what the keyboard shortcut for it is – but there were a few things that I didn’t like. Firstly, it shows unused declarations in grey – a good idea, except it did it on the object and event args of event handler methods as well, which are often ignored anyway. And if those event handlers are linked up in XAML, at first the IDE did not detect this and showed the entire method signature in grey – making me think that it was not being used. Only after I had saved and waited some not-insignificant period of time did the code analysis thread “catch up” and figure it out. I found this quite annoying and didn’t really help me because it was fairly slow, and I ended up disabling it.

Conclusion

My initial thought was “wow, there’s a lot in here!”. That’s a good thing – but for someone like me that’s been using CRX religiously for 18 months or more, I got a lot more than I bargained for. I thought I’d have a load more refactorings, and some other bits and pieces, and bobs your uncle – an easy upgrade. Instead, I also got the code analysis, unit test runner and other IDE enhancements, new keyboard shortcuts etc., and I’ve ended up disabled a few of the “extra” features (at least for now) because they were simply overloading me with new things. I plan to try them out in isolation in order to evaluate them properly.

I should point out that I got some good guidance on upgrading to CodeRush from CodeRushExpress from Rory Becker (thanks Rory!), which, once I’d read them, did make my life a little easier.

Advertisements

2 thoughts on “CodeRush Review Part 1

  1. First of all I’d like to thank you for your review. It’s great to see your getting some good use out of CodeRush. There are certainly some places that we can improve and thank you very much for helping us in this area.

    Some general comments 🙂

    Refactorings.
    CodeRush Xpress has over 50 refactorings. The Full version of CodeRush has over 180. For a complete list, open up the options page (Ctrl+Shift+Alt+O) and visit Editor\Refactoring\Catalog. Additionally CodeRush also provides over 70 Code Providers. These perform tasks similar to refactorings but potentially alter you code (for the better) in ways which a Refactoring should not.

    IDE Enhancements.
    It should also be noted that those who prefer a more streamlined IDE (ie less graphical additions) can disable these items very easily using the DXCore Visualize Toolbar (http://community.devexpress.com/blogs/rorybecker/archive/2010/07/26/The-DXCore-Visualize-Toolbar.aspx)

    XML Editor Enhancements.
    We also support the same structural highlighting as with VB and C#.
    The Issues with installation and “Intellisense enhancements” sound like bugs. If you could report these to our support center, we’ll be very happy to look into them for you. (http://devexpress.com/sc)

    Test Runner.
    I think your suggestions…

    – Make double click test action Configurable
    – Provide Shortcut to show test details
    – Make ping sound optional/configurable

    …are entirely valid, and would also encourage you to submit them to our support center.
    Also as indicated previously, we really want to hear about any bugs you find so we can continue to improve our product. We really want you to love what we do as much as we do 🙂

    Find All References.
    We’d be very interested to hear more on you ideas for this dialog. Currently you can single click each item in the results or navigate them using the arrow keys. As you do this a preview of each result is shown on the right, together with a few lines of context. If you wish to move to the next item, simply navigate down. Once you find the item you’re looking for, hitting enter will take you to this location in the main code window. If you’re looking to navigate between references to a given item , it seems that tab to next reference would be a better fit.
    However I certainly don’t claim to have all the definitive answers and would be very happy to hear of any use-case I’ve not thought of 🙂

    Notifications.
    I’m fairly sure that’s not a CodeRush feature, so much as it’s a 3rd party plugin written by Oliver Sturm.
    http://www.sturmnet.org/blog/2008/10/16/instant-gratification-for-developers
    It should be possible to remove this plugin if needed. Community plugins can be found by visiting “DevExpress\IDE Tools\Community\PlugIns” which by default is placed in your “My Documents” folder.
    The File is called something like OS_CompilationResult-1.0.1.0.dll and you’ll probably need to close studio whilst this file is removed.

    Keyboard shortcuts.
    When CodeRush Is run for the first time, it asks you if you’re a new or an expert user. I have written a blogpost about this:
    http://community.devexpress.com/blogs/rorybecker/archive/2010/08/25/coderush-notifications.aspx

    Choosing *New user* will warn you when CodeRush functionality is about to replace default behaviour and give you the option to choose the CodeRush or default VS Functionality. These preferences can be changed later if needed.

    Choosing *Expert user* will instead execute the CodeRush function without requiring confirmation.

    If you’d like to change this option then you can visit the options (Ctrl+Shift+Alt+O) and locate Core\Features. If you’d like to revert to “New user” in order to be prompted, tick the option “Show Feature UI Window”

    Live Code Analysis
    This feature is very useful, however we recognize that there are times when people will want to focus on other things and temporarily disable it. The simplest out of the box method of doing this is to toggle it on or off using the first icon on the previously mentioned DXCore Visualize toolbar (http://community.devexpress.com/blogs/rorybecker/archive/2010/07/26/The-DXCore-Visualize-Toolbar.aspx). out of the box we do not have this bound to a shortcut however you can create such a binding yourself with very little difficulty. My blogpost (http://community.devexpress.com/blogs/rorybecker/archive/2010/10/05/binding-keys-in-coderush.aspx) will help you bind the “CodeIssueToggle” command to the keyboard shortcut of your choice.

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