次の方法で共有


What to make of Cyclomatic Complexity

Often times when Development Team are looking to do Code Review, reading the numbers out of Cyclomatic Complexity is one of the Top Priorities.

Cyclomatic Complexity is a formula for determining the varying logical paths that can be taken though a piece of code, thus determining a quantitative value for the code’s complexity. A higher Cyclomatic Complexity score means that there are a lot of code paths and/or factors that affect the logic with the code. One way to think about it is this: to fully unit test a method, you should have one unit test for each logic path – thus a score of 10 would result in as many unit tests. Wikipedia entry: https://en.wikipedia.org/wiki/Cyclomatic_complexity

Martin Fowler in his BLOG mentions how to approach reading the metrics and act most effectively - https://martinfowler.com/articles/useOfMetrics.html

Also, I find this as a great read too - https://www.wrightfully.com/thoughts-on-cyclomatic-complexity/

There are also some great publications on MSDN - https://msdn.microsoft.com/en-us/library/bb385914.aspx

A few MSDN BLOGS worth reading  -

  1. https://blogs.msdn.com/b/codeanalysis/archive/2007/11/28/positioning-code-metrics-to-management.aspx
  2. https://blogs.msdn.com/b/zainnab/archive/2011/05/17/code-metrics-cyclomatic-complexity.aspx
  3. https://blogs.msdn.com/b/codeanalysis/archive/2007/10/03/new-for-visual-studio-2008-code-metrics.aspx