Cyclomatic complexity: Difference between revisions

Content deleted Content added
Wdosanjos (talk | contribs)
m removed incorrect link
Thashley (talk | contribs)
m Streamline text and correct minor typos.
Line 151:
year=1999|volume=25|issue=3|pages=675–689|doi=10.1109/32.815326|citeseerx=10.1.1.548.2998 }}</ref> Some studies<ref name="schroeder99">{{cite journal| title=A Practical guide to object-oriented metrics|author=Schroeder, Mark|s2cid=14945518|year=1999|volume=1|issue=6|pages=30–36|journal=IT Professional |doi=10.1109/6294.806902}}</ref> find a positive correlation between cyclomatic complexity and defects: functions and methods that have the highest complexity tend to also contain the most defects. However, the correlation between cyclomatic complexity and program size (typically measured in [[lines of code]]) has been demonstrated many times. [[Les Hatton]] has claimed<ref name="taic">
{{cite web |url=http://www.leshatton.org/TAIC2008-29-08-2008.html |title=The role of empiricism in improving the reliability of future software |author=Les Hatton |year=2008 |at=version 1.1}}</ref> that complexity has the same predictive ability as lines of code.
Studies that controlled for program size (i.e., comparing modules that have different complexities but similar size) are generally less conclusive, with many finding no significant correlation, while others do find correlation. Some researchers who have studied the area question the validity of the methods used by the studies finding no correlation.<ref name="kan">
{{cite book |title=Metrics and Models in Software Quality Engineering |author=Kan |pages=316–317 |publisher=Addison-Wesley |year=2003 |isbn=978-0-201-72915-3}}</ref> Although this relation islikely probably trueexists, it isn'tis not easily utilizableused in practice.<ref name=cherf>{{cite journal|
journal=Journal of Software Quality|
author=G.S. Cherf|
Line 158:
year=1992|volume=1|issue=3|pages=147–158|
issn=1573-1367|doi=10.1007/bf01720922|
s2cid=37274091}}</ref> Since program size is not a controllable feature of commercial software, the usefulness of McCabesMcCabe's number has been called to questionquestioned.<ref name="fenton" /> The essence of this observation is that larger programs tend to be more complex and to have more defects. Reducing the cyclomatic complexity of code is [[correlation does not imply causation|not proven]] to reduce the number of errors or bugs in that code. International safety standards like [[ISO 26262]], however, mandate coding guidelines that enforce low code complexity.<ref name="ISO26262Part3">{{cite book | title =ISO 26262-3:2011(en) Road vehicles — Functional safety — Part 3: Concept phase| publisher =International Standardization Organization | url =https://www.iso.org/obp/ui/#iso:std:iso:26262:-3:ed-1:v1:en}}</ref>
 
==Artificial intelligence==