Code complexity greater than ten raises my eyebrows.
February 28, 2006
I was reading this post about managed code analysis and code complexity over at the Vertigo Software Team System blog. Down the bottom of the post they picked up on an issue which frustraites me as well. That is the hard coding of trigger points for code analysis warnings and errors against the cyclomatic complexity count.
Personally I want anything over ten to trigger a warning and anything over twenty to throw an error. My opinion is that with the frameworks we have today and the refactoring tools available to us there should be no excuse for writing a piece of code that is too hard to get a handle on, and that _starts_ happening once you get over a CCC of ten.
The solution is that in the next version of VSTS needs to make rules configurable (in the same way check-in policies are). Basically – if the rule implements a specific interface we should be able to right mouse click on it in the configuration screen and bring up a custom configuration dialog.

In this case the UI could have a couple of trackbars which map to a fragment of XML which is stored in the MSBuild file and passed to the rule when it is invoked. The exclusion system could be tweaked a bit as well to allow complexity up to a certain point but not beyond that.
The scenario that I am thinking of is when you do a code review after the above has triggered a warning and you decide that the code really can’t be improved by rather than just putting in a blanket exclusion you say that you will accept complexity up to its current level, but if it goes beyond that you want to be warned again. To make this possible an XML fragment would need to passed into the constructor of the exclusion attribute.
At any rate – the current defaults are WAY WAY WAY too high.
Mission Accomplished
February 28, 2006
At the beginning of this month I started a bit of an experiement (and at the same time set myself a challenge). The goal of the experiment was to find out of content really is king.
If you read the posts on the blogosphere most people will tell you content is really important, right before the repeat that thing that the last blogger posted up about. Basically its really hard to get objective advice about how you grow the amount of traffic that comes to your blog.
The method that I used was simple. I would focus on posting the most interesting and mostly unique content that I could and each day I would check to see how the traffic was increased (if at all) and whether people liked the content. To make it interesting I set myself a challenge to see if I could quite literally double the amount of traffic I was getting.

As you can see from the graph above I accomplished my goal, I pulled these stats tonight (11:23PM) and as you can see the number of unique visitors in January is less than half the number of unique visitors in February. The number of hits that I got to my blog was 223055, although Grant redminds me that hits are How Idiots Track Statistics.
What will be interesting to see is whether the grow continues into next method if I keep up the effort and at what point does it plateau.
Readify adopts Windows Mobile 5.0 and I do some development.
February 28, 2006
Today everyone at Readify (well, mostly everyone) moved their mobile phone numbers over to Vodafone and onto a corporate phone plan. Up until today we pretty much a free reign to choose our own mobile phone plan (within reason) and by extension our own phone.
Because everyone had selected their own phone we had a huge variety of not only form factors but also underlying operating systems. Unfortunately this meant that while we had a huge amount of processing capacity on our phones we couldn’t harness it because it was too difficult to produce custom software that would run across all of them.
So – with our new corporate phone plan pretty much everyone in the company is getting a new mobile device from i-mate from a subset of their product range based on their own personal preferences. For example, a few of us opted for the JasJar device (myself included) whereas others went for smaller form factors such as the JAMin, SP5, and K-JAM.

Which mobile device you use is such a personal choice which is why we standardised on i-mate as the make – they basically provide the widest selection of form factors. I’ve actually had an opportunity to play with all the devices over the last couple of months and I pretty much arrived at the JasJar by process of elimination, hopefully it will arrive next week.
The K-JAM would have been my second choice because it also has a keyboard but the size wasn’t right for me. Both the JAMin and the SP5 didn’t even qualify because they either only allowed input via the t9 dictionary or via the input panel on the screen. The JasJar also has cool factor for the following reasons:
- It folds up like a Tablet PC convertable.
- 640×480 screen resolution.
- Large keys on the keyboard.
- Supports GSM, GPRS and 3G including fallback.
- Two cameras, including support for video phone (to another JasJar).
- Did I tell you it folds up like a Tablet PC convertable?
- Windows Mobile 5.0
Whats interesting is that everything on that list was important to me for personal reasons – except one. The last time was really important for Readify. If you look at all the devices I mentioned, all of them are running the new(ish) Windows Mobile 5.0 operating system.
The reason this is important is that it allows us to develop applications that everyone in the company can hook into internal systems like the time keeping system (custom in-house job) and the relationship management system (Microsoft CRM) directly from their mobile device. The new device has also inspired me to get into mobile development again. In fact, tonight I downloaded the Windows Mobile 5.0 SDK and got to work on a pet project.
I’ll post more about my pet project in the future but one of the things that I needed to do was hook into the new State and Notifications Broker API. I was trying to see what kind of information I could get into via this API and rather than manually coding up a whole bunch of routines to get at all the information or worst manually modifying and running the code each time I decided to write a little tool to get at that information. What I came up with was the System State Diagnostics tool.

When I load up the tool it uses reflection to enumerate all the static properties of the SystemState class in the Microsoft.WindowsMobile.Status namespace and place them into a listbox. Then, when I tap on the screen and select a property it goes and fetches the current value of that property.
If you need to do the same sort of thing and would like to use this tool you can download it directly to your device (assuming you have the .NET Compact Framework 2.0 installed already), or you can grab the source.
P.S. I hate the fact that the compact framework doesn’t have a GetNames method on the Enum type.