Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
My linter is configured to raise a finger at 60 lines and to pull out a shotgun at 200 lines.
-
If one of my functions is over 10 lines I get really antsy.
Sometimes it can't be helped without massively overcomplicating it, but its very very rare that a function of mine is over 10. They're usually around 5.
If any bigger than 10, it usually indicates that the function is responsible for too much and therefore you can't skim it -> its easier to fuck it up.
Essentially long functions break KISS, IMO -
@MammaNeedHummus mostly true but there are a few exceptions:
* Mapping functions which map/transform some data or states.
* functions which build up ui structure. You can extract most stuff into smaller functions but it often makes readability worse because you need to jump to different places to understand a single piece.

An utility function longer than 100 lines shouldn't even be a single function. Shit, it shouldn't even BE inside the "utils" file
rant