If you can't measure it, you can't make it better, right?  Lots of folks have talked about software metrics, just go and pick up a copy of technometrics, or head on over to Cem's site for links to prove it to your self.  The problem with most of them is that many of the existing tried , and "true" methods is that they're CRAZY hard to implement for small Agile companies, and in many cases will cause more harm than good.  That's where CRAP comes in (I leave it to the reader to research further).  It's a simple metric that looks at two things,

                        1. Cyclomatic code complexity

                        2. Code path coverage   


to come up with the "CRAP factor" of your code.  More unit tests lower the CRAP factor, and less complexity also lowers the CRAP factor.   What's nice about this is that it's really hard for all those smart developers to game as making the CRAP factor go down involves good things happening in the development process.

The only problem, for me, with all the CRAP'py goodness is that its all written in Java, and runs in eclipse -- which is great...  Except,  Atalasoft is 100% .Net, and Microsoft Gold partner to boot. So, all Java solutions are no good for me.

Looks like its time to starting porting.  For those interested in helping me out let me know, and I'll put everything up on CodePlex ahead of it mostly working. There are two big issues that need to be solved to port CRAP4j to .Net.  You need an assembly that can give you path coverage statistics, and code to calculate the cyclomatic complexity. 

The easier issue to start getting into was figuring what to use for calculating code coverage as CRAP4j uses Agitar's coverage library; which, does all sorts of nice wonderful things that I can't make use of in .Net.  I chose PartCover as it's i) open source, ii)  does path coverage and pretty much everything else nCover does, but is open source, iii) works with .Net -- is open source, and iv) others are using it as well, did i mention it was open source.  There are plenty of problems with PartCover as well most notably that it doesn't purport to support ASP.Net at least according to the the forums, and needs to be massaged a bit more to get the needed information out of it to make the code complexity class work.


Next Week:  What I did to PartCover to make it work...