4 ms·
A 1000+ line function should be a syntax error. Heck. I start to itch breaking Python modules when they cross the 1000 line barrier.
by rbanffy 6y ago
A 1000+ line function should be a syntax error.
Heck. I start to itch breaking Python modules when they cross the 1000 line barrier.
- syshum 6y agoYou have heard of Single Page Applications, well now we need Single Function Applications ;)
- Ancapistani 6y agoThat would be anything ever written in a Lisp, if I’m not mistaken :)
- williamdclt 6y agoSome linters (eg ESLint) have rules you can enforce for cyclomatic complexity (which is often the problem with long functions, rather than the length itself). In the service I maintain, we enforce a cyclomatic complexity of 5, which is pretty low but it yielded good results
- Thiez 6y agoDoesn't a cyclomatic complexity limit of 5 basically rule out the switch statement?
- williamdclt 6y agoGood question, I suppose it would? On the other hand we do have chunky switch statements (as it allows exhaustive type checking in Typescript), so not so sure now that I think about it, I'd have to check