I like working with good tools. Work is more fun when I feel that the tools I have make work go faster and more smoothly, and give better results. It’s important to me that the kitchen knives I use have a good edge, that the chopping board is solid, that my pruners are sharp and the cleaning cloths are absorbent. I do not understand how people can make do with dull knives and cheap plastic chopping boards.
Likewise I like to work with good software. I need good software. I don’t understand how people can stand having Notepad as their text editor, not because they are uninformed and believe that Notepad is all there is, but because they can’t be bothered.
My two latest favourites are Selenium and SourceMonitor.
Selenium is a tool for testing web applications. Very easy to get started with, powerful, and flexible.
It’s got a “recording” module which records your actions in Firefox – what pages you open, what links you click, what text you type – and also lets you easily specify test conditions such as “verify that, after I’ve clicked all these things, this particular text is present on the page. You can save the tests in html format, and the file structure is so simple that anyone can edit and extend the tests. But you can also export the tests in your favourite programming language, or, if you prefer, write the tests from scratch in that language.
I used the Firefox addon to record the first tests and exported them to C#, and then went on writing the rest of the tests directly in C#. The whole process was very straightforward. We now have about 45 automated tests for core high-level functionality.
Plus, it’s free!
SourceMonitor is a tool for estimating code complexity. It is also free.
I’m very aware that our code needs refactoring, because large parts of it are so complex that they are effectively unmaintainable. But because everything needs refactoring, and I’m still not familiar with all of the code (because it is so hard to read), I don’t know where to start.
SourceMonitor has been very helpful for finding the hot spots, for prioritising the files and methods that are in most urgent need of cleanup. It quickly shows which files and methods are largest or seem most complex. It can sort them by size, complexity, levels of nesting, number of calls out to other methods, etc. This can be done for the project as a whole, or for a particular file. SourceMonitor also saves the results of each analysis run, so you can see how things change over time. I like seeing measurable progress, so this feature really appeals to me. There is something immensely satisfying in knowing that I have just reduced the size of our code base by 400 lines and at the same time made it better.
Before choosing SourceMonitor I also looked at FxCop and NDepend, but both were too complex for our current needs, and did too much. We’re nowhere near the level of control that these two applications provide, such as enforcing naming rules. I expect that I’ll try them again in half a year’s time. I might have chosen NDepend anyway, because the demos look so slick, but it costs money, and given how little of its functionality we will use for now, I would find it hard to justify the cost.
FxCop is free just like SourceMonitor, and I did try it out, but it was not particularly easy to get started with. The main hurdle was that FxCop needs compiled assemblies to work with, which makes it very difficult to use with ASP.NET web sites. SourceMonitor analyzes source code instead. I also found SourceMonitor’s sparse interface much more comfortable on the eyes and the brain than FxCop’s flood of messages.
Leave a comment