Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!hpda!hpcupt1!jamiller From: jamiller@hpcupt1.HP.COM (Jim Miller) Newsgroups: comp.lang.c Subject: Re: Re: Determining C Complexity Message-ID: <5940037@hpcupt1.HP.COM> Date: 24 Jul 90 16:51:36 GMT References: <1050@ashton.UUCP> Organization: Hewlett Packard, Cupertino Lines: 25 >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; > >-- >John T. Baldwin | Disclaimer: >search technology, inc. | Some people claim I never existed. >Norcross, Georgia | (real .sig under construction >johnb@srchtec.uucp | at Starfleet Orbital Navy Yards ;-) >---------- For example, I understand that a huge case statement, where each case of 100's may only be 2-6 lines long (can you say "apply production" :-), will give an enormous McCabe complexity. It is obviously better coding style for the apply production routine to break the range up into subranges, and call routines like apply1to20(), apply21to40(), ..., apply201to220, ... Much easier to maintain and read :-) Obviously. jim miller Standard disclaimer