Hacker News new | ask | show | jobs
by Zigurd 4394 days ago
80 characters is also comfortably within the limits for presenting code in most books, except for pocket reference sized books. The actual limits for most books are about 85 characters, so that leaves some leeway.

Even 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?

1 comments

60 to 90 characters per column is widely used in typesetting for good readability. It’s probably not a good idea to go very far beyond 80 characters or so purely for readability, no matter the context.
Well context matters, especially if your language has you starting with at least two or three tabs for most of your code:

  package Foo {
      class Bar {
          void baz() {
              // Most code is nested *at least* this deep.
          }
      }
  }