2 ms·
what about having a limit for the number of lines, 200 lines?
by jlebrech 14y ago
what about having a limit for the number of lines, 200 lines?
- jotux 14y agoIn mission-critical systems line limits are common. The first public example that comes to mind is the NASA JPL C Coding Standard(http://lars-lab.jpl.nasa.gov/JPL_Coding_Standard_C.pdf http://lars-lab.jpl.nasa.gov/JPL_Coding_Standard_C.pdf). Check out Rule #25: >Functions should be no longer than 60 lines of text and define no more than 6 parameters. [Power of Ten Rule 4] >A function should not be longer than what can be printed on a single sheet of paper in a standard reference format with one line per statement and one line per declaration. Typically, this means no more than about 60 lines of code per function. Long lists of function parameters similarly compromise code clarity and should be avoided. >Each function should be a logical unit in the code that is understandable and verifiable as a unit. It is much harder to understand a logical unit that spans multiple screens on a computer display or multiple pages when printed. Excessively long functions are often a sign of poorly structured code.