Skip to content

Comment on Why is 80 characters the 'standard' limit for code width?

Comments

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?

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.
          }
      }
  }
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.