Determining C Complexity

Walter Bright bright at Data-IO.COM
Thu Jul 26 04:31:08 AEST 1990


In article <142 at srchtec.UUCP> johnb at srchtec.UUCP (John Baldwin) writes:
<In article <1050 at ashton.UUCP> tomr at ashton.UUCP (Tom Rombouts) writes:
<<.......................... there is no real way to measure such things
<<as intelligence of the overall design and architecture, elegance of
<<algorithms, or quality of comments and documentation.  
<True.  But you CAN quantify (statistically, not deterministically) such
<things as "did the programmer, in general, decompose the design into
<subroutines (functions, procedures, ad infinitum) of manageable size?"
<A good policy (by my experience) is to take complexity metrics (and the like)
<with a grain of salt:  your metric rates some piece of code with a
<McCabe complexity of 22, and the average is 8.2.  So you check the code;
<there's no immediate reason for the excess complexity (based on your perusal).

In my experience, metrics are completely useless. There is no substitute for
an organized code review. This is where a listing is run of the entire
project code, and is passed around the other programmers who review it and
mark it up for style, clarity, obvious bugs, aesthetics, whatever.
Then you have a meeting where you go through all the markups.
You'd be amazed at the quality improvements that result. Another major
advantage of this is that the junior members of the team learn a lot from
the senior members, and the senior members learn new techniques from the
juniors. It's time well spent.



More information about the Comp.lang.c mailing list