Path: utzoo!attcan!uunet!gistdev!flint From: flint@gistdev.gist.com (Flint Pellett) Newsgroups: comp.software-eng Subject: Re: How do you measure code quality? Message-ID: <926@gistdev.gist.com> Date: 28 Jun 90 15:32:48 GMT References: <10865@netcom.UUCP> <11113@netcom.UUCP> Distribution: comp Organization: Global Information Systems Technology Inc., Savoy, IL Lines: 39 To answer your question on the McCabe complexity, since I've gotten several pieces of e-mail on it as well. What it measures is the complexity of each "routine", not each "file". I have some "quality" code (IMHO) that performs some conceptually very complex tasks which is well organized into a collection of small routines no one of which is especially complex. I also know of some examples of code where the job that is being done is relatively simple and straightforward, (albeit with a lot of special cases) but it was written as one huge routine about 3000 lines long. That routine earned an incredibly high complexity rating. The interesting thing about it is that the very complex routine has required fixing again and again and again, but the uncomplicated routines that perform the more complicated job have not. "Needing fixing" is not just a maintainer's view either: if some user hadn't had a problem with it, the maintainer wouldn't have dared to touch the thing. With some problems, you just aren't able to break the problem apart enough of course, and you will have complexity. If you use the complexity measure to conclude "this is bad code" then you've misused the measure. (There may be a high correlation between complex code and poor code, but one does not perfectly imply the other.) On the issue of "quality is in the eye of the user" only: the problem with that as the sole measure of quality is that it is not a stable "measure", it's like a rubber yardstick. For example, say that I buy a new car, and I and several million other owners are completely happy with it for two years. Then we find out on the news that our cars are unsafe if we ever need to perform a quick turn to the left, and will always roll over. Overnight the user satisfaction with the product drops to half what it was: can you claim that the quality of the product changed? I contend that the quality was constant (and not very good) but by measuring only how the users felt about it I misled myself. To really know what the quality of the product is (regardless of what hat I'm wearing) I need to examine several things, not just one. -- Flint Pellett, Global Information Systems Technology, Inc. 1800 Woodfield Drive, Savoy, IL 61874 (217) 352-1165 uunet!gistdev!flint or flint@gistdev.gist.com