0

I have a situation which demands the following code metrics.

Maintainability index > 80 & Cyclomatic complexity < 20

But as per MSDN (http://msdn.microsoft.com/en-us/library/cc667398(v=VS.90).aspx).

  • Maintainability index > 20 is green
  • Cyclomatic complexity < 25 is good.

I need to understand the following:

  1. Is it worth investing time to improve maintainability Index from 20 to 80?
  2. If we don't achieve a maintainability index > 80, will there be an increase in maintenance cost?
  3. What is the impact of keeping Cyclomatic complexity < 25?

Thanks in advance.

kc2001
  • 5,008
  • 4
  • 51
  • 92
Beryl Wilson
  • 125
  • 8
  • No way to tell without knowing how much maintaining you are going to do. It depends on how many more times you have to go in and comprehend the implementation. – Tony Hopkinson Jun 06 '13 at 10:42

2 Answers2

0

Requirements may vary depending of the application role. MSDN gives you a general rule of thumb, for buisness or mission critical applications requirements can be higher.

In general, client, the one who pays for development, knows best about the application role, so it is up to her to decide, whether it worth investing in mantainability or not. There is no certain answer, each case should be evaluated separately.

akalenuk
  • 3,815
  • 4
  • 34
  • 56
0

The answer to (1) is "yes", if the situation "demands" it.

The answer to (2) varies. A higher maintainability index generally corresponds to lower maintenance costs, however, the code that is predicted to be difficult to maintain may work perfectly and may never require maintenance. And even if maintenance is suggested, it is up to the maintainers to decide how much they are willing to spend to maintain it.

As for (3), there is not much difference between cyclomatic complexities of 20 and 25. Both are higher than the recommended numbers I typically have seen. The higher numbers indicate more conditionals, and the more conditions there are, the harder it is to figure out what the code is doing and what needs to change.

kc2001
  • 5,008
  • 4
  • 51
  • 92