From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089ad,a1b5e9e496bc760b X-Google-Attributes: gid1089ad,public X-Google-Thread: 103376,a1b5e9e496bc760b X-Google-Attributes: gid103376,public X-Google-Thread: f43e6,a1b5e9e496bc760b X-Google-Attributes: gidf43e6,public From: mfb@mbunix.mitre.org (Michael F Brenner) Subject: Re: Cyclomatic complexity Date: 1997/11/03 Message-ID: <63kr9u$l31@top.mitre.org>#1/1 X-Deja-AN: 286776911 References: <345D98D0.31AE@sh.bel.alcatel.be> Organization: The MITRE Corporation Newsgroups: comp.lang.ada,comp.lang.vhdl,comp.software-eng Date: 1997-11-03T00:00:00+00:00 List-Id: Cyclomatic complexity has more to do with the program flow graph than subroutine calling. Cyclomatic complexity has nothing to do with which parts of a system have been verified. Strengths of cyclomatic complexity are: (a) it is accepted by the government, (b) it is easy to measure, and (c) it gives the illusion that you are predicting maintenance cost which is perceived to be related to cyclomatic complexity. Weaknesses of cyclomatic complexity are: (a) it becomes less and less corellated to maintenance cost as the program improves in quality by converting to static CASE statements or GOTO-less programing, (b) as soon as you admit that this is your measure the programmers will make trivial modifications to the code which increase maintenance cost but reduce the cyclomatic complexity, and (c) it encourages a mind-set that thinks of complexity primarilly as the difficulty of understanding small pieces of code rather than things that are actually related to maintenance cost like (i) prior maintenance billing, (ii) number of references to global variables, (iii) number of states (or statelessness), (iv) complexity of the data flow graph (rather than the program flow graph), (v) use of nonstandard file formats or message formats, (vi) use of APIs when a standard file format would couple systems more loosely, (vii) number of service requests closed before completion, (viii) automation of the configuration management and testing processes, (ix) ability of the analysis tools to instantly display the data flow diagram and the program flow diagram for any portion of the system, and (x) existence of an on-line method of tracking the correlation of all metics used to actual costs incurred. Measuring what is easy to measure (like lines of code and cyclomatic complexity) does not necessarily lead to lower life-cycle costs. Measuring what is actually corelated to thoses costs and acting on those measurements will lead to lower life-cycle costs. In most organization reducing the number of levels of managers and the number of references to global variables, while increasing the speed of the computers used for debugging and testing will reduce software maintenance costs faster than reducing the cyclomatic complexity of the code.