# Column 80? Column 120? Other?

**URL:** <https://forum.kirupa.com/t/column-80-column-120-other/642721>\
**Category:** programming\
**Created:** [May 8, 2020, 12:46pm UTC](https://forum.kirupa.com/t/column-80-column-120-other/642721 "2020-05-08T12:46:15Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [May 8, 2020, 12:46pm UTC](https://forum.kirupa.com/t/column-80-column-120-other/642721/1 "2020-05-08T12:46:15Z")

</div>

I started a new project at work last week and they have [Prettier](https://prettier.io/) settings defined so I did my due diligence and made sure I’ve been formatting new source code files accordingly.

One thing I noticed in doing so is that the settings cutoff limit for wrapping was set at 120. This threw me off a little because 20-some-odd years ago, when I was learning C in school, it was drilled into me that this should be 80. And since then I’ve (loosely) been trying to stick to that.

So I was wondering, does anyone else stick to a number?

_Poll ([view on site](https://forum.kirupa.com/t/column-80-column-120-other/642721/1))_

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [May 18, 2020, 9:01pm UTC](https://forum.kirupa.com/t/column-80-column-120-other/642721/2 "2020-05-18T21:01:21Z")

</div>

Fun fact, 80 comes from punch cards:

> **[Punched card](https://en.wikipedia.org/wiki/Punched_card)**
>
> A punched card (also punch card or punched-card) is a piece of card stock that stores digital data using punched holes. Punched cards were once common in data processing and the control of automated machines.
> Punched cards were widely used in the 20th century, where unit record machines, organized into data processing systems, used punched cards for data input, output, and storage. The IBM 12-row/80-column punched card format came to dominate the industry. Many early digital computers used pu...

80 is also the [default for Prettier](https://github.com/prettier/prettier/blob/a081bf812c3f38d5023c915c60082c143c5321cb/docs/options.md#print-width) and recommended in the [Google style guide](https://google.github.io/styleguide/javascriptguide.xml), though [Airbnb’s style guide](https://github.com/airbnb/javascript) seems to prefer 100. I couldn’t find any preferences in [Idiomatic](https://github.com/rwaldron/idiomatic.js) or [Standard](https://github.com/standard/standard).

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [May 18, 2020, 9:13pm UTC](https://forum.kirupa.com/t/column-80-column-120-other/642721/3 "2020-05-18T21:13:05Z")

</div>

I have never thought about this 😀

---

<div class="post-metadata">

**Author:** ![krilnon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/krilnon/32/34_2.png) [@krilnon](https://forum.kirupa.com/u/krilnon)\
**Post date:** [May 18, 2020, 9:48pm UTC](https://forum.kirupa.com/t/column-80-column-120-other/642721/4 "2020-05-18T21:48:33Z")

</div>

I’ve worked in some codebases that have various rules like this (line limits, linting), but I don’t value them much outside of keeping a shared workspace clean and consistent.

For my own code, or code with only a few authors, I tend to eyeball things like this depending on context. Sometimes things get wild when you’re editing code with a bunch of horizontal space that’s taken up by an assistant editor / inspector and all of your lines with long identifiers get wrapped. (`CNLabelContactRelationYoungerCousinMothersSiblingsDaughterOrFathersSistersDaughter` or whatever).

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [May 18, 2020, 10:21pm UTC](https://forum.kirupa.com/t/column-80-column-120-other/642721/5 "2020-05-18T22:21:57Z")

</div>

Wut?

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [May 18, 2020, 11:45pm UTC](https://forum.kirupa.com/t/column-80-column-120-other/642721/6 "2020-05-18T23:45:02Z")

</div>

I’ll keep comments limited to column 80, but I’ll let other lines run longer, up to 120. 80 can be rough when dealing with functions having more than one or two parameters with types.

---

<div class="post-metadata">

**Author:** ![krilnon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/krilnon/32/34_2.png) [@krilnon](https://forum.kirupa.com/u/krilnon)\
**Post date:** [May 19, 2020, 3:11am UTC](https://forum.kirupa.com/t/column-80-column-120-other/642721/7 "2020-05-19T03:11:39Z")

</div>

> [@senocular](#):
>
> I’ll keep comments limited to column 80, but I’ll let other lines run longer, up to 120.

What’s your rationale there? One thing I find interesting in recent updates for editors like Xcode is that documentation comments aren’t rendered using a monospace font. (I think there was an Adobe MAX demo in that vein a few years back as well.)

One documentation project I spent a few years on used grammar-based (or prose-based) line breaks. The style generated some pretty readable diffs in scenarios where we had lots of group code reviews and discussions.

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [May 19, 2020, 3:54am UTC](https://forum.kirupa.com/t/column-80-column-120-other/642721/8 "2020-05-19T03:54:08Z")

</div>

I use a monospace for everything, including comments. Block comments in particular I keep within 80 because it keeps things easier to read for large amounts of text. The 120 is usually a line here or line there, so when it goes past 80, its generally infrequently. I find keeping things within 80 is the most readable simply because it means less horizontal scanning.

I have a column 80 ruler line visible in my code editor as a guide. I’m not sure how it would work for proportional fonts, but if was a average or 80 w’s or whatever, it would think it’d work just as well.

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [May 19, 2020, 2:09pm UTC](https://forum.kirupa.com/t/column-80-column-120-other/642721/9 "2020-05-19T14:09:49Z")

</div>

Just saw this today, which is related (though targeting Dart, not JS). Excerpt from _The Hardest Program I’ve Ever Written_:

> At this point, you’re probably thinking, “Wait. What’s so hard about formatting?” After you’ve parsed, can’t you just walk the [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) and [pretty-print](https://en.wikipedia.org/wiki/Prettyprint) it with some whitespace?
> 
> If every statement fit within the column limit of the page, yup. It’s a piece of cake. (I think that’s what gofmt does.) But our formatter also keeps your code within the line length limit. That means adding line breaks (or “splits” as the formatter calls them), and determining the best place to add those is [famously hard](https://en.wikipedia.org/wiki/Line_wrap_and_word_wrap#Knuth.27s_algorithm).

[https://journal.stuffwithstuff.com/2015/09/08/the-hardest-program-ive-ever-written/](https://journal.stuffwithstuff.com/2015/09/08/the-hardest-program-ive-ever-written/)

And they’re also [using 80](https://github.com/dart-lang/dart_style/blob/84906910fb488b1a28d333fa8caa3639f3bc99aa/lib/src/cli/options.dart#L67).

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [May 30, 2020, 1:44pm UTC](https://forum.kirupa.com/t/column-80-column-120-other/642721/10 "2020-05-30T13:44:15Z")

</div>

Something that came up recently from Linus Torvalds:

> … But no, 80-column terminals in 2020 isn’t “reasonable” any more as far as I’m concerned. People commonly used 132-column terminals even back in the 80’s, for chrissake, don’t try to make 80 columns some immovable standard.
> 
> If you choose to use a 80-column terminal, you can live with the line wrapping. It’s just that simple.

[https://lkml.org/lkml/2020/5/29/1038](https://lkml.org/lkml/2020/5/29/1038)

---

<div class="post-metadata">

**Author:** ![broomhaylie](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/broomhaylie/32/12084_2.png) [@broomhaylie](https://forum.kirupa.com/u/broomhaylie)\
**Post date:** [July 15, 2020, 12:51pm UTC](https://forum.kirupa.com/t/column-80-column-120-other/642721/11 "2020-07-15T12:51:46Z")

</div>

Great post, a lot of stuff in here i did not know about 😀
