Why is 80 characters the 'standard' limit for code width?(programmers.stackexchange.com) |
Why is 80 characters the 'standard' limit for code width?(programmers.stackexchange.com) |
Actually, not it's not, little punks making me feel old, get off my lawn.
The train of reasoning here reminds me of another story (which I think has been on HN before): Why is a space shuttle engine 4' 8.5" wide?
I don't know why they stuck with it!
C64s and amigas.. when computers were cool before microsoft ruined it! Now we've been saved by apple, hurah
no
Of course, code isn't prose, but I'm still a fanatic about the 80-character limit. To assist with keeping lines of code short and sweet, I will often introduce aptly-named temporary variables and let the compiler sort out what's actually to happen.
I can easily fit four 80x84 windows on my external monitor (DejaVuSansMono 13 pt).
†http://graphicdesign.stackexchange.com/questions/3553/why-do...
It just like reading a text online. Most people would prefer shorter lines, compared to one extremely long one. It's simply easier to keep track of where you are.
I am also of the opinion that like names, when the line gets too long the readability goes out the door
Most of their lines are incredibly compact. In fact, a lot of people who first read the code suffer a bit of a culture shock. It's just too... simple, and readable. Especially for C. This causes some to knock their own particular style of ANSI C as inadequate.
I think it's a testament to their genius. You'll probably never find a codebase as massive yet as readable and grokkable as theirs. If you're used to modern Linux code that copiously uses glib, D-Bus and a whole bunch of other libraries, you'll either find it a huge breath of fresh air, or completely blasphemous.
--Objective-C Dev who sorely wants namespacesEven if I have the screen real estate, I don't think I'd want to intentionally write wide code, and I like self-explanatory names. On a 4k screen I might like Eclipse layouts that put the logging next to the code, rather than have very wide code.
Has anyone created examples of code that gains readability from being wider?
package Foo {
class Bar {
void baz() {
// Most code is nested *at least* this deep.
}
}
}Col. 1 : Blank, or a "C" or "*" for comments Col. 1-5 : Statement label (optional) Col. 6 : Continuation of previous line (optional) Col. 7-72 : Statements Col. 73-80: Sequence number (optional, rarely used today)
With the sequence numbers if you dropped the deck and scrambled the cards, feed the pile through a card sorter machine to put them back in order. If you didn't bother with sequence numbers, another technique was to use a magic marker to draw patterns on the side of the deck to help with resorting it if you dropped it.
"Oh but it fits my screen, fits two-by-two on my screen" change font size, unless you're using the native 80x25 PC display (some kernel developers use that)
I can't imagine a worse use of developer time than making everything fit exactly inside 80 columns
Of course, not having a limit is bad as well, but the main issue is having a hard limit
It's propagated because it's a standard, and it seems many people ARE comfortable with it. It also seems that I enjoy my font-size just the way it is.
I've just written my first reusable, outlive-my-employment level of code, and keeping my code under 80 lines was trivially easy. The only thing that was the slightest level of nuisance was that the function parser in notepad++ couldn't cope with a multi-line string definition inside a function.
The bulk of my time was writing clear, understandable and educational documentation for the library.
Why are you so hostile?
From there, they upgraded to 80x25 (doubling the resolution!). Two things happened to make it possible: 1) memory got a bit bigger 2) computers started shipping with dedicated higher-quality monitors (e.g. MSX-2) instead of being hooked up to TVs, so it was actually possible to read 80 characters on a line, even though you had to squint a little.
Eighty characters is the "standard" limit for code width because eighty characters is the "standard" limit for code width.
More isn't better in this case. When text gets too wide, it becomes harder to move your gaze from end of one line to beginning of another.
Also, the best number is probably not a hard limit, but a guideline/average to aim for.
I use 120, plenty of space to fit two code windows side by side and one file browser.
With HD screens and the verbose languages we use these days (and verbosity is not always bad), it's a bit silly to try to stick to 80 char cols.
Feel free to add any other details, like the kind of programming you do, what language, etc.
leftWall.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:CGSizeMake(100, wallHeight)];
close to 100 characters.0 - https://developer.apple.com/library/ios/documentation/AVFoun...