Wednesday, September 13, 2006

Code statistics and documentation

Code statistics
I would like to recommend an add-in for Visual Studio that I have been using for many years now, called Project Line Counter. It is a code statistics add-on for Visual Studio, from version 6.0 and up. I use this to measure relative complexity between my projects, counting lines of code, comments, blank lines, etc.

Code documentation
Code layout and documentation (proper commenting) is something that is very important to me. There is something beautiful lingering over a well crafted piece of code that has been carefully commented. The art of writing code that is more or less self-explanatory intrigues me. Back in the days when C++ was my everyday language, I used a well known tool called Doxygen. I have long kept my eye out for a good replacement when working on the C# platform.

There is the NDoc utility, which, when I tried it out, didn't have any support for .NET Framework 2.0, and specifically generics. At the same time, I found that Microsoft Sandcastle - Microsoft's MSDN-style code documentation generation tool - had been released as a CTP, so I decided to have a look. Unfortunately, the CTP I tested was very cumbersome to use, with very illogical hardcoded paths, many steps that needed to be performed manually, etc. After some experimenting and a couple of .bat files, I did manage to produce a CHM style documentation for my test project. At first, I had problems getting it to resolve the .NET Framework types, but I managed to get this working.
There is now a later release - the August CTP - and without having tested it, I hope it's easier to use.

All in all, I would recommend people to at least have a look at it. Good documentation generation tools for C# doesn't come in bundles, but I find them very necessary. More people should use them. Currently, it's basically a battle between NDoc and Sandcastle, where NDoc has the lead. I have read that Sandcastle will be integrated with Visual Studio, which sounds great for me. I will definitely continue to follow that up.

No comments:

Post a Comment