I have recently been converted, at least on the principal that I can read and edit my code as I left it from any terminal in the world. But I still ask myself, when will I ever need to do that? I am finding in c++, especially modern c++, my lines are longer, with more namespace qualified references, etc.
So what do people think, 80 columns or is that standard long dead?
This question keeps coming up:
-
I've personally switched to a 120-column "rule" - for no reason other than the fact that all the monitors I find myself sitting in front of can support that many (if not more) characters. Everyone's widescreen these days, right? ;)
Robert Gould : +1 I also upgraded to the 120 rule. Besides it generally makes code easier to read -
I personally think it is dead. 80 columns doesn't make sense in the world of high resolution monitors. Just think of how many developers have dual (or more) monitor setups at their desks.
This is not to say that there is no limit to column length. I just think the column length limit has become more subject to the particular scenario, allowing each developer to decide what "logically" should go on a line.
-
Depends on the language.
For example, in something like Python, where lines tend to be shorter anyway, the convention is 80 cols.
On the other hand, for Java or C#, 120 is more common, simply because the 80 character limit becomes a stumbling block more often.
In my opinion, wider monitors do not make it "okay" to have very long lines. It's kind've wasting the screen real estate to have a really wide window is mostly white space on the righthand side, just to allow for the occasional long line. I prefer to be able to have more than one thing side by side.
-
I still need 80 columns. In fact, I cut off text in my .vimrc at 70; I set that years ago due to requirements in a newsgroup I posted in. Sorry to the rest of the world for not changing, but I still want a bunch of 80 column xterms on my screen!
Even though a lot of the coding I do today is in Eclipse, it still looks awful if you don't wrap it somewhere around 80 columns. I suppose I might be able to tolerate a 120-column rule as some people have said, but there are still some situations for which vim is still the right tool, and I don't want to have to blow my xterms up all the time to accommodate the code I wrote in another tool.
Draemon : Java looks awful if you restrict it to 80 columns. It's subjective I guess.skiphoppy : @Draemon: That's true. It doesn't help that people like to use 25-char+ identifiers.skiphoppy : I guess Java looks awful no matter where I set the break... -
Nearly every organization I have worked for has stuck to the "80 column rule" in their coding standards. The reason given is usually for printing standards, code is usually printed out for code reviews and wraps on paper are terrible.
So I'd say it is definitely not dead in the working world, where code reviews are king.
Robert Gould : interesting insight. At my work we print in landscape actuallySoapBox : I did work at one place where they printed in 2 column landscape, which is large than 80. I dont particularly like 80, but when its forced on you you get used to it :-)SoapBox : Funny, though, it was wider than 80 but they still had 80 in their coding standard "for printing". Figure that one out :-)Vadim Ferderer : Code printing is actually a bad habit. -
I zealously wrap my code at 80 columns, and encourage my colleagues to do the same.
- When I need to refactor/decipher messy or complicated code, I sometimes prefer to sit on a couch with a hardcopy and a pen in my hand. Code wrapped at 80 columns perfectly fits a standard (raw text) printout you can get out of any printer.
- Having a lot of characters on a single line isn't necessarily a good thing. Newspapers and magazines use narrow columns of text in their layouts for a reason. The human eye/brain is the most comfortable when reading lines of text that are of moderate length. 80 characters is close to that moderate number.
- If you have a gigantic monitor with 2000 pixels across, why waste all that space with horizontally expanding code while you could display multiple windows that are horizontally tiled? Multitasking trumps a panoramic view of my code, however beautifully crafted it may be ;)
- I sometimes copy/paste existing code to my blog (or stackoverflow.com). Websites typically don't accommodate long lines of code well.
- Code written with Spartan principles (that I live by) won't typically have a lot of lines that are longer than 80 characters since there will be good modularization, minimal nesting (that leads to a lot of indentation) etc.
0 comments:
Post a Comment