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.
advertisement
- Getting to grips with Microsoft's IT Health Environment Scanner
- Virtualise your servers
- The changing face of travel gadgets
- Build your own distributed file system
- The bulletproof Dell that costs an arm and a leg
- Microsoft Office 2010 Technical Preview: Q&A
- Lawnmowers, the TyTN II and one odd insurance request
- There'll never be a bulletproof OS
- How far can we trust apps?
- Five nice touches in Outlook 2010
- ATI Radeon HD 5970: 42% more expensive in the UK
- Office 2010 Beta – 32-bit or 64-bit – The Choice is Clear
- Why Britain's watchdogs have fewer teeth than goldfish
- Tabbed documents: how to make Office 2010 great
- Outlook 2010 People Pane – does it spell death to Xobni
- Microsoft Outlook 2010 screenshots
- Co-Authoring in Word 2010 and SharePoint Foundation 2010
- Microsoft Outlook 2010 screenshots: Backstage view
- Flash 10.1: Developing for Desktop and Device
- Microsoft Office 2010 screenshots: Recover unsaved items
- LogMeIn Express offers fuss-free screen sharing
- Kindle calms customers with library update
- Photoshop app arrives on Android
- Google: we won't remove "disturbing" Obama image
- Internet Explorer hit by zero-day misery
- Sky Player shows up in Windows 7
- Tweetlevel reveals most influential Twitterers
- Apple "refuses to repair smokers' Macs"
- Spotify arrives on Symbian
- Chrome OS and Android to "converge over time"
advertisement
Printed from www.pcpro.co.uk


