Mini-Review of Code Rush

These days I’m very much in the market for anything will cut down on manual typing.  Thus I’m dictating more of what I write (using speech recognition), and today I began to explore CodeRush: a highly extensible Visual Studio plug-in

Being very smart marketers, DevExpress offers a free version: CodeRush Express, which is a somewhat stripped down, but fully useful product, and they offer a 30 day trial of the full CodeRush product. The trial, however, allows you to install both the trial of CodeRush and the free CodeRush Express.  Of course, trying out CodeRush is like driving the turbo enhanced model of the car you want.  Once you do, it’s mighty hard to go back to four unassisted cylinders, and I suspect it will be mighty hard to step down to CodeRush Express.  But stay tuned.

 

Some of what CodeRush does is not immediately intuitive (at least not late at night), but  the documentation is excellent, and includes some surprisingly useful animations.  My biggest complaint is that while they tell you how to do many things, they don’t always tell you why you might want to (hey, does that sound familiar?)  A classic example of this is that you can have "Smart paste" where, for example, you copy “a < b” and when you paste you get “a = b.” This to me was not obviously useful, but I tried it out and the light bulb lit:

if ( theValue < minValue )
{
theValue = minValue;
}
 
To create this I copied the condition, and pasted it as the action, and that was very sweet.

You can of course create your own Smart paste constructs; which I suspect I’ll do quite a bit.

What You See Is What You Will Get

What moved me to write this brief review before fully exploring this product, however, was the following wicked cool experience.  In a bit of sample code I wrote:

public class foo
{
int age;
public foo()
{

}
}

I then used the template expansion for initializing the member variable

InitializeMemberVariable

 

With one click, this initialized the member variable “age” to zero.

MemberInitialized

[highlighting added]

That was really nice, I could see doing that.

I have chosen the option of having a value next to each method indicating its relative complexity (the pale red 5 to the right of the method name) and I’ve asked it to display the architecture of the program by drawing faint lines between connected braces.

 

CodeRush then indicated that there was more that could be done with the member variable age (you may be way ahead of me)

EncapsulateField

 

The three blue dots under the member varaible “age”  Eare CodeRush’s equivalent to a smart tag (this like everything else is configurable) and notice that the re-factor dialog offers two CodeRush refactor options as well as three Visual Studio modifications.

As you would guess, with one click you are able to encapsulate the member variable into a field.  What I find particularly nice is that before committing to the change,  CodeRush shows you what it’s going to do:

 

BeforeSettingTheProperty

 

Note that I’ve done no drawing on this image; everything shown here appears inside the Visual Studio editor, complete with the arrows indicating that the member age will be replaced by the property, etc. 

The graphical preview is enormously useful for making sure that the changes your expect are what you’ll get, and also for learning about new technology (e.g., switching back and forth between anonymous methods and lambda expressions) and for instructing others.

Hints

Immediately upon accepting this change, a blue "hint" indicator appeared, letting me know that CodeRush felt the code could still be improved.  Hovering on the hint opened a box that told me what the issue was, and offered a one click solution

 

IssueIndicator

 

Once again, the change was graphically displayed before I committed to it:

ProposedAutoProperty

Clicking on the link implements:

AfterAcceptingAutoProp

It was all much faster to do then to explain. It was also an entirely pleasant experience, without any opportunity for confusion.

 

It’s early days, but this software looks like a keeper.

About Jesse Liberty

Jesse Liberty has three decades of experience writing and delivering software projects and is the author of 2 dozen books and a couple dozen online courses. His latest book, Building APIs with .NET will be released early in 2025. Liberty is a Senior SW Engineer for CNH and he was a Senior Technical Evangelist for Microsoft, a Distinguished Software Engineer for AT&T, a VP for Information Services for Citibank and a Software Architect for PBS. He is a Microsoft MVP.
This entry was posted in z Silverlight Archives. Bookmark the permalink.