# Tagged Questions

The tag has no usage guidance.

206 views

### Can we have a negative cyclomatic complexity?

I am having a hard time to understand cyclomatic complexity. I went through some videos in youtube for this. I got negative value for cyclomatic complexity when I use this formula M = E - N + P. I ...
15 views

### Code Benchmark Reference Data for Smaller Programs (SLOC < 10 000) [closed]

I found this link, which describes data for some known large applications: http://www.informationisbeautiful.net/visualizations/million-lines-of-code/ However, the data is limited to source lines of ...
91 views

### How to calculate Cyclomatic Complexity exactly?

My question is more about the transformation from programming code to control flow graph. Say, I have a piece of code: public class Contractor { // other member fields... private bool ...
498 views

### Is cyclomatic complexity density a good software quality metric? [duplicate]

Where I define Cyclomatic complexity density as: Cyclomatic complexity density = Cyclomatic complexity / Lines of code I was reading previous discussions about cyclomatic complexity and there seems ...
88 views

### Cyclomatic complexity for 2 IFs - why not just FF or TT?

I know that cyclomatic complexity defines the number of independent paths in the code. Using the simple way, it can be calculated as number of IF +1. In that case, for a simple code with two IFs, CC ...
45 views

### When calculating cyclomatic complexity, should Exception Handling considered? [duplicate]

When calculating the cyclomatic complexity of a piece of code (/method/program), should any Exception Handling be taken into account? For example, if you include a try-catch block in your ...
2k views

### equals and hashcode methods autogenerated, is it always a good practice?

Preamble: Let's say I aim to cover all my classes with test coverage. Despite the common opinion (expecially in Java community) to "not pay too much attention to Cyclomatic Complexity (CC) and code ...
581 views

### Keep indentation level low [duplicate]

I hear a lot that you should not write functions larger than one screen size, that you should extract things into functions if you call things very often and all these coding guidelines. One of them ...
1k views

### Cyclomatic complexity when calling same method multiple times

Thanks to a question over at Code Review I got into a little disagreement (which essentially is an opportunity to learn something) about what exactly the Cyclomatic Complexity is for the below code. ...
23k views

### Avoid too complex method - Cyclomatic Complexity

Not sure how to go about this method to reduce Cyclomatic Complexity. Sonar reports 13 whereas 10 is expected. I am sure nothing harm in leaving this method as it is, however, just challenging me how ...
2k views

### Approaches to reduce cyclomatic complexity

I was running our code through JSHint, and decided to switch checks against cyclomatic complexity, and then went on long refactoring sprint. One place though baffled me, here is a code snippet: var ...
2k views

### Do iterative methods reduce cyclomatic complexity and improve supportability?

Do iterative methods such as are commonly found in modern languages such as C#, JavaScript, and (hopefully) in Java 8 reduce cyclomatic complexity's impact on understandability and supportability of ...
2k views

### Cyclomatic complexity with two IFs - why it is 3?

I have read an article with following example: void func() { if (condition1) a = a + 1; if (condition2) a = a - 1; } It says the CC is 3 as there are three possible paths. How come? Why not 4? I ...
3k views

### How is technical debt best measured? What metric(s) are most useful? [duplicate]

Possible Duplicate: How can I quantify the amount of technical debt that exists in a project? If I wanted to help a customer understand the degree of technical debt in his application, what ...
700 views

### Complexity of a web application

I am currently writing my Master's Thesis on maintainability of a web application. I found some methods like the "Maintainability Index" by Coleman et.al. or the "Software Maintainability Index" by ...
3k views

### Understanding Cyclomatic Complexity

I've recently come across Cyclomatic Complexity and I'd like to try to understand it better. What are some practical coding examples of the different factors that go into calculating the complexity? ...