Writing Code for the Next Person
Column Width
One of the things I felt that our industry had outgrown long ago was the 80-character column width. As I am sure everyone reading this knows, computer screens were introduced with 80 columns due to the fact that punched cards used 80 columns. Programmers just got used to 80 columns as the default width.
Microsoft is one of the few who (reportedly) moved away from the 80-column standard to 120 columns as a line width. In my opinion, that made sense. After all, virtually everyone today either writes code via a GUI code editor or uses an SSH window that can be easily resized to be much wider than 80 columns.
I asked my (then) development team about making a transition away from the long-held 80-column standard. Some were favorable to the idea, but I got resistance from two individuals who made several compelling arguments for sticking with 80-column line widths.
- Using an 80-column width allows one to place two code windows side-by-side on a laptop screen, which makes it easier to compare code or to borrow snippets from the other code window.
- Using an 80-columns width makes it easier to use GitHub when reviewing code in a pull request, as once can more easily place the diffs side-by-side on the screen.
- It is generally easier for humans to scan a narrower visual field when reading. Thus, if using 80 columns one can see more of the code without having to move one's head left and right to read the code.
While that last argument likely has merit to it, a counterargument is that forcing the 80-column line width limit actually results more line wrapping in modern languages. Wrapping lines can cause one to read code more slowly. Since most code would likely still fit within the historical 80-columns, there may not be so much of a need to look left and right.
So while I do have a preference for lifting the 80-column limit, there seems to be compelling arguments as to why it should be retained. And, of course, most of the development community seems to be content with the current restriction.