3 ms·
Having shorter line lengths makes it easier to review diffs side by side (especially 3 way diffs). The other thing that people do with long lines is that they
by u801e 8y ago
Having shorter line lengths makes it easier to review diffs side by side (especially 3 way diffs).
The other thing that people do with long lines is that they try to combine a lot of statements per line. Then when that line has to be changed, it's harder to review in a diff (compared to the diff that affects a line containing a single statement).
- Waterluvian 8y agoIn practice I just see it screwing up perfectly good lines way more often than long lines causing trouble. This is one of those matter of opinion things. But it's so wildly one sided from my experience that I struggle to see the other side.
- u801e 8y agoPerhaps one way to look at it is to compare long lines in code with long paragraphs in prose. I'm sure you've seen examples of posts on forums where someone writes a long post, but doesn't subdivide it into paragraphs. While it's possible to read and understand the message it's trying to convey, it's more difficult to do compared to a version that's divided into paragraphs. Similarly, one can combine several statements in code on a single line, but that, in my opinion, is harder to read compared to having a single statement per line and harder to read the resulting diff when changing something in the line. This is one example I copied from bashoneliners.com: man -k . | awk '{ print $1 " " $2 }' | dmenu -i -p man | awk '{ print $2 " " $1 }' | tr -d '()' | xargs man -t | ps2pdf - - | zathura - Personally, I would find it easier to read and understand it if it was written as follows: man -k . \ awk '{ print $1 " " $2 }' \ dmenu -i -p man \ awk '{ print $2 " " $1 }' \ tr -d '()' \ xargs man -t \ ps2pdf - - \ zathura - If I had this in source control and decided to add, remove, or change one of the commands for this oneliner, then it would be far easier to read the diff if it was in the multi-line form compared to the single line form.