| ▲ | stouset 3 hours ago | ||||||||||||||||||||||
“Ideally under 70 lines” is not “always under 70 lines under pain of death”. It’s a guideline. There are exceptions. Most randomly-selected 100-line functions in the wild would probably benefit from being four 25-line functions. But many wouldn’t. Maturity is knowing when the guideline doesn’t apply. But if you find yourself constantly writing a lot of long functions, it’s a good signal something is off. Sure, language matters. Domain matters too. Pick a number other than 70 if you’re using a verbose language like golang. Pick a number less if you’re using something more concise. People need to stop freaking out over reasonable, well-intentioned guidelines as if they’re inviolable rules. 150 is way too many for almost all functions in mainstream languages. 20 would need to be violated way too often to be a useful rule of thumb. | |||||||||||||||||||||||
| ▲ | Kwpolska 2 hours ago | parent | next [-] | ||||||||||||||||||||||
As with all guidelines, some people will turn it into a hard rule, and build a linter to enforce it. Then they will split long functions into shorter ones, but with a lot of arguments. And then their other linter that limits argument count will kick in. | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | eviks 32 minutes ago | parent | prev [-] | ||||||||||||||||||||||
> It’s a guideline ... Pick a number It's using a parameter of secondary importance as a primary, so it's wrong with any number. The comment even has a helpful analogy to LOCs. People need to stop freaking out over reasonable, well-intentioned criticism of guidelines as if they were arguing something else like misundertstanding of that strictness of rules. | |||||||||||||||||||||||