Monday, December 31, 2007

Mug

Hello again, X-mas celebrants! I have just one last verse in my carol to make all of your Visual Studio 2008 experiences bright. Don't let your hearts be saddened because my song is drawing to a close. After today, a new year filled with its own code blessings will be upon us.

My last offering is a simple one—a stocking stuffer, really. It's one last refactoring targeted at Visual Basic developers.

And so, it is with a heavy heart that I begin the last verse of the "Twelve Days of Refactor! X-mas..."

"On the twelfth day of X-mas my true love (DevExpress) gave to me..."

Extract XML Literal to Resource

In my opinion, the most compelling new feature of Visual Basic 9 is XML Literals. We've already seen how Refactor! Pro can be used to manipulate XML Literals to great effect, saving literally hundreds of keystrokes. However, sometimes we don't want to dynamically build XML. Sometimes we simply want to consume a chunk of raw XML.

Module TwelveDaysOfXmas
  Sub Main()
    Dim lBook = <book isbn="12252007">
                 <title>Refactoring: The True Meaning of X-mas</title>
                 <price>$0.00</price>
                 <author>
                   <first-name>Dustin</first-name>
                   <last-name>Campbell</last-name>
                 </author>
               </book>
  End Sub
End Module

If we're not adding embedded expressions to the above XML literal, it really belongs in a resource file. However, moving that XML to a resource is a terrible inconvenience. Thankfully, Refactor! Pro provides the Extract XML Literal to Resource refactoring. When applied to the code above, Extract XML Literal to Resource produces the following:

Module TwelveDaysOfXmas
  Sub Main()
    Dim lBook = XElement.Parse(My.Resources.XMLFile)
  End Sub
End Module

When compared to the acrobatics we've already seen Refactor! Pro perform on XML Literals, this refactoring might seem like a very small thing. It may be simple, but it's incredibly helpful when you need it. The first time that you attempt to move an XML Literal to a resource for translation purposes or any other reason, you'll be thankful that you have Extract XML Literal to Resource to do the job for you.

Check Out This Screencast to See Everything that Extract XML Literal to Resource Handles for You!

And so ends my song. We've taken a merry sleigh ride through many of the new language features available in Visual Studio 2008, and we've seen how Refactor! Pro can help you leverage those features today. It's been my distinct pleasure to be your guide on this journey.

Before I take my leave, I have one small piece of advice. If you've been waiting impatiently for the other tool to support for Visual Studio 2008, remember that Refactor! Pro has been there since the very first beta. No matter what that tool vendor may try to tell you, Visual Studio 2008 was not a surprise. Everyone had more than a year to prepare. The only ones taken by surprise were those who weren't paying attention.

And with that, I wish you a continued happy holiday season and hope Refactor! Pro can make your new year bright!

Happy New Year!

posted on Monday, December 31, 2007 1:57:09 PM (Eastern Standard Time, UTC-05:00)  #    Comments [5]

kick it on DotNetKicks.com
Monday, December 31, 2007 2:23:25 PM (Eastern Standard Time, UTC-05:00)
I love that you guys are so steadfast in your views regarding the "other tool". It's admirable because it shows you have drive. That drive has seen your product catching up very rapidly. That said, you might not want to beat the drum quite so fervently until you've caught up on a few of the "other tools" fundamental, long-standing features that CodeRush/Refactor Pro! _still_ haven't replicated: file/project/solution analysis, syntax highlighting, and find all references functionality that actually works. Get those three in there and I'll be an instant convert.
Jeremy Gray
Monday, December 31, 2007 2:30:25 PM (Eastern Standard Time, UTC-05:00)
Let's see, 150 refactorings, Visual Studio 2008 support, *real* VB support... I'm not so sure that Refactor! Pro is the product that needs to be "catching up."

As for the other features that you mentioned, some of those are extremely high priority at the moment for CodeRush. Have you seen the early experience support for file/project solution analysis in CodeRush 3?
Monday, December 31, 2007 7:10:00 PM (Eastern Standard Time, UTC-05:00)
I'd love to see the early experience features, but CR3/R!3 is practically unusable in my work environment. With the "other tool" I'm getting a 5 minute solution load / rebuild time, with post-build devenv.exe main memory usage of around 750MB. With CR/R! I'm getting approx 11 minutes and 1.5GB. At the end of the day it won't really matter how many refactorings you have if I can't use them.

To be clear, I love the style you guys have taken for CR/R!. One-key refactoring with great preview, nothing modal, loads of refactorings, strong multi-language features, DXCore for extensibility, very transparent development cycles, and, probably more important than anything else you guys are on a REALLY great trajectory to overtake the other tool (you guys are almost surely architected better, if your ability to smoothly introduce new functionality is any indicator.) That said, you're just not there yet.
Jeremy Gray
Monday, December 31, 2007 7:11:43 PM (Eastern Standard Time, UTC-05:00)
PS - 11 minutes / 1.5 GB (which was the average, by the way. CR/R! peaked at 1.9GB, whereas the other guys would have peaked around 800MB doing the same load/rebuild) was _without_ enabling any early experience features.
Jeremy Gray
Wednesday, January 23, 2008 7:39:05 PM (Eastern Standard Time, UTC-05:00)
I was inspired by this series of blog posts to download the trial edition of Refactor! Unfortunately, I also found that it made Visual Studio unusable. With my team's standard solution (~25 C# projects, 2 C++/CLI projects), the memory usage of devenv.exe with Refactor! Pro loaded quickly shot up to about 1GB. Almost every build ended with the error message "not enough storage is available to complete this operation", or with an OutOfMemoryException being thrown.

I had tasted the benefit of Refactor! Pro for a few days (on a smaller solution with 5 C#-only projects), so it was with some sadness that I uninstalled it.
Bradley
Comments are closed.