dwyl / style-guide

:newspaper: dwyl's visual and coding style guide
GNU General Public License v2.0
24 stars 13 forks source link

What's a good number of lines for a file? #7

Closed rjmk closed 7 years ago

rjmk commented 9 years ago

I think that fewer large files are more comprehensible to a beginner (at least if the directory structure is not very well-documented), but very small files more strongly communicate a separation of concerns and are easier when you get your head round them.

What do people think?

nelsonic commented 9 years ago

The perfect number is 17. :wink: It will depend on who is working on the project and who's code-reviewing. Try to keep the number of lines within the viewable range of 13" MacBook (the most common screen size) which, depending on font-size is roughly 35 lines of code. However this is an entirely arbitrary number. The best rule of thumb is to have simple functions (aka testable) that only do one thing (or at the most two). If your function/method starts looking like its doing too much just add a task to simplify it in the next iteration.

rjmk commented 9 years ago

:+1: (Should I close this or should issues be left open until added to the README?)

iteles commented 9 years ago

@rjmk Let's leave it open until in the readme, but worth noting you're satisfied with the answer (as you have :wink:) Up for a pull request?

rjmk commented 9 years ago

Yup!

rjmk commented 7 years ago

This is issue is being automatically closed as it's more than a year old. Please feel free to reopen it if it's still relevant to your project.