Posts Tagged ‘method length’

Lines per method

Netbean 7.4 introduced something really weird:

Netbeans 7.4, max lines per method

Apparently this is some sort of simplistic, ill-conceived metric for code quality. I can’t imagine the number of lines in a method matters at all compared to its role in the overall application architecture, its cohesiveness within its containing module, and its dependency on other methods and modules.

On an ArsTechnica article regarding why government IT projects fail so badly, one notable comment stood out to me:

I think that meaningless metrics may be one of the most dangerous things we see in modern society. I’m not saying that the metrics of the past were much better, but now it seems like we have so many more (more data is better right?) and people actually believe they’re somehow objective because they’re “data-driven” and numbers don’t lie. A worthless metric becomes a number that’s indistinguishable from a good one a spread sheet which leads others to see it to simply optimize the one they can most easily optimize. Of course this then leads to the highly tempting situation of designing your metrics to be easily optimizable. Combined with the fact that few people pay close attention to what the metrics actually say, it’s not wonder that most of these “objective” measurements basically say nothing.

I think lines per method clearly falls into the category of meaningless metric, and it’s terrible that code may be evaluated by it and programmers judged by it.