Hacker News new | ask | show | jobs
by Nursie 4499 days ago
80 is too few. The old reason for it (what if you get stuck doing an emergency bugfix using vi on an 80 char display?!?) no longer holds.

It's not massively too few, and most lines never get close to the limit anyway, but the odd line of 100-120 thrown in really isn't a problem on a modern display.

3 comments

I thought the historical reason was that punch-cards had 80 characters per line.

...just Googled it: http://programmers.stackexchange.com/questions/148677/why-is...

That's interesting. Even more so in that the 80 characters per line for punch-cards is because that's the size a dollar bill was back then, because punch cards were created for use in the 1890 census. http://www.columbia.edu/cu/computinghistory/census-tabulator...

It's like the railway gauge size being standardized by the ancient romans. The best part of all of this though is the other comments on this page - many of them seem to imply that 80 width was chosen because of how well it fits onto your computer screen and that 100 must be too wide. If the dollar bill in 1890 had been a bit wider, they'd likely be arguing now how 80 is too small!

It proves the point that it's important to actually understand why certain things are chosen and not just assume they're always the best. Going with the standard method is not always the most beneficial path.

That is a straw man. No one actually thinks 80 character displays are the reason to use 80 characters.

I think 80-100 is fine. More than 100 and you probably need to refactor the line some, because you probably have too much logic on a single line (or you need to choose names that aren't hugely long).

>> No one actually thinks 80 character displays are the reason to use 80 characters.

Err, yeah they do, I have been given exactly that reason on a few occasions, generally by older engineers who had experience with old-school machines that had precisely those screen dimensions. I don't disagree with your main point, but it's really not a straw man.

Well, for most people it's a straw man. I've worked with some greybeards, and they are smart enough to know that they can resize the terminal on their modern laptop :)
The beauty of expressive languages like Python is that you can fit a lot of logic into one line with list comprehensions and the likes. When it isn't obvious what it is doing straight away, add a comment.
This is almost always a bad idea. I've extracted many a python line into 2-4 lines to make it a hell of a lot more clear. Packing logic into a line is not a good thing. It may be fun and a challenge, but it makes for fragile code that is easy to get wrong and/or misunderstand.
I often use list comprehensions where I would have previously used a for loop. It means you have less variables and are less likely to have side effects. I wouldn't say it is always a bad idea.
You don't use a split screen in your editor?
'modern display' is mentioned so I'd guess that's 1900 pixels or more. That will likely fit a couple of split screens even at 100 characters?
A 1920pixel-wide monitor is 274 characters wide (if your characters are 7 pixels wide, like mine). That's two files side-by-side with 100 character lines, or three files side-by-side with 80 character lines.
Split how?

I usually work with a file list/project navigator/something to the left and a build window at the bottom of the screen. I usually have two screens so that docs/browsers/whatever can live on the second screen. Seems to work for me.

In my current project I'm using eclipse which has a right-hand panel for build targets. Even with both left and right hand panels there's still enough space in the source window for 130 character lines.

Don't get me wrong, I think most lines should be short and that you should endeavour to keep them a reasonable, readable length. I just disagree with 80 as a hard limit.