Monday 6 April 2009

Developer Productivity Tools

My primary developer tool is Microsoft Visual Studio. However, I use a number of Visual Studio add-ins and other complementary tools.  Here I describe what (other than Visual Studio) I use and why.

Visual Studio Add-ins

The MSDN articles, Ten Must-Have Tools Every Developer Should Download Now and Visual Studio Add-Ins Every Developer Should Download Now, are a useful point of reference.

Smart Paster

Smart Paster allows you to paste text on the clipboard into a Visual Studio code document as a comment, a string, a StringBuilder or Region. See here. The link mentioned there is broken. The Visual Studio 2008 version can be found here. I most often use "Paste as Comment." This is useful for inserting words from technical specs. into your code as comments. Smart Paster works with both C# and VB. I like it for the reasons stated in the MSDN article.

CodeKeep

CodeKeep is a repository for storing code snippets online. You can make these snippets available to the public or keep them private.  Snippets are available in multiple programming languages. You can either grab a snippet by browsing to the site snippet and copying and pasting it into your code editor or you can make use of a handy Visual Studio add-in. I find it most useful for being able to access my own code repository when I'm working at different client sites.

GhostDoc

This is one of the slickest add-ins I've used. Basically it reduces the tedium of writing XML documentation comments. Visual Studio allows you to type /// + Enter to generate an empty summary element for a class or member in C#. At that point, to complete it you must fill in your summary plus, for a method, documentation for any parameters and return value. What GhostDoc does is provide placeholders for these and also tries to infer a "starter" description from the name of your class or method. Often, depending on how well you've named your method, it gets the descriptions exactly right. But even when it doesn't then simply reducing the tedium of the angled brackets is a godsend. See also here.

GhostDoc is also intelligent enough to update its generated documentation should you, say, add an extra parameter to a method. It can also generate any existing documentation from base class methods in inherited classes. Its description rules are customisable, though I've barely scratched the surface. Because GhostDoc reduces the tedium of documentation it actually encourages you to write more of it than you otherwise would. For example, I used to be fairly good at writing at least summary documentation but now I pay more attention to documenting parameters as well, especially when combined with another excellent but more obscure plug-in I use called CR_Documentor which I discuss next. GhostDoc works with both C# and VB, although VB support is described as "experimental." There are indeed one or two glitches with VB, though nothing too serious.

CR_Documentor

CR_Documentor is a plug-in for Developer Express's freely downloadable DXCore extensibility engine. If you are a user of CodeRush or Refactor!, either commercial or free, then DXCore is installed with them. It is the engine that makes those products work. Alternatively, DXCore can be installed by itself. There is a small community of plug-in developers who have provided a number of useful plug-ins. CR_Documentor is one such plug-in. Here is a good overview

Below is an example from my own code. To examine this in more detail see here. Click on the magnifying glass icon to zoom in.

CR_Documentor

The great thing about CR_Documentor is that it allows you to view "in-place" and in real time what your XML documentation comments look like when rendered in tools such as NDoc or Sandcastle without actually having to first build your solution and then run these tools.  With CR_Documentor you can spot any errors there and then rather than having to wait for Sandcastle to generate the docs in order for you to identify and correct the errors and re-run. Again, because this is such a fun product, it actually encourages you to write documentation so you can get instant gratification.

Refactor! Pro

Developer Express is a .NET components and tools vendor. One of their products is a code refactoring tool called Refactor! Pro. There is a companion tool called CodeRush that includes Refactor! Pro.  The two products together compete with the better known ReSharper from JetBrains.

I used ReSharper a few years ago at a client site. It was an excellent product and I daresay it must be even better today. But a while later I discovered Refactor! Pro initially via the licensing agreement between Microsoft and Developer Express in 2005 to include Refactor! for Visual Basic in Visual Basic 2005. I happened to be working in a Visual Basic contract and one of my assignments was to engage in a major refactoring exercise, so I thought I'd give Refactor! a spin. I became hooked immediately by it's slick, highly visual and non-modal UI paradigm. Below is a picture of the Extract Method refactoring. Visual Studio already has this for C# but I prefer the Refactor! implementation. Besides, Visual Studio C# has only about a half dozen built-in refactorings. Refactor! Pro now has nearly 200 and had about 50+ when I bought it in about 2006.

Extract Method

Not long after I took the plunge and purchased the full version.  Apart from preferring its UI paradigm my other reasons for preferring it over ReSharper were that Refactor! Pro offered support for both C# and VB, as well as C++ and more recently JavaScript. At the time of my decision ReSharper only offered C#.  As I anticipated using all these languages Refactor! Pro was a no-brainer. Thus far I've not taken the plunge and opted for the full CodeRush package. How do CodeRush and ReSharper compare today? As far as I can tell CodeRush/Refactor! Pro may be a little stronger on refactoring while ReSharper is stronger on code analysis and unit testing. Apart from this which is preferable seems largely to be a matter of taste.

CodeRush Xpress

Recently Developer Express made available a cutdown version of CodeRush for  C# developers called CodeRush Xpress. I have started using this and its best features are its file and class navigation support. You could say "Solution Explorer kiss my ass."

File Navigation

image

Quick Navigation

 image

The idea here is that CodeRush dynamically displays a list of file names or code elements as you type additional letters. Moreover it searches for any fragment within a name, not just the starting characters. Especially useful is its Pascal/Camel Case feature. This is easiest to explain by examining the following picture.

image

Typing the letters BDA displays a list of all types that are made up of words starting in BDA.

Code Metrics

Visual Studio Team System (VSTS) has a code metrics feature. This measures properties such as cyclomatic complexity and maintainability.  If you don't have VSTS then it is possible to obtain similar information via Reflector and its code metrics plug-in. See here for a close-up.

Code Metrics

CodeRush/Refactor! Pro also has a code metrics feature. The major difference and advantage it has over the other two is that the display is dynamic, i.e., the complexity graphs update themselves immediately after edits.

Cyclomatic Complexity

It's a useful way of driving your refactoring efforts. For example, Developer Express suggest that code complexity should be <= 10 and maintenance complexity should be <= 200. The complexity measures also work with C++ code. I don't think VSTS complexity does.