Hacker News new | ask | show | jobs
by romdev 2342 days ago
Voraciously eliminating unnecessary whitespace, especially vertical whitespace, was a trick I learned early. Most monitors are wide, not tall. When you can see a whole function without scrolling it's much easier to understand. I'll collapse 'if' statements to a single line in most cases to make it readable left-right instead of up-down. 1TB bracketing is my default unless style guidelines prohibit it. End-of-line comments make it easier to associate functionality with comments and keep code tidy.
3 comments

I personally hate one liners. I used to love them and feel good about how neat the code looked like.

After some time I've noticed that I read the code much easier and understand flow when the indentation is similar to python or go.

Also, I keep my editor on a vertical half of the screen.

I would no longer put much in a line, even if it meant using a single use variable.

Monitors may be wide but your eye sight will never change and moving your eye sight left and right, worse, moving your neck left and right is tiring and vertically is easier to follow as the code is the one that moves around instead of you.

Same as sibling comment but I keep my apps' window size at about 70% of the display's width starting near the mid to right end, so I don't have to look way to the left when pretty much everything is leaned on the left side. This brings most of the text, be it code or web page that you read close to mid, which is easier on your neck.

I’d argue you’re better off just getting two vertical monitors. Keeps the code easy to read (can see a lot more of it) without the negatives from one liners.