Netbeans 7.4 introduces "10 lines max" per method rule. Where does this rule come from?

Sliq picture Sliq · Aug 9, 2013 · Viewed 26.8k times · Source

NetBeans 7.4 beta is currently available for public download, and it introduces a weird warning rule by default:

Method length is 16 lines (10 allowed)

My question is: Is this an accepted code convention rule, that can be proven somehow, somewhere ? NetBeans support/devs say it's not a bug, but don't give a statement why they only allow 10 lines, and where exactly this rule has its origin.

Answer

Milen picture Milen · Oct 1, 2013

You can change the maximum method/function length warning behavior in NetBeans options (it's under Tools->Options->Editor, in the Hints tab, under "Too Many Lines" section in the checkboxes list).

There you can set the maximum number of lines, how you would like to be warned, etc.

I believe that the rule was introduced by NetBeans developers because when working in teams, the automated tools that QAs use to "inspect" code flag long method declarations/functions bodies. Unfortunately, the use of automated tools by "code analysts" is on the rise, whilst their understanding of the reasons behind that are still limited. I do not say that your functions should be hundreds of lines long - that's just plain wrong, but a hard-coded number as a coding law - come on!