3 ms·
My general rule of thumb is that a function should be small enough to be entirely visible on screen without having to scroll. It's dependent on screen resolutio
by SuddsMcDuff 11y ago
My general rule of thumb is that a function should be small enough to be entirely visible on screen without having to scroll. It's dependent on screen resolution & font size of course, but I find that having to scroll down adds some cognitive overhead to understanding the whole of a function.
Following this line of thought I've become a lot more precious about vertical whitespace & I've adopted BSD style curly braces.
- moonshinefe 11y agoFair enough. I always found horizontal scrolling more difficult than vertical though. But, for instance, the Python PEP8 spec saying 80 characters max, I think is kind of ridiculous these days. Who is programming on their phone, tablet, or 90s computer that can't handle 120 characters these days? Edit: I just mention 120 as PyCharm's PEP8 linter 'erroneously' checks that max rather than 80
- SuddsMcDuff 11y agoAgreed horizontal scrolling is equally disturbing. We do live in an age of wide-screen monitors though so I find vertical whitespace more precious. I would go as far as saying that 160 horizontal chars is a more sensible guide these days.