I heard today – slightly belatedly, due to some rogue spam filtering – that Code Rocket for Visual Studio has been released (currently works for C++ or C# – no VB).
At its heart, Code Rocket’s a simple idea, but many of the best ideas are simple ideas that no-one happens to have had before. What it does is to take a handful of useful development practices – pseudocode, flowcharts, comments and documentation – and ties them together so that you can get the benefit of all of them without having to do lots of copying and pasting or rework.
Code Rocket allows you to switch between the first three views quite freely when writing your code. External documentation is more of a one way process, as it’s generated from your code, but you can’t round-trip back to the code from the documentation. As it’s of least interest to me, I’ll just point out that it may be of use to some, you get HTML generation out-of-the-box, and you can pay more to output in Word format or PDF. You can configurably include the other things I’m going to talk about in the output document.
For me, at least, Code Rocket really shines in two important respects, which may seem a little contradictory at first. In practice, I don’t think they are, although of course your mileage may vary. It helps you to understand code that hasn’t already been well commented; and it encourages you to better comment your own.
If you’re presented with a many-hundred-line method with zero or less comments, you should first of all suppress the urge to take up axe-murdering as a hobby. Once you’ve done that, open up Code Rocket’s Diagram view, position the caret anywhere in the offending method and marvel at the resulting flowchart. Code Rocket knows enough about code structure to begin to make some sense of the mess by laying out symbols so that you can follow the flow of logic visually. It will also try to put meaningful labels inside the symbols. Here, it’s more at the mercy of whoever wrote the code. If there are comments in sensible places, it will use those. If there aren’t, it will use the most appropriate snippet of the code itself instead.
It’s clever that Code Rocket can understand the code structure and present it clearly. However, it’s possibly even more clever – though technically simpler – that it can use comments in the diagram. Comments are the core of what Code Rocket really does. You can write pseudocode or add labels to flowcharts – and save them as plain text comments in the code. You can modify the comments in the code, and the changes will be reflected in the pseudocode and diagram views. And that’s why it helps you to better comment your own code – keep the diagram window open beside what you’re writing, and you will want to comment your code in such a way as to make the diagram clearer.
If you prefer to write pseudocode or draw diagrams before getting into the coding, of course you can do it that way round too. And if you’re already using XMLDoc comments to document the structure of your classes – don’t worry, Code Rocket won’t clash with those at all, but complement them. The documentation output can include both.
If your particular boxes aren’t ticked by the combination of Visual Studio and C++ or C#, keep an eye out for Eclipse and Java support expected soon, and the mysterious “Data Rocket” expected towards the end of this year.
Unfortunately the price is a bit high for most individual users – starting at £150, with no cheap or free single-user licence – but within an acceptable range for a business, and well worth it if it results in better quality, more easily understandable code.