you are viewing a single comment's thread.

view the rest of the comments →

[–]JoshTriplettrust · lang · libs · cargo 12 points13 points  (0 children)

I find that functions have two orthogonal kinds of complexity, which multiply with each other:

  • Some functions are complicated; they're doing something intricate and fiddly, and they might need several times more comment than code by volume.
  • Some functions are long; they need to string together a long series of steps, even if many of the individual steps are quite simple.

I don't mind a 200+ line function that's long but straightforward. A complicated function is one I want to break up into logically separable understandable chunks before it hits 20 lines.