adgllorente

Is it 80 chars limit from the past?

Photo by Dries Augustyns on Unsplash · 23/2/2016

In the project I’m working on there is a limit of 80 chars per line, in fact, in other personal projects I have, I also set a limit of 80 chars per line.

80 chars limit is one of the most used limit when programming, but why are we using this limit and no other?

If you search on the internet you’ll see that this limit is coming from:

  • Old computer terminals that had screens of 80×24 characters.
  • The IBM punch card that had a limit of 80 chars.
  • Some people say it is easy to print

But the question is, why are we setting this limit with current screen sizes?

Having a char limit when programming is very important because it makes code more readable, easy to follow, and it makes possible to split your screen and view your code at the same time with:

  • More code ? when splitting your IDE (I usually work with 2/3 subviews)
  • A debugger like a shell, a browser or the IDE. (For example debugging a website with Chrome Dev Tools)

But today, most of the people have big screens with at least 24 inches, actually I use 2 monitors while writing my code, so why 80 chars?

Well, I would use a bigger limit, maybe 100 characters, this will allow to view the code in a split view in a 24 inches screen with a proper font size. But you have to take into account that you will probably have to hide the IDE sidebar if you are working in a 13″ laptop and scroll a little bit. If you are using Sublime Text “⌘K, ⌘B” will do the work.

Anyway, what is quite important is that, if you have very long lines, probably you should refactor your code.

code style coding

· Adrián Gómez

Powered by Astro + TailwindCSS + Markdown

Inspired in London and Julia