[SystemSafety] McCabe’s cyclomatic complexity and accounting fraud

paul_e.bennett at topmail.co.uk paul_e.bennett at topmail.co.uk
Wed Mar 28 15:03:50 CEST 2018


On 28/03/2018 at 1:29 PM, "Derek M Jones" <derek at knosof.co.uk> wrote:
>
>All,
>
>Following on from the discussion a while ago about metrics and
>McCabe's cyclomatic complexity in particular, an example of how
>to 'fake' the McCabe numbers and drawing a parallel with another
>technique for reducing a metric value:
>
>http://shape-of-code.coding-guidelines.com/2018/03/27/mccabes-
>cyclomatic-complexity-and-accounting-fraud/

The article makes an interesting read, but McCabe can still be a useful
measure with upper bounds imposed.

There is the reported McCabe Complexity value for each function in a
system. Yes, you can do things to reduce individual function complexity,
and probably should. However, you then need to take the measure a step
further. For every function that calls other functions, you have to sum the
complexity for each included function and divide that sum by the number
of functions in scope. That gives you an average complexity value which may
be higher than the calling function. You can still report the average complexity
for the entire system on this basis. It becomes clear when you have too many
functions with high complexity factors as it pushed up the average complexity
value disproportionately. It still should not be the only measure though.


Regards

Paul E. Bennett IEng MIET
Systems Engineer
Lunar Mission One Ambassador
-- 
********************************************************************
Paul E. Bennett IEng MIET.....
Forth based HIDECS Consultancy.............
Mob: +44 (0)7811-639972
Tel: +44 (0)1392-426688
Going Forth Safely ..... EBA. www.electric-boat-association.org.uk..
********************************************************************



More information about the systemsafety mailing list