The Best Line Length
53 points by rbr
53 points by rbr
I think the sweet spot is more in the 100-120 range, and I have an argument.
Code is (in the best practices of practically every language) block-indented. That means we're moving the left margin to the right, and that "comfortable reading span" doesn't start at column 1. Suppose you're writing something like Java, where 99.9% of code is in a method, and every method is in a class. That means you have two levels of indentation just to get started. Write a loop and put a conditional in that loop, and you're up to four. I go for four-column indents myself, so that means 16 columns spent on whitespace, but there are people out there who believe in 8-column tabs, so that'd be 32. Practically half your allocation if you're sticking to 80.
We switched from 80 to 100 to 120 and came back to 100. It's about as wide as the brain is able to deal with. I wish we could go wider, but the eyes start to lose to line correlation by 120 width, so you end up having to move your eyes back and forth repeatedly, when at 100 you have the line context without additional eye movement.
This is close to our team's current standards:
I use 100 and I don't have any regrets about it. I still have a lot of control on how to break up expressions, and I have not found that most of my lines are 100 chars long. For docs though 100 is too wide. I'd recommend going down to 60 or 80 for code embedded in markdown files, for example.
I would prefer a EditorConfig setting that kept the <70 soft limit but didn’t start counting until after the indentation onset. Reading a very long line isn’t preferred, but nesting happens—especially with certain formatters—& I don’t start reading the line until I see the first character anyhow. This doesn’t help keeping in the 80-char limit for old TTYs, but does fit my screen size & how I read. This also helps the folks that want that 8-column tab for their accessibility since the indentation can be as wide or narrow as the user needs.
From a pure ergonomics standpoint, I've settled on a soft limit of 80 with a hard limit of 120 using 4-column indents. 80 is too short as a hard limit in some languages due to the verbosity of some expressions. In practice I rarely if ever exceed 100. That extra width is there only for cases where the soft limit alternative is strictly worse for readability.
If I was using 8-column indents it would be awkward to use anything less than 120 but I've never found 8-column indents to be ergonomic.
99% the same here except I don't treat 80 specially. Just a 120 hard cap, with a practice of only going past 95-100 if a line break would be more jarring.
This is actually covered in the article and the author seems to favor an 78-character limit for text, then adds 10 for an average indent of 2.5 times 4 spaces which seems very reasonable. Adding 32 seems a bit much for most code.
For coding in Java or similar languages it may make sense to set your first one or two tabstops to be narrower as well. This way you aren't wasting that left margin.
This is one of the problems of white-spaced based code-layout. I'd like a better way of displaying nesting, I'm particularly fond of rainbow brackets/highlighting in order to save space. Especially when using verbose variable names for enhanced readability, line length can be quite limiting.
I'm the original creator of the Black auto-formatter.
When I worked at Facebook, we used to run linters with the line length configured to 80 characters. If you went 81, the linter would complain, and that would block landing your diff. It would slow everybody down because of one character, which even our legally blind coworkers said made no difference for them in terms of readability. So in 2016 I went and created rule B950: Line Too Long in flake8-bugbear. This rule would only complain if you went more than 10% over the configured line length. flake8-bugbear’s docs tell the whole story, but all we need to know now is that this made the effective allowed line length 88 characters.
Years passed. It turned out people really liked the rule, mostly because they didn’t even notice the change. They just quietly stopped being annoyed by the overzealous linter, and the source code silently grew those few extra characters per line. So when time came to embrace auto-formatting in 2018, I had a decision to make: do I format to the 80 characters that people thought their projects limit the length, or do I format to 80 + 10%, which is the effective length anyway? I decided to do the latter, and since it seems to work so well (see Raymond Hettinger's "Beyond PEP8" talk where he advocates for 90ish), I made it the default. At the time, I even tested reformatting large numbers of files internally with 79, 80, 85, 88, 90, 92, ... up to 100 and found that after 88 there wasn't that much change in the number of lines being blown-up due to the expression being longer than the allowed line length.
To be very explicit. A few people over the years complained that this innocent number is a Nazi dog whistle. It is not. My family suffered during World War II. Fuck Nazis, fuck antisemitism, fuck xenophobia.
When I developed the default, I was entirely unaware that this connotation exists. I chose the number due to the reasons above, and also because two eights look cute together, and it’s like a double infinity. I refuse to let a fringe group take over a two-digit number. Don’t let them. It’s just a functional number.
I read the entire article hoping to find some kind of justification for the ideal line length. The answer is:
The exact, specific number here is still ultimately a matter of personal preference.
So yes, the title is bait and the bait worked on me. However, there are some interesting points in the article, so it is probably still worth a read.
These days, most of the displays I work on can easily fit around 540x140 characters with the default settings (say on a 27-inch display). I do not like how horrendously tiny everything looks at that scale, so I usually adjust it to fit only about 270x70 characters instead. For hobby code that I write for myself, I usually, though not always, restrict line length to 70 characters. This conservative limit comes from the default fill-column value in Emacs. It also lets me open three files side by side in split windows, which is a nice bonus. In professional work, I have noticed that most people around me seem to prefer a limit of around 100 or 120 characters. That works for me too. I am not particularly dogmatic about this kind of stuff.
The article links to Dan Luu's website as an example of a site that is, in their words, 'extremely, almost unreadably bad'. But I find the brutal simplicity of Dan's website actually endearing. Also, I am not sure if it is extremely or almost unreadably bad. I can read that website just fine. I should admit that I usually open it in a narrow window, which fits well with how I normally browse the web.
I tend to keep two browser windows open at all times. One uses the full width of the screen and the other is set to the minimum possible width. This is just a quirk of my browsing habits. As a hobby, I often work on my own website as well as small web-based tools and games, so I like to check how things look in both wide and narrow viewports, so it is no trouble for me to move 'brutalist' web pages into the narrow window. And these days, there's reader mode too. I realise not everyone is willing to do this, so brutalist websites don't work well for everyone.
As an aside, I was very fond of the 80x25 and 80x24 text displays from the old days of computing. This was the era of MS-DOS on IBM PC compatibles and Unix systems with VT100/VT220-style terminals. I absolutely loved working with those systems. Text user interface applications such as EDIT.COM, the Borland IDEs, and others from that era were tailor-made for those displays. They were my gateway into the world of computing.
So when I installed a modern Linux distribution in the early 2000s and discovered that the console had much larger dimensions than 80x25, even on /dev/tty1, I found it visually disturbing. I was so used to the 80x25 layout that the extra space felt overwhelming and distracting. For a long time, I went out of my way to implement workarounds just to get back my familiar 80x25 display. Eventually, I got used to the larger dimensions and embraced them. But I often wonder whether anyone else had a similar reaction to higher-resolution text displays.
So yes, the title is bait and the bait worked on me.
As I pointed out elsewhere in the thread (and has now been fixed) the original title on lobste.rs tacked on the actual number, which I quite deliberately omitted from the title. Hopefully you were baited by the actual title of the post and not the editorializing here :)
Thanks for clarifying this. I was, in fact, baited by the editorialised title and I didn't notice that the actual title differed from the editorialised one. I went back and checked your article and yes, your actual title makes much more sense. In any case, I'm happy to be baited because it is an interesting article and it has led to a pretty interesting discussion too on this page.
As an aside, I was very fond of the 80x25 and 80x24 text displays from the old days of computing.
Same here. It just made a lot of sense, my first computer was a Commodore 64 which had even less characters (40, if I looked it up right) and moving to a PC with 80 characters didn't even seem weird. But the extremely high resolutions of Linux frame buffer is super awkward and I never really saw the point of it. Why not use text mode on the console? It's much faster too!
I clicked on that and got lost reading Dan Lus article on Balmer, on a 13” screen, and when I finished I was enlightened.
Basically the wide paragraphs (probably 200 char) were theoretically bad but I stopped noticing them.
I guess when the article is interesting it’s easy to focus regardless of width as long as font size is ok.
I never went back to the original article ironically.
Heh, I'd describe Dan Luu's site as one that leaves readability in the reader's control. I can just make the window as narrow as I please because the layout works at any window shape. I think it's nice regardless of whether you're rocking Times New Roman, and I do this on my own site.
On a site that uses the full screen width for article text, I use either reader mode, or a userstyle that imposes the famous "100 bytes of css" for line length and padding.
Man now I want a multicolumn text editor.
Emacs has good support for that, via Anders Lindgren's follow-mode (bundled) and multicolumn.
Do you mean like this? https://vim-jp.org/vimdoc-en/scroll.html#scroll-binding
Oooh yes exactly that, except maybe with all the columns being in one window, so that the code scrolls right (bringing new columns into view) instead of scrolling down.
you can do that with vim with :split or :vsplit
split creates two separate windows, not two columns in the same window.
But you can use scrollbind to link them
I'm saying that's good, but what would be even better is if all of the columns are in the same window. IE if I'm at the bottom of column one and press j, the cursor goes to the top of the next column. With split and scrollbind, pressing j would scroll all of the windows down by one line.
88 is, unluckily, also a Nazi dogwhistle :/
Maybe just round it up.
I am the author of the post in question. For the record:
Thanks for the reply! Fuck nazis!
I'm a bit annoyed my comment caused such a commotion, I didn't put much effort into it cause I didn't expect anyone to nitpick it into orbit.
I hope it was clear enough I didn't assume you were a Nazi.
I appreciated the post, it was informative, but TBH was looking for some kind of confirmation there was no Nazi BS involved, so was a bit distracted while reading.
I agree it's unfortunate the title was edited, having the context of the joke paragraph would've helped.
- & 5.
Love it! And don't beat yourself up it's just a small miscommunication 💜
I'm a bit annoyed my comment caused such a commotion, I didn't put much effort into it cause I didn't expect anyone to nitpick it into orbit.
No worries. The fact that people are highly attuned to this sort of thing right now makes sense. I sure wish I were able to be a bit less aware of the lexicographical habits of the absolute worst people on earth, but, it seems we all need to be, now.
I hope it was clear enough I didn't assume you were a Nazi.
Yeah it's a fair enough criticism just to point it out, and i didn't read into your brief comment that you thought it was intentional. So, no worries. In spirit of such criticism, in the future it might be good to include a bunch of throat-clearing and hedging just to hopefully stave off the comment explosion, but so it goes. You're not accusing me of being a nazi and I'm similarly not going to accuse you of creating this degree of drama on purpose ;)
Thanks for weighing in.
I never noticed that your original title didn't include the multiple of 11. If I had, I would have suggested the original title much earlier.
I'm sorry you've had to see this community at its worst.
I don't blame anyone in 2026 for being on a bit of a hair trigger about fascists. I appreciate the folks piping up to explain that I'm a known quantity and not a possibly-cryptofascist rando. Better if we could have kept the temperature down but given The State Of Things I'm definitely not getting upset at anyone about it.
After I used the “suggest” feature, this story’s title changed from “The Best Line Length is 88” to “The Best Line Length”. I note this to assure you, glyph, that late readers are less likely to misunderstand your article, and to provide context to future readers about this large comment tree.
Maybe just round it up.
Maybe that's the other way around: you should take the strength in yourself to stop fetishizing a number ?
I don't travel trough time and space to prove it, but I bet 88 is just a number for most people who ever lived and will ever live, which is a great news if you worry that using this number would perpetuate nazism in some way.
You can take that approach, sure, but some people will assume you’re clandestinely displaying support for Nazism. It’s not an obscure dogwhistle at all.
It’s not an obscure dogwhistle at all.
Not anymore, sadly/thankfully. I remember reading a story on Reddit of someone's username that included 88 (their birth year), and they would regularly get pro-Nazi DMs and feedback on their posts. They weren't aware of the association until they started seeing the engagement en masse.
Well, if you vaguely recall that someone told a story like that on Reddit once, that settles it.
In central? Europe it has not been obscure for the last 50 years, or however long people have been using spray cans and the internet.
I'm staying out of the rest of the discussion - but this point is just wrong, at least depending on your location.
It's not fetishizing a number to know that featuring it prominently will send a signal to two groups: Those who do place special meaning in it, and those who fear the first group. If you publish something and you don't want that dynamic involved, avoid creating the stimulus. If you don't care, I wish you did.
Where everyone in your audience is coming from is out of your control, but it's common wisdom that knowing your audience is important to communicating what you intended.
With the rise of the far right in most Western societies we should all be more alert with these hidden meanings of things and not pretend these things are not happening
Right, so if you were to decide to empower them by letting their thing dictate your use of a number, that would be counterproductive behavior, from the perspective of doing good in the world (but a solid choice from the perspective of "how can I reassure my friends that I'm not one of those people, so that they stay my friends?").
A better choice would be to attach 88 to as many awesome things as you can think of — although an even better one yet would be to stop pretending that mysticism around numbers is morally equivalent to actually engaging with issues.
It isn't mysticism to recognize a code word in order to defensively identity who threatens your free society. This is one of the issues to be engaged with.
Taking a piece of vocabulary back has worked before, but dismissing it as irrelevant to you is about as shortsighted as using "be excellent to each other" as a conference code of conduct.
It would also be nice to "take back" the swastika (which is a Sanskrit word btw, appropriated by the Nazis along with the symbol), but in Western countries that seems a very long way off from being feasible, given the persistence of Nazi ideology in those countries. You can't realistically "disempower the Nazis" by brazenly using the swastika while loudly proclaiming that you're just reappropriating a traditional symbol of good fortune from the Nazis. You'll just piss off a lot of people (for very good reasons) while achieving nothing. This might be another such case.
My wife is from Bhutan, where swastikas are an omnipresent symbol for luck. She had no idea when she first came here. One day she was idly doodling swastikas on paper when someone asked her what the hell she was doing. Then she learned not to do that anymore. It's sad really how this cultural symbol was appropriated and forever tainted by an evil ideology with which that part of the world has nothing to do.
Ignoring context and blindly assuming a dogwhistle of every single use of the number 88 (a commonly used and highly euphonic number) is the opposite of identifying the racists who threaten our free society.
That it is a blind and error-prone assumption is the fault of those who clandestinely signal one another with code words in the first place, not those who feel the need to be vigilant against the real material harms that group has produced. By the way, it's January 6th today.
But that's beside the point. You are blaming the readers for their behavior, which is not in the author's power to change. We are offering constructive critique to the writer, about whom we have not jumped to conclusions. It is also ignoring context not to know your audience and what they will think of what you wrote.
That it is a blind and error-prone assumption is the fault of those who clandestinely signal one another with code words in the first place, not those who feel the need to be vigilant against the real material harms that group has produced.
People signaling one another with code words towards evil ends is an unfortunate part of life. The evil of those people does not grant you free reign to insist that everyone modulate their communication according to your own standard of acceptable ambiguity.
We are offering constructive critique to the writer, about whom we have not jumped to conclusions.
This makes it sound as if you are doing the writer a favor, whereas, in fact, accusing someone of Nazi dog whistling, based on this article alone, would be libelous and hysterical paranoia.
88 is, unluckily, also a Nazi dogwhistle :/ Maybe just round it up.
This is a kind suggestion. It is not an accusation. Nor is it insistent. It is exactly doing the writer a favor.
My objection to some of the comments here is when they veer from kind suggestion into pressure and the implication that not following the suggestion indicates callousness, insufficient empathy, or the like. Taking one of your comments as an example:
If you publish something and you don't want that dynamic involved, avoid creating the stimulus. If you don't care, I wish you did.
I reject this framing. While I could see your comment making sense in another context, I don't think 88 as a line length in a python formatter carries any danger of creating this dynamic, and I think worrying about it might create more harm as a kind of Streisand effect, or just as pointless debate.
So I would like to convince you that this framing itself can be harmful, when there is another perfectly valid reason one might not be concerned here, besides not caring about the dynamic you mentioned. Namely, that they don't think such dynamics are at play. And the fact that they possibly could be is not a legitimate basis for worry.
If you follow this comment's parental ancestry, there's not one accusation leveled at the author. (I'm also not replying to every comment in the tree.) At this comment's root is a suggestion about something the author maybe didn't think about. I think the suggestion is good. I don't get the negative reaction to that. We make suggestions to article authors all the time.
I don't think 88 as a line length in a python formatter carries any danger of creating this dynamic.
The very suggestion came from the fact that seeing 88 so highlighted gave the commenter pause. The dynamic was invoked.
That said, at this point maybe we could stand to let each other be wrong on the internet.
The negative reaction despite its argument merits also defends white supremacists whether they intend to or not. I think many people on here need to reflect on the difference between correct statements and who they're defending.
Advocating against an 88-column line width (or advocating against advocating for an 88-column line width) is not defending the free world against the axis of evil. But it's tacitly making slanderous accusations against someone who has made the mistake of not belonging to your cult (but who, in all probability, doesn't belong to the cult you're at war with either). It's reckless and stupid.
I'm not clear on who you think is accusing whom, but I don't think the suggestion made to the author about something they may not have thought about is any kind of accusation.
I think a lot of people see threads as stopped in time and that they have a correct response they can give that can be helpful to anyone reading and others are disingenuous people who know they want to just befuddle and muddy the argument and awareness of their hate. Both of these people carry water for Nazis.
This just isn't realistic. They're empowered by their own actions, not yours. You put 88 everywhere and they just attach another dogwhistle but never drop the previous one - you've made progress to normalise a nazi dogwhistle and in return you've gained nothing. Now you have a bunch of stuff that might or might not be a nazi dogwhistle and it's harder for you to tell what is. Awesome.
Your homework for tonight is to research
Come back to class tomorrow with three logical inconsistencies in your comment underlined, and be prepared to discuss.
But seriously: your detection rate of "dogwhistles" is already no better than random chance (case in point, this post), so there's absolutely no harm in throwing a wrench in theirs.
Nothing justifies your comment being so smug, but I'm not someone who was "detecting" a dogwhistle in this post. I don't really think it is personally, but that's not the point. The point is there's no wrench-throwing, a new dogwhistle can become popular in less than a week. Your lack of deserved rudeness is also indicated by your confidence: you do not know if this post is using 88 as a dogwhistle and you will never know unless the author comes out and admits it - that is the point of a dogwhistle.
you do not know if this post is using 88 as a dogwhistle and you will never know unless the author comes out and admits it - that is the point of a dogwhistle.
By this argument, one could post any article whatsoever, claim there is a new dogwhistle in it, ask the author to change it, and then get indignant with any push back for "not being vigilant enough against Nazi dog whistles." Effectively, it operates as a free moral pass to police the language use (and perhaps more) of anyone whatsoever.
Perhaps that is the point all along?
Sorry, but this this a false dichotomy: you can very well be alert on political topic without having to advise someone not to use a number in an completely unrelated topic.
How can a “should” statement present a false dichotomy?
The dichotomy was in either you acknowledge that 88 is a nazi reference and therefore should not be used anymore or if you don't you are pretending the rise of far right in most Western societies is not happening.
I tried to argue that this was not the case and you could perfectly use the number 88 without pretending the rise of far right in most Western societies is not happening, like most people do in their daily life.
English is not my mother tongue, so I might have understand his comment wrongly: if it is not "dichotomy", what word is more appropriate ?
Others have mostly answered this already but I'll reply too cause it was my own comment and opinion.
I wouldn't care in private spheres. Here's it's very public and I didn't find a justification for 88 over 90 besides the Chinese numerology.
Therefore, assuming it's not an intentional dog-whistle, I think it's not worth the trouble of attracting Nazis, nor cause anyone to question if it is a dog-whistle and bounce off the project.
I see this kind of argument a lot, but, like overly defensive programming, overly defensive concern has costs as well as benefits. Spreading a kind of paranoia, keeping people unhealthily on edge about inadvertent offense, and generally wasting time are a few that come to mind.
It would have never occurred to me that the python maintainers were secret Nazis, and I was familiar with 88 in the context of prison tattoos and reddit trolls, for example.
So this strikes me, personally, as overreach. You may disagree. Either way, I'd argue caution w.r.t. this line of argument in general -- the "what does it hurt just to be on the safe side?" argument. Well, it may have some downsides.
To you, the cost is "keeping people unhealthily on edge about inadvertent offense"(?), and "wasting time"(???). For most people who are not white, the cost on the other side is that zero vigilance can progressively allow social spaces to become nazi bars. I don't exactly see how these things are comparable, unless you simply don't care about the latter.
Furthermore, concern trolling people pointing out one of the most popular white supremacist dogwhistles in existence today also has its costs, which clearly far outweigh the cost of even a basic level of vigilance. In the social environment of the internet, which is rife with racism and other bigotries, it signals to others who read what you say publicly where your priorities are.
This post perfectly demonstrates the kind of false dichotomy and bad faith rhetoric that made me post in the first place. What you are doing here is far, far more harmful and toxic than an article suggesting "a line length of 88."
I don't exactly see how these things are comparable, unless you simply don't care about the latter.
You don't get to invoke the threat of Nazism where none exists, and then dismiss all other viewpoints because the threat of Nazism is so much graver than everything else. And you don't get to accuse someone (a Jew, as it happens) of not caring about Nazism because he isn't being carried away by your fantasy of a threat after reading an article about optimal line lengths in programming.
concern trolling people
The only troll here is you.
I'm not 'wasting time' reading or responding to any of that. You've made your priorities clear.
Yeah Nazis always like to complain too about how unfair the dialogue about them can get and isn't that the real crime or some shit. Also conservatives for some reason have turned this into generally mentioning bad behavior of someone else is worse than the behavior itself somehow. Weird cognitive dissonance times of media illiterates.
And a right-facing swastika is just 6 lines put together, stop fetishizing drawings too?
These neo-nazi symbols have only gained more popularity, not less, so the number of people for which it's just a number is much less now than it ever was.
Symbols exist for a reason.
You see swastikas in many parts of California. It is particularly common to see them prominently displayed on tombstones. Apparently Asian communities didn't get the memo. No one reasonable thinks this is because Asian communities are hotbeds of nazi-ism.
The idea of offensive numerology is even worse because numbers are ubiquitously utilitarian and not substitutable. Some people are offended by the Number of the Beast but "666" is mostly just 2/3 of a thousand. We don't let them dictate what numbers people can use for ordinary purposes.
We don't let them dictate what numbers people can use for ordinary purposes.
The number 13 is so scary to some that it is (was?) often skipped in building floor numbers. I think that was a very drastic thing to do. People assign a lot of power to numbers!
I've been traveling to Indonesia years ago and this is the place where I've seen the most swastika in the world, but it was in no way a reference to nazism. Where you see a reference to nazism, someone else in the world will see something else.
So yes, I would also argue to stop fetishizing drawings or any other things. Things can have bad references, but they also have good ones and I think it is more powerful to focus on the good ones.
In this case, I prefer to focus on 88 being just a number in the context of "the best line length", because thinking about nazism in this context has no sens.
Well the final link from TFA chooses 88 but then goes on to say "90-ish seems like the wise choice", making 88 essentially arbitrary in this context. So you maybe can just round up (per comment tree root) regardless of the associations.
True ! I personally don't like black's 88 default; I prefer 120 but to each their own ;)
We tried 120 for a few years (lots of big 1m+ 4k monitors and all), but ended up dropping down to 100, which has worked well for us (Java, Python, Ecstasy, C, ...)
For whatever reason, 120 ended up being harder to read, which I was surprised by.
To each their own is kinda also a Nazi dog whistle: https://en.wikipedia.org/wiki/Jedem_das_Seine
In this case, I prefer to focus on 88 being just a number in the context of "the best line length", because thinking about nazism in this context has no sens.
This is the same as people arguing that politics don't belong in FOSS projects: technically it might be true, but it's also incredibly naive as it ignores the human component.
I don't say that we should ignore human component at all, building software is part of the social tissue like any other collective human activity.
But I find noticing reference to nazism in every little things to be annoying because it creates noise and heated discussions for no good: the author used 88 as a number and most people will read his blog post has 88 being a number and not a hidden nazi reference.
Every comment below the comment of ThinkChaos, mine incuded, do not discuss the subject of the author's article. In the end, what good did it provide ?
88 is very well-known among both (neo-)nazis and anyone who reads about them.
This is not "every little thing". When I saw the headline, my immediate reaction was "is this a dogwhistle at the top of Lobste.rs?"
Further, neither this blog nor the documentation for Black presents any reason why 88 should be specific answer. They both just say "90ish", and then, maybe conveniently, the nazi number is close to 90, let's pick that one.
Fascists always pretend something is "just a joke" or "unrelated" until it isn't.
I've been traveling to Indonesia years ago and this is the place where I've seen the most swastika in the world, but it was in no way a reference to nazism.
Right, so there's other cultural context there. But if you write a blogpost about monads being like burritos and your burrito illustrations all have swastikas on them, do you think that the first thing in people's minds would be Indonesia? Or Nazis?
If you build string and percussion instruments, the number 88 probably has a strong association in your mind with piano keys. And so your blog posts about pianos might use the number 88, maybe even in clever wordplay ways, and very few of your readers will think of anything but piano keys.
But if you write a blog post about debugging memory leaks in perl, and your demo code happens to build 88 objects in a reference loop, and you make some clever wordplay around the number 88, then, well, piano keys might not be at the top of your readers' minds.
Why? Two big reasons.
The first: because in one case, you have a context. You're situating the numbers and symbols within a shared framework of understanding, so those numbers and symbols convey an intended shared meaning.
But in the other case, you offer the numbers and symbols without any context. The reader supplies the context. And if one of those numbers or symbols have strong associations in the reader's culture, they're going to see that as a connection.
The second reason: It's a codeword, like "420" was a code for marijuana, like "going skiing" was a code for cocaine, like "friend of Dorothy" was a code for gay men. The intent of a codeword is to use it as an identifier out of context.
Now, maybe "80-100 columns" is enough context for the number "88", but when the author doesn't justify the number aside from vibes, and then points out that the number is completely arbitrary, well, that's exactly the kind of context-free environment that a codeword thrives in.
In other words, don't get angry at a reader for reading it differently than you. Was it intentional by the author? No idea. Would it be less culturally touchy if the number was 87 or 89? Yes, absolutely.
The Internet is a widely different place from the physical world. Information is much more global and cultural issues among different cultures meld more often than in real life. There is often very little context. Someone might very well write a comment that they're in the "88 club" or write "all hail 88" and then you're not sure what people are actually talking about.
Very different from seeing a swastika in a Hindu temple.
I very much agree with you, and therefore when there is very little context I think it's safer and most likely correct to assume that a reference is not toward nazism.
When we do have a context, like a blog post about the best line lenght for coding, it makes it even more obvious.
Maybe I'm wrong, but I find life much more peaceful and discussion much richer when you assume good faith from other people unless proven otherwise.
An individual person can't change the fact that the number 88 is used as a nazi dogwhistle. This is not a hypothetical thing in the realm of ideas, 88 is used as a nazi dogwhistle. It's less useful nowadays now that people increasingly feel safe being open about fascist ideology. 88 is also the (in my not-uncommon opinion) the correct amount of keys for a keyboard to have, and 8 is also considered a lucky number (as noted in the post).
These are all just facts that you can know; there's no "fetishization" inherent to that and there's no "strength" in not knowing that fact.
I hope this tone doesn't come off as patronizing, it just seems worth expressing this in clear and concrete terms.
Nobody is arguing the author is a cryptofascist though (they are a known name, and it would be very surprising and contrary to their character!)
Yeah, but I think your take is not very sensible. From all the places, why should anyone use a iine width setting to dogwhistle? You could use 0x58 if the configuration accepts hex numbers.
There's precedent for this. The 80-column standard for punch cards came from a requirement from the 1930s German government to include more fields in their racial census, so that they could identify people to send to death camps.
Someone named Phantom_Hoover dropped by the chat room and said they believe this is incorrect:
The IBM 80-column card format was introduced in 1928: https://web.archive.org/web/20150103043755/http://www-03.ibm.com/ibm/history/history/year_1928.html
I think they're correct. David, perhaps this is a misreading of IBM and the Holocaust, page 56/57:
These 600 punch holes, arrayed in their endless combinations, yielded thousands of demographic permutations. Even still, Dehomag officials wondered whether all the data the Reich needed could be accommodated on the 60-column cards they were using. Dehomag declared in a company newsletter that it was willing to move to an 80-column format for the census, if required "for political reasons." [footnote 17]
The footnote is on page 459, I've included another citing the source:
14 Hummer, pp. 343-355; see Letter, WD. Jones to Thomas J. Watson, January 10, 1934, IBM Files.
17 Hummer, p. 346.
I haven't looked for this letter to run it down futher.
EDIT: Markdown's eagerness to create numbered lists replaced the "17." with "15", because of course "14." started a list and it overrides later numbers with the "correct" number in the sequence. I've removed the periods from the footnote to prevent this confusing situation.
I agree. Seeing such a requirement in a FOSS project would discourage me from using and even more from contributing to it.
The correct column width is 99, as that is the longest line length possible when two Emacs frames are tiled side-by-side on a 4k monitor after (gfs/magnify-faces) is evaluated twice.
Frustratingly the post mentions that there have been empirical studies on them but doesn't actually say anything about the numbers from these studies. The ones I've read have concluded that readability is best for prose at 65-70 characters per line.
The way I see it there are two factors that require adjustment before taking this number and applying it to code; the first is that the studies were done with proportional-width fonts, which ... I mean if you program in proportional-width fonts then more power to you, but this is very rare. This factor would lead to a number lower than 65-70. The second, which is mentioned in the article, is that most lines don't begin at column zero but rather some multiple of 2 in, which would raise the number.
The question is whether these two factors cancel each other out. I guess it probably depends on how indented the mean line ends up being, which is going to vary by language and coding style; I certainly don't write much code in classes these days. But it makes me curious.
In a typical object-oriented Python program, most of your code ends up indented by at least 8 spaces: 4 for the class scope, 4 for the method scope. Most likely a lot of it is 12, because any interesting code will have at least one conditional or loop. So, by the time you’re done wasting all that horizontal space, a max line length of 90 actually looks more like a maximum of 78...
When I read this, I thought 12 was really high. (but I don't use python.) So I wrote up a lil script to show what the mean indentation actually is. https://p.hagelb.org/indent.fnl.html Running it on some readily-available codebases shows:
I think the test suite is such an outlier specifically because it has a lot of fake test data in it embedded in the source files. I don't have any Java programs checked out on my machine, but I'd guess it'd be a lot higher for that.
(for f in $(find . -name \*.java); do awk '/^ / { match($0, /^ */); count++; total+=RLENGTH} END {if (count > 0) print(total/count) }' $f; done) | awk '{total += $0} END {print(total/NR)}'
I get 5.8 for mean indentation (of lines that are indented), for the java project I mostly work on (EJBCA).
The other thing about relying on these studies is that the studies were all done on prose and the cost of breaking a line is much higher in code than in prose. So even if 70 characters is the peak of the curve for prose, the ideal max length of a line of code is going to be higher due to this tradeoff. How much higher depends on the shape of the curve, which you can't tell simply from the fact that it peaks at 65-70.
I've love for one of these studies to be done for code readability. Ideally testing for code comprehension (what does that function do, can you spot the bug, etc.). I wonder if it's easy enough to test that you could study it on MechanicalTurk (assuming there are any humans left on there). Though... if a line is too long, what's the alternative? Soft wrapping? Introducing a local variable? Splitting the expression across multiple lines? Probably the most consistent thing would be always splitting the expression across multiple lines, using a language's standard code formatter with different max-line-length settings.
Nope 100 to 120, anything else becomes miserable to read due to otherwise unnecessary line breaks, especially once indenting comes into play.
Every time I deal with these projects with style rules designed around a vt220, or maybe even something as high res as a 640x480 screen the code looks grotesque. There’s only so much you can break down into local variables, and all the variable and parameter names are compressed to only a few letters - so any claimed “improvement” from breaking single lines into use of local vars is instantly defeated.
The “just use a local var” policy also doesn’t work for types that have lifetime semantics: unless you add a new otherwise needless scope+another indent you end up extending lifetime unnecessarily.
Three files just barely fit on my ultrawide side-by-side in 80 col. Also I use 133% scaling. So 80 cols it is. I set 80 cols for rust too since its annoying that its otherwise inconsistant with my other code.
One point that's missing from most of line length discussions is that at least in my experience, the optimal line length depends on the language, since they have different syntax and naming conventions. In addition, each language has some constructs that look better together on a single line, even at the cost of going over the limit of optimal readability for prose.
For example, in C, shorter line lengths tend to work well for me, since identifiers tend to be short and the syntax is fairly amenable to line breaks anywhere. On the other end of the spectrum, for PowerShell, I don't even have a maximum line length set, since it uses very verbose identifiers, doesn't lend well to line breaks inside statements, and specifically for terminal output, it's useful to see string literals without line breaks.
Another point that I expected to find in the "Code Isn’t Prose" section is that code is rarely read as prose. I almost always read code by jumping between relevant places, either visually or using editor features, and only read very short snippets sequentially. Based on that observation, it seems more important to have easily skimmable unbroken expressions on a single line rather than optimize for readability of longer blocks.
I usually set it to 120 or whatever my window width is at the time, and let formatters to care about it.
After messing a bit with this configuration, I ended up with a text width of 160 and has been lived happily ever since. Works fine for my font-size + screen resolution.
88 is too small, 100 is small, 120 is smallish for me.
The best line length is one sentence per line, or one whatever my code formatter says. Anything else is a distraction.
I've settled on 100. It's wide enough that most lines in modern languages fit, and it's narrow enough that I can edit two side-by-side files even on tiny screens (looking at you, Surface Go). I really have a hard time working with code that has no line length limits: horizontal scrolling sucks, and soft wrapping breaks the ability to see indentation.