Yesterday evening was the revival of Ninjava, a gathering of programming enthusiasts (not only Java) in the Tokyo area.
Zev Blut presented one of his open source projects : Saikuro.
“Saikuro” is a japanese transliteration of “Cyclo”. This tool analyses a set of ruby code and outputs a report about its “cyclomatic complexity”.
In short, this metric looks at how many branches there are in a piece of code and returns a complexity score.
In this example, the complexity is “3” : the easy way to compute the metric is by counting how many areas are “encircled” by the graph representing the code (plus the area surrounding the graph).
Pointers to articles about that metric are available from Saikuro’s home page.
I ran Saikuro over my OpenWFEru project. Saikuro generated two reports, one about Cyclomatic Complexity and one about the count of tokens per line.
For OpenWFEru the very first written methods (the one dealing with interfacing with the Java engine over REST) were flagged in red. As Zev pointed out, such ‘parsing’ code sports loads of ‘ifs’ and thus yields a high CC score.
To the reports.
At the end of the talk, the discussions centered on the usefulness of the metric for a developer and especially a project manager, and on how to integrate it in a development process. (check in, code review, …)
It’s a simple and effective metric, nice addition to a Ruby toolboox. This utility deserves to be gemified.
It would be nice if the reports actually displayed the methods (at least the ones in the red), maybe with a bit of Erb and a ruby.css…
Emerson Mills will talk about “agile software development process” (“scrum à la Mills” as he said) in the next (April) meeting of Ninjava.
Thanks to the Cerego guys for hosting this meeting !