Two point one...

11 January 2007

There's a breathless hush in the auditorium. The audience look around expectantly, peering in to the shadows, trying to be the first to spot the announcer. A small disturbance over on the right results in a communal intake of breath that seems to wash over the room spreading like a whispering wave. The spotlight snaps on highlighting the stage, and...

Ladies and gentlemen, CodeRush and Refactor! Pro 2.1 are released.

Yes, after some very hairy last-minute problems with the installer and a couple of performance issues (all nailed by the team), we are proud to announce versions 2.1 of DXCore, Refactor! Pro, and CodeRush. I admit it's been a while since we released 2.0.4, but the wait is worth it (and I promise we won't make you wait this long in the future). If you are existing customers, your Client Center should have been updated by the time you read this. We're still updating the content on our web site.

So what's new? A veritable gaggle of features, that's what. I'll start off with the new refactorings in Refactor! Pro. They fall in two main areas: the usual code refactorings, and, wait for it, the new refactorings for ASP.NET. You heard that right: we are branching out into the ASP.NET space to give you all the goodness of Refactor! Pro for your .aspx pages. Let's begin with those:

  • Add Validator adds one or more selected Validators to the active input control (that is, the control containing the caret).
  • Extract ContentPlaceHolder moves the selected content from a .master page to a new .aspx file, placing it inside asp:content tags, and inserts a new asp:contentplaceholder tag at the extraction point inside the master page.
  • Extract ContentPlaceHolder (and create master page) moves the content that is outside of the selection in the active .aspx page to a new master page, inserting a asp:contentplaceholder tag to reference the extracted content, and then wraps the selection in the aspx page with asp:content tags and adds a MasterPageFile attribute to link to the new master page. This refactoring is essential for when you migrate your older ASP.NET 1.1 applications to the newer ASP.NET 2.0 and you want to take advantage of the new master pages.
  • Extract Style (class) converts an inline style to a named class style. This and the next one are great for building up a set of CSS styles that you can reuse in your .aspx pages
  • Extract Style (id) converts an inline style to a named id style.
  • Move Style Attributes to CSS moves styling attributes from the active control to a new CSS class and applies the class to the control. Another one of those great "make things reusable" refactorings.
  • Move to Code-behind moves code located in script tags to the code-behind file. For those occasions where you inherit some .aspx pages written by someone else who didn't understand about code-behind and want to apply further code refactorings to the result.
  • Rename renames the active local variable, function, method, field, property, parameter, type, namespace, CSS style and updates all references to the modified element.
  • Surround with Update Panel surrounds a contiguous block of text in the source view with atlas:UpdatePanel... and ContentTemplate tags.

In the area of code refactorings, we of course have some more new refactorings, of which some are still marked as "early experience" (which means we haven't completed testing them in all scenarios although they work well in all common situations). You can elect to turn off the early experience refactorings if you want through the Editor\Refactoring\Early Experience options page.

  • Add Parameter adds a new parameter to a method's declaration and updates all calling sites accordingly.
  • Boolean to Enum converts a Boolean type to an enumeration, updating client code if necessary. This is for those occasions where you have an existing method returning a Boolean, but suddenly realize that there is another result you want to return (for fans of The Daily WTF, this means you can now convert a Boolean result into an enumeration with True, False, and FileNotFound).
  • Break Apart Parameters places each parameter on a separate line, making code easier to read in certain situations.
  • Create Method Stub generates a method for the selected call, with appropriate parameters and return result. This is a great timesaver for the TDD crowd, of which I am one.
  • Extract Function (outside of class) moves selected code into a new function within the enclosing namespace [C++ only].
  • Introduce Parameter Object consolidates selected parameters into single object [Early Experience]. This is handy if you have a method with lots of parameters and you want to clean up its declaration.
  • Move Method to Header moves a method from a source file into the class declaration (in the header file) [C++ only].
  • Move Method to Source File moves a method's implementation to a source file and creates a declaration in the header file [C++ only].
  • Promote to Parameter removes all references to the field or a local declaration from the method, replacing it with a parameter. Calling code is adjusted to now pass in the field or expression of the local declaration as the argument for the new parameter [Early Experience]. An adjunct to the Add Parameter refactoring, and, at least for the way I program, possibly more useful.
  • Remove Parameter removes an unused parameter from a method declaration and updates all calls accordingly.
  • Rename renames the global variable (C++), or macro (C++) and updates all references to the modified element.
  • Replace with Alias replaces the type at the caret position with an existing type alias.
  • Split With Statement splits a With statement into two, one nested inside the other [VB only].

Note that we have added a new multi-file undo manager to Refactor! Pro, even in Visual Studio 2002 and 2003 (which don't have such a thing), so that the renaming of public identifiers not only works but you can undo it too (this was an early experience feature in 2.0.4).

I would also add that we have fixed numerous minor bugs to do with refactoring generics in C# 2.0.

And now CodeRush 2.1. What's new there? Well, the biggest feature for me is undoubtedly our new, fast support for navigating references. First, there's the new Tab to Next Identifier feature: place your caret in an identifier and press Tab and CodeRush takes you to the next instance of that identifier in your code (Shift+Tab goes to the previous one). It's that simple and, once you've used it, you'll never be able to do without it.

Second, as if that feature wasn't enough, we have the new References Tool Window. This is an extremely fast reference-finding tool (2-10 times faster than our closest competitors), and it’s the only reference-finding tool with a Live Sync option to show all references all the time. As you navigate through your code, this tool window stays updated showing the references for the identifier under the caret, or if you find that distracting (say, your caret moves into "int") you can turn off the Live Sync feature and use a keyboard shortcut to update it for the identifier under the caret.

You can watch a screencast of the new references features here.

There's some new templates as well as some changes to the templating engine:

  • "evar" creates events with Add and Remove accessors.
  • dr." creates "DialogResult.
  • "c," creates classes that don't have constructors (the "," at the end of a template, by convention, means that it will have a shorter expansion than the same template without the comma).
  • "c?Type?" creates classes that descend from types with template mnemonics. This is most useful if you've right-clicked on types you regularly work and selected the "Use Type in Templates…" menu item. For example, if you had a class called "Employee", and you assigned a mnemonic of "e" to that type, you can declare a descendant of employee by expanding "ce".
  • Static/shared members can now be declared by making the first letter of the template uppercase. For example, "Mb" will create a static/shared function that returns a Boolean.
  • Parameter templates now add commas if they are missing.
  • Member and type declaration templates now use the default scope settings from the new Editor\Code Style\Scope options page.

And then there's Mark's favorite new feature (apart from the references features): Step Into Member. This cool new debugging feature allows you to step inside the member at the caret (without stepping into any other members that might also be on the same line).

There's a bunch of new stuff for DXCore as well, but since that's not used by the majority of our customers, I'll leave it for another post.

Update: for some reason, cutting and pasting into Community Server screwed up some tag names. Corrected.


Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.