|No such thing as a small change|
Re^3: Cyclomatic Complexity of Perl codeby BrowserUk (Pope)
|on Dec 08, 2004 at 21:14 UTC||Need Help??|
I was commenting directly at the static method the OP asked about, and at static methods in general.
The source code analysis software we were evaluating was for C; around in the early '90s; rejected completely; and probably died a death. The best tool I saw for code complexity analysis was a ICE based tool that operated on the compiled (with probes) executable that instrumented the entire program, not individual source files.
The problem with instrumenting individual files is that it is pretty easy to ensure that each file has a very low complexity value. One easy step is to make sure that each file has almost nothing in it. But that is self-defeating if the number of source files trebles. Even if this simple step is avoided, the other sanctioned ways of reducing complexity result in much higher interface complexities, which is again self defeating.
As a measure, complexity is a very bad indicator of anything useful. Some, (most) systems are complex by their very nature.
A 747 is hugely complex, but would it be "better" if you removed all the dual and triple redundancy systems to reduce complexity?
The most reliable car, is one without an engine. It's less complex, but is it "better".
It's not just the case that it would be difficult to produce a measure of complexity for Perl source code, even by attempting to combine both static and dynamic measurements; you also have to consider what that measure would mean, if it was produced?
Measuring the complexity of the source code, or how hard the runtime code has to branch to do what it does, has much more to do with the complexity of the problem being solved, than of the 'goodness' of the way the solution was written.
Examine what is said, not who speaks."But you should never overestimate the ingenuity of the sceptics to come up with a counter-argument." -Myles Allen
"Think for yourself!" - Abigail "Time is a poor substitute for thought"--theorbtwo "Efficiency is intelligent laziness." -David Dunham
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon