Pages

Thursday 22 October 2009

DevExpress CodeRush and Refactor! Pro Review

I've been taking a look at this 2-product package from DevExpress over the last couple of weeks. These are my findings...

Pros
  • Adding cyclomatic complexity numbers to the left-hand margin of members was very nice. This gives you immediate awareness of whether your method needs to be refactored.
  • The Metrics window allows you to see any of the 8 measures for an entire class and then double click a member to dig down into the code. This I liked a lot.
  • Adding contracts to methods was reasonable.
  • Automatically greying out unused or unnecessary code (including namespaces, contexts and members) was very nice.
  • Inline ability to suppress suggestions for a varying scope was good.
  • Pull Member up. Lists parent classes to move a member to.
  • "Introduce a using statement" (to an IDisposable object) worked extremely well.
Cons
  • Initial thoughts are that it hides poorly written code and, thus, detracts from Craftsmanship.
  • I removed all the vertical connecting lines - far too messy.
  • The suggestion to make some variables inline was wrong. It makes the code harder to understand and, anyway, the compiler will do it.
  • The jump / break / return pointers are interesting and pretty, but it simply validates overly complicated code.
  • The suggestion to replacing objectName + ".sql" with string.Format("{0}.sql", objectName) is not necessary. Strings are, indeed, immutable; but you can concatenate them efficiently during the instantiation.
  • Suggestions to remove this. from variables - I didn't like that. I don't qualify methods with this, but I do for properties and fields. It would have been nice to separate the features.
  • I removed the Region Painting functions as it was less clear than VS's inbuilt features.
  • Disabled the Structural Highlighting. If you need an icon next to the word private to tell you that it's private then you really shouldn't be a developer!
  • Circular suggestions. Having converted a newed-up object to use Initialisers it then changed the suggestion to decompose it!
Wish List
  • A prompt to automatically end a #region. including the text e.g. #endregion Constructors.
  • Context-sensitive help in the Options dialog please.
  • Ability to add multiple metrics rather than just Cyclomatic Complexity or Line Count etc. to the left-hand margin of classes.
  • In the Option dialog identification of Level in the tree view would help.
  • A refactoring routine to create the protected On() method for events.
Conclusions? Well, overall, not bad at all. I thought I wouldn't like the interaction and the perceived lack of control; but it was actually pretty easy to use. It does take a while to learn. You just have to get stuck into some code and see what it suggests. Soon you'll find yourself wondering whether it can do xyz for you - normally it can. I, personally, will be keeping it.

My biggest fear is that too many of the features are there just to mask bad code design.

2 comments:

  1. > Circular suggestions. Having converted a newed-> up object to use Initialisers it then changed > the suggestion to decompose it!

    We are unable to reproduce this. Can you submit sample code to support@devexpress.com?

    Tips: Press Ctrl+3 to place a region around the active member or selection.

    Copy and paste an event declaration to get the protected On method. For example, copy a declaration like this:

    public event EventHandler DoThis;

    and paste it to get this:

    public virtual void OnDoThis(DoThisEventArgs ea)
    {
    if (DoThis != null)
    DoThis(null/*this*/, ea);
    }

    You can edit what happens in an Intelligent Paste operation in the options dialog. Follow these steps to get to the Intelligent Paste options page:

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

    Editor\Clipboard

    3. Select the "Intelligent Paste" 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.

    ReplyDelete
  2. Hi Chris,

    It was good to meet you just now and load you up with books :)

    I didn't ask though - do you use ReSharper already as if not then I would highly recommend installing the 30 day trial. Next time you are over we can run through how we use it and maybe you could even pair with us and see it in action.

    Cheers

    +Steve

    ReplyDelete