When Mark Miller introduced his new Maintenance Complexity metric, I wasn’t immediately in awe. I thought I would prefer Cyclomatic Complexity. I was wrong.
I’m looking at a small project with a couple of simple bugs which was thrown at me yesterday. I’m recognizing the “Ultra-complex method. Extremely challenging to maintain. High priority for simplification” interpretation of the 1000+ MC score.
Mark’s original table is pretty good.
MC Score | Interpretation |
---|---|
<= 100 | Simple method. Easy to Maintain. |
101-200 | Medium method. Relatively easy to maintain. |
201-300 | Large method. A little more challenging to maintain. |
301-600 | Complex method. Strong candidate for refactoring. |
601-1000 | Very complex method, challenging to maintain. Should be broken down. |
1001+ | Ultra-complex method. Extremely challenging to maintain. High priority for simplification |
I propose a revision to the table.
MC Score | Interpretation |
---|---|
<= 100 | Simple method. Easy to Maintain. |
101-200 | Medium method. Relatively easy to maintain. |
201-300 | Large method. A little more challenging to maintain. |
301-600 | Complex method. Strong candidate for refactoring. |
601-1000 | Very complex method, challenging to maintain. Should be broken down. |
1001-1499 | You may want to find the person who wrote this and invite them to your local .Net User Group. Buy them Object Oriented Programming for Dummies. Make them read Code Complete. Make them browse, read, and submit patches to known good open-source projects. Try your damnedest to make them understand single responsibility and separation of concerns principles. |
1500-1999 | Suicide might cross your mind. You KNOW that it would be better to scrap this bit of code and rewrite, but then you would have to take responsibility for it and you would be stepping on peoples toes. You want to find the person who wrote this and strangle them and ask them WTF they were thinking. |
2000+ | Go postal. Find the original author and smash their fingers until they look like Sparks’s fingers in Der Dieb. Optionally treat them like Sparks’s until “It hurts really bad where…”. If this is foreign to you, study up on Sealab 2021. |
If anyone could help me with other interpretations of high MC scored methods, I would appreciate it.