Make my code better... please!


Having moved away from the world of software design and architecture, for my day job at least, does not mean that I have not been keeping a keen eye on the tools and technology for Technical Architects working with .NET. This post is a round up of the tools, documentation and podcasts that have crossed my path over the last few weeks and months in relation to code design, maintenance and architecture:


While FxCop does WPF and .NET 3.5 in their latest beta release, there is still some way to go with static code analysis; mainly because FxCop will only look at compiled assemblies. This is important to note when looking a code style; which is what a fair percentage of most code reviews are about. To help with that issue Microsoft have used a tool internally called StyleCop for yonks, but officially it has now been dubbed Microsoft Source Analysis for C#, the purpose of which is to examine the source (text) files as opposed to the compiled assembly. The documentation of all the rules is a work in progress, but if you want a consistent enforceable coding style in your shop, you could do a lot worse.

For XAML, HTML and ASP.NET markup there is the Visual Studio add-in called Tame Markup, for keeping that pesky X[A]ML/HTML in-line, literally. As with both this tool and the style cop above, you may not agree with all the rules or layout choices of the developers that created the tools but at the end of the day consistency is king and most of the time any rules are better than none - you can write your own version when you have the time ;)

Code complexity is an interesting concept and something all architects should care about when having to maintain a product or project with a large code base. Standards go a long way to helping reduce complexity but there are limits to that approach. The Reflector add-in, CodeMetrics is a useful tool for looking at code complexity and other code metrics, but you still need your own guidelines in-house to make effective use of this tool, as well as a good understanding of cyclomatic complexity. But, for a top notch solution look no further than the Metrics feature within CodeRush. All the other tools up until this point have been free, however, CodeRush is a pay-for product, it's worth the price tag in my opinion, and there are beta versions available for download for free; where you can see some of these metrics at work. Mark Miller, the brain behind CodeRush, has some very interesting views on code complexity and code maintenance, which are now being reflected in his product and Maintenance is a great metric for your code.

For the budding framework designer there is Framework Design Studio. Initially written "on the plane" by one of the writers, Krzysztof Cwalina, of the illustrious Framework Design Guidelines (which is getting the second edition treatment due out at the end of this year!). This tool enables you quick review and compare your new and old APIs.


Krzysztof has published a digest of the Framework Design Guidelines. It is an interesting list of do's and don't without the explanatory text provided by the full blown version of the book, which is then ultimately enforced by FxCop.

For WPF developers, Paul Stovell offers his coding guidelines and there are the WPF Application Quality Guide from the Microsoft developers too; both are worthy of incorporation into your WPF development practices.

From a design perspective there are the Design Patterns in C# and VB.NET from the Data Object Factory, a nice little site for getting to grips with the GOF design patterns (and not this GOF). There is also a great MSDN article by James Kovacs on loosely coupled design.


There has been a lot of decent "live" content out there recently in the form of podcasts and Webcasts but the notable sessions for me centre around two broadcasts involving Mark Miller, the first is a .NET Rocks! podcast and the other is a DNRTV episode on exactly the same topic, the Science of Good UI, but the second link uses pictures (oooh-aaaahhhhh!)

Enjoy! I know that I have.

1 comment:

Anonymous said...

Good round up of what's available. Thanks :)