Apps versus solutions
Posted on 4 Mar 2009 at 11:04
Simon Jones asserts that "solution" isn't a dirty word, and finds some powerful code-optimisation tools.
Another very handy tool I use every day when programming is CodeRush from Developer Express. It greatly speeds up writing and editing Visual Studio code in VB.NET and C#, by adding extra functions such as automatically completing brackets and identifiers, and expanding short templates into complicated code snippets. These templates can be as simple as expanding "f" to "false", "l" to "else", or "tf" into "try ... catch ... finally ... end try". Each template is context sensitive so, for instance, if you have a collection variable stored on the Clipboard, typing "fe" will generate a complete "For Each" loop that will iterate through the members of that collection, giving a sensible name to the member variable and leaving the cursor at the right place for you to continue typing the rest of the code. If you want to surround a block of code with a call to show the wait cursor, just select the relevant code and press "W". If you want a "#Region ... #End Region" directive around a number of procedures or declarations, that too is just one key-press away. It's also one key-press to swap rows and columns, invert the condition of an If statement, or reverse the direction of a "For... Next" loop.
CodeRush also enhances the rendering of the code in Visual Studio's editor, so that subs and functions show icons indicating their scope and measures of their complexity, letting you know when you ought to simplify a complex procedure by breaking it into smaller chunks. You also get vertical lines drawn at each indent level, so your eye can easily scan up or down to find the corresponding end to a loop or conditional. CodeRush is very powerful and configurable, as all its templates can be customised to your own naming conventions, or other requirements, and you can define your own templates if a commonly used action isn't sufficiently automated for your liking. It also comes with a free copy of Refactor! Pro, one of the most extensive refactoring tools available.
Refactoring is the process of changing the way some code is written without changing the actual effect it has when executed. This is usually done to simplify the code and make it run faster, easier to understand and easier to maintain. A simple example might be to change the statement:
If booSaved Then
booDirty = False
Else
booDirty = True
End If
into the more elegant, efficient and obvious:
booDirty = Not booSaved
This single line has exactly the same outcome as that five-line If ... Then ... Else construct, but runs quicker and is easier to maintain. Refactor! Pro knows how to perform hundreds of different refactorings of this sort, such as extracting a range of code lines into a separate method, changing For...Each loops into For...Next or vice versa, replacing multiple occurrences of the same expression with a variable, promoting local variables to parameters, and replacing repetitive string concatenation with the more efficient StringBuilder class.
Used together, CodeRush and Refactor! Pro speed up the writing and maintenance of Visual Studio code so much that I couldn't do without them. The DevExpress website (www.devexpress.com) has lots of good training videos to help you make the most of CodeRush and Refactor! Pro, which complement the help text and guidance windows built into the products. CodeRush with Refactor! Pro costs $250 and comes with a year's free updates, while Refactor! Pro on its own costs $99. New versions appear three or four times a year, each containing bug fixes and enhancements, and providing three or four good reasons to keep on subscribing.
From around the web
advertisement
- Why virtualisation hasn't slowed the growth of data
- How to make Google AdWords work for your business
- The curse of sloppily written software
- Paying for your crimes with Bitcoin
- Behind the scenes: tech support for Formula 1
- The security risk of fat fingers
- Why Windows Phone 7 isn't quite ready for business
- When will Microsoft stop fiddling with Windows 8?
- Flash down the pan?
- Metro Style apps vs desktop applications
- Chrome's shine getting lost in translation
- BytePac: the cardboard hard disk enclosure
- How tech loosens our grip on reality
- Hokum watch: Safer Internet Day
- Why I'm deleting Adobe from my PC
- Prepare to be patronised: it's Safer Internet Day
- Dear Sony, Samsung and every other tech company in the world: stop trying to be Apple
- Will Apple's Final Cut Pro X update placate the pros?
- Smartr Contacts for iPhone review
- Switching to Office 365's Outlook Web App
- VeriSign slammed for security breach cover-up
- SAP willing to share HANA with Oracle
- Why using a tablet could harm your health
- New RIM boss: no need for drastic change
- RIM founders fall on their swords
- Slow economy helps boost Red Hat revenue by 23%
- Google+ pages get multiple admins
- One in five companies lack card industry compliance
- Oil industry warns hacking attacks could kill
- British workers fear email monitoring
advertisement

