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
-
Lensflare17462110dMy linter is configured to raise a finger at 60 lines and to pull out a shotgun at 200 lines.
-
typosaurus12155110d@Lensflare utils are normally small things like ms_to_human_time that does only one thing. Smth with many lines does more than one thing. Should be splitted in several functions what should be isolated by its own file since they're only getting used there. Maybe some of those functions could migrate to utils
-
typosaurus12155110dI have a library that I include for all projects. It is multiple files. I have made an application to merge it all to one (only self written source, no system libs) and that file is copied to /usr/include and to use my lib with many features I only have to:
include <rlib.h>.
The merging is important because everything is related to eachother. I have every related file specified in right order declared in _rlib.h that compiles to rlib.h. Double includes get deleted.
Consider to do the same -
MammaNeedHummus4416110dIf 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 -
Lensflare17462109d@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