c# - Is Cyclomatic Complexity of '267' better? -


i have developed application in .net using c#.

using 'calculate code metrics' option, got cyclomatic complexity score of '267' 2,348 lines of code , depth of inheritance = 7, class coupling = 150 , maintainability index = 80.

i know lower cyclomatic complexity, better is. though unaware of rest of parameters, wish know if cyclomatic complexity of 267 better or not?

cyclomatic complexity typically refers number of independent paths through code. measured following formula in visual studio:

complexity = edges - nodes + 1 

for given method, 25 considered dangerously high , causes visual studio throw error. ideally, want keep cyclomatic complexity low possible. try aiming 3-4 , maxing out @ around 10.

for entire project, number not meaningful enough compare between separate projects. if refactoring code, can use metric identify whether having impact on reducing overall complexity.

however, careful using these types of metrics sole indicator of project's health. without clear question or goal, can mislead , waste time or worse. may better off focusing on metric code coverage before trying reduce cyclomatic complexity.

you can read more cyclomatic complexity here:
http://msdn.microsoft.com/en-us/library/ms182212.aspx
https://en.wikipedia.org/wiki/cyclomatic_complexity


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -