Common causes of Cyclomatic Complexity and their solutions -


At work we are looking at common problems that lead to high cyclamatic complexity, for example, if large Having a statement can have high cyclamatic complexity, but can be solved by changing the conditions with polymorphism. What other examples did you find?

See NDepend

There is also a great code metric.

Cyclamatic complexity can be taken in a process that is a popular procedural software metric equivalent to the number of decisions. In Concrete, the CC1 + {{Method of the following expression found in the body of the law}: A method in C #:

if. While For Forex Currency | Case Default | Continue | Goto | & Amp; & Amp; | || | Catch | Ternary operator ?: |

The following expressions have not been calculated for CC calculation:

and | Do it Switch | Try Use | Throw | | Finally Return | Commodity creation | Call method Area Access

Optimized for the OO world, this metric is defined on both methods and classrooms / structures (the amount of your methods in the form of CC). Notice that the CC of an unknown method is not counted when calculating the CC of its external method.

Recommendations: More than 15 cc, where it is difficult to understand and maintain, in which the cc is more than 30, they are extremely complex and should be divided into smaller methods (except if they are automatically Are generated by a device).


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -