Maintenance Complexity leads to more methods?

Mark Miller talks about a new metric he is calling Maintenance Complexity.  The system assigns operators and constructs a point score representing their contributing complexity.  A method is then analyzed and all the points add up to yield the Maintenance Complexity score.  I like the concept but tackling a report of complex methods would probably just result in breaking them apart into more methods.  Many might argue that this is a Good Thing although it really depends on how the methods are split.

This would seem to be completely against Kent Beck's Rule 4 for achieving the SimplestCode - "Minimizes number of classes and methods".

It also seems that determining the complexity of a method should also take into account the parameters to the method especially if any of the parameters are out since that could indicate greater coupling and more possible side effects of the code in general.

Automated tools and reports provide a great way to home in on problems area in code (Just look at the marvels a coverage report can do for statement coverage!) - but once you find the problem areas ... how do you fix them?  How does the tool/metric naturally select for simpler logic and less complexity?

Mark - Thanks for your thoughts and ideas!

No Comments