One Simple Metric

At our last Agile Iowa meeting on Thursday, Jared Richardson, he was talking about Agile Testing Strategies. He mentioned a metric he used that I found very interesting. He took three variables and created a report that listed the top 10 method/assemblies that were at risk.

Here is the (simple) equation:

Cyclomatic Complexity (CC):

Usage (U): How many other methods/classes rely on this code.

Test Coverage Percentage (TC): The percentage of the code that is exercised by a unit test

Risk Factor = CC x U x (1 - TC)

Let's look at a couple examples:

This first table shows a method used by 50 other methods (Usage) with a Cyclomatic complexity (CC) of 20. I then vary the code coverage for this method. Without any unit tests, the risk factor is a cool "g" (or Grand). As the test coverage increases the Risk Factor decreases. When the test coverage reaches 100%, the Risk Factor is reduced to zero. The function is linear, so decreasing the usage or the complexity will also reduce the Risk Factor. So it make sense that if a method isn't used, it has a risk factor of zero.

CC Usage Code Coverage Risk Factor
20 50 0 1,000
20 50 0.1 900
20 50 0.5 500
20 50 0.9 100

The following methods all have the same risk factor of 250. Do you think this is reasonable? Should one of these factors be weighted heavier?

CC Usage Code Coverage Risk Factor
10 50 .5 250
50 10 0.5 250
50 50 0.9 250

For now I'm going to see how I can get the usage and the code coverage numbers automated... I can tweak the algorithm more later.

Vote for out little angel

My wife did such a great job writing this up on Sadie's blog that I couldn't help but post it and plead for more votes.

-Tim

A few months ago, Sadie participated in a "Little Angels" photo shoot for the Leukemia & Lymphoma Society. For a small donation, local photographer Lori Nordstrom photographs your child dressed and posed as a little angel. The pictures are adorable and all donations go to the Leukemia & Lymphoma Society, which made perfect sense to me, so we signed up.

After the shoots, selected photos are then posted on a website where people can vote for their favorite photos with the top 12 vote-getters slated for the 2008 Little Angels calendar to be published this September. Each vote is $1 and, again, all the proceeds go to the Leukemia & Lymphoma Society.

We've spent thousands of dollars on photos of Sadie at this point. Between all the ones we've taken, in addition to all the ones we've had done professionally, I would guess we could support a small village. So, with that in mind, I thought this was a great way for us - and friends and family - to give back.

This is where you come in...Voting closes June 30th. To place your vote:
1) Go to www.picturemyportraitonline.com
2) Enter the event code - angel - all in lower case letters. Click continue when the studio information comes up. When the page with photos opens, scroll down at the top to list 40 photos per page. Sadie is about halfway down, second from the left. "little angel_022" is above her picture. She's the one with the pearls.
3) Then, in order to vote, click on her picture and "place an order," it is $1.00 per vote. You can vote in any amount you want to. The scroll down menu allows you to pick the number of votes you want. Keep in mind all votes are TAX DEDUCTIBLE. It is a direct donation to the Leukemia & Lymphoma Society and will show up on your credit card as such.

You can also pre-order the calendar on this site. Once again, all proceeds will go to the Leukemia & Lymphoma Society. The calendars will also be available at various retailers around the city starting in September.

Thanks, in advance, for your support of this wonderful cause.