Productivity, Programming, Performance

The other day I saw a really cool and to the point post entitled 8 ways to be a better programmer in 6 minutes.SecretGeek was talking about .NET development, of course, and so am I. I thought I’ll come up with my own list, but focus on efficiency and speed. Anyway, here it goes.

Make commenting and uncommenting dead easy.Right on the toolbar, click Customize… Drag Comment Block and Uncomment Block onto the toolbar. Using the ampersand, make shortcut keys, respectively, to be Alt+c and Alt+x. How? Just rename the menu items to &Comment and &xUncomment. This allows you to comment and uncomment really quickly, thus avoiding mind numbing and difficult to remember Ctrl+K/Ctrl+C and Ctrl+U. The final result should look something like the picture. This trick works on C#, VB.NET, XML and has worked on every version of Visual Studio since Visual Basic 5. If you are still unclear on the concept, try the hand-holding edition.

Learn the frakking snippets.Seriously, they’ve been around since 2005 – that’s four years. Every time I see a developer writing a property by hand, my blood pressure rises and, given my recent medical troubles, that’s not good thing. Ah, if only I could fire people without regard to their mortgages, kids, debts and families.

Create your own snippets for code patterns you use most. It’ll take you no more than 10 minutes to come up to speed on how to create them. I have, for instance, several that simplify management of classes, data types, etc. I also modified a couple of existing ones to comply with the corporate coding standards.

Make a better environment Courier New is so Windows 95. Consolas is where it’s at and it excels at rendering on flat screens. This font is so much easier on the eyes – mine used to be tired at the end of the day. But not with Consolas. It comes with Vista and higher. XP users can download it. There are other fine new fonts as well, but after trying many of them, I keep coming back to Consolas.

Same goes for your Visual Studio theme. Does white background bother you? Would you like better contrast? Would you like a change once in a while? Hanselman has got you covered. I use a modified version of John Lam’s Vibrant Ink.

Use Add-InsSome people don’t use them because they slow down Visual Studio. It’s true enough for some add-ins (yeah, Resharper, looking at you). However, there are 2 dimensions to this issue: slower startup time and slower runtime. Different approaches are required to tackle either.

Resharper, for instance, slows down both startup and runtime, so you better be sure that its functionality justifies the cost. However, most simpler add-ins’ impact on either startup or runtime is negligible. For instance, GhostDochas no effect whatsoever. Let’s take another example, MZ-Tools. It does slow down the startup, so the fix is to not load it on startup. The perf hit will then occur the first time you use one of its functions.

In addition, it’s pretty easy to write your own. The wizard takes care of most of the plumbing, so you can focus on your needs.

Use the External Tools menu to define your ownThis is one of those unsung features that can really speed things up for you. For instance, I have a “Remove Read-only” and “To Explorer”. They were really easy to write and save me a ton of time I would have otherwise wasted.

To make things even faster, I drag these tools onto the toolbar, so it’s a one-click affair.