Hacker News new | past | comments | ask | show | jobs | submit login

> Restrict the length of function bodies to reduce the probability of poorly structured code. We enforce a hard limit of 70 lines per function.

Reminds me of Carmack on the benefits of long functions: http://number-none.com/blow/john_carmack_on_inlined_code.htm...




"Clever" developer limitation like this almost invariably cause developers to come up with even more convoluted solutions to problems than needed. Don't disagree that long functions can be an indication that someone was copy pasting a bunch of stuff around in the codebase, but not always!


Joran from the TigerBeetle team here.

The limit of 70 lines is actually a slight increase beyond the 60 line limit imposed by NASA's Power of Ten Rules for Safety Critical Software.

In my experience, in every instance where we've refactored an overlong function, the result has almost always been safer.


70 lines is generous compared to Clean Code dogma/opinion.


Obligatory Hank Hill. I'll tell you hwhat. I've seen some poorly structured code with nothing but small functions. Like a state machine implemented via chains of callbacks that could all just live inside one big switch statement.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: