Adam: Hello, this is CoRecursive and I’m Adam Gordon Bell. Do you remember in 2014? Germany won the world cup and the ice bucket challenge was sweeping Facebook. People pouring buckets of ice over themselves to raise money for ALS.
But also in 2014, in my favorite hangout, Hacker News, an argument broke out. I know. Arguments on the internet, big surprise.
But on this day, June 1st, 2014, a question from user Fredley on the software engineering stack exchange became the number one post on Hacker News.
So you probably know what happens next. People started to post their opinions in the comments and other people started to disagree. The post spread around the internet. It got tweeted and retweeted. Eventually the bloggers joined in linking to it and posting their own takes. By the time the discussion had cooled off, 630 pages around the web linked to this question. Do you want to know what it was?
It was not tabs versus spaces. It wasn’t VIM versus Emax or Mac versus Linux versus Windows. It was this:
Why is 80 characters the standard limit for code width? Why 80? Why not 79 or 81 or even 100?
So that is going to be today’s show. Let’s answer this question. Not just why is it 80, but should it be 80? And to share my biases right now, going into this, in my VS code, I have a line drawn at a hundred characters, and this line is lava. Nothing can touch it or I need to break up the line. But should you have that line at all? And should it be at 80 characters?
It’s a question about traditions, and teamwork, and how preexisting idioms and the culture of software development, how it shapes us and helps us, but sometimes restricts us. Yeah. It’s all contained in this one question.
Adam: But I’m getting way ahead of myself here. I should introduce my guests. Joining me, I have my Apple hating neighbor, Don McKay, and my smarter than us all, don’t ask her about elliptical curves friend, Krystal Maughan. Say hello, you two.
Krystal: Hey. How’s it going? Nice to be back.
Don: Hey, I don’t hate Apple. I think you’ve invited me onto your podcast because you missed the arguments we used to get into.
Adam: So before we discuss where this 80 character limit comes from, I’d like to just talk about whether it’s good or bad. So you know what we’re talking about, right? Some people don’t want the lines of code that you write or comments or whatever to be wider than 80 characters. What do you guys think?
Don: 80 characters for me, personally, is fine, but I prefer more characters just because wide screen monitors have become a lot more common now.
Krystal: But what if you are one of those programmers who codes on their phones?
Don: I do not do that.
Adam: There’s an accessibility type argument you’re saying Krystal like…
Adam: You can’t just be like, “Oh, of course every developer has a giant 4k.”
Krystal: But they should.
Adam: I’ve been called out on this before. This person joined the team was using VIM and they had a very specific setup. And we just didn’t enforce these code widths, but then all of a sudden, he would have trouble scrolling over to see these long characters.
Don: How long was your lines there, Adam? Were they excessive or they just didn’t fit his smaller format?
Adam: The thing about wide code is it’s not constantly excessive. It’s just like, “Oh, there’s the occasional line. And I think this would just look better if this ‘if’ went way, way over.”
Don: It will never look better if your ‘if’ just goes way, way over.
Hacker News Opinions
Adam: So on Hacker News, this debate shows up. And some of the people were less afraid to tell us what they think.
In my experience, there’s a very strong correlation between good developers and short lines. Bad devs don’t mind if some lines are 150 characters long and require horizontal scrolling. They also don’t care much about consistent naming of symbols or having correctly indented code. There are very strong reasons for keeping your lines short, your naming consistent, and your indentation in check. But at the end of the day, you either get it or you don’t.
Adam: In other words, he’s like 80 characters are correct and good devs know this in [inaudible 00:04:24], they were born knowing it. And I guess he’s also saying, this is a key signal to see whether you care. If I look at a code base and they don’t have 80 characters as the limit, then I know they don’t care.
Somebody else could say, “Oh, I worked in Java Spring and some of the variables are 80 characters long.” If I have a 80 character variable name, how do I make any changes to it? So what do you do then? And then someone else mentioned, if you are C sharp or in Java, you open the package or a name space, and then you open the class, and then you open the function. And then you have a ‘if’ inside of that, if each of those is four spaces, you’re already, four times four, 16. You’re already 16.
Krystal: That’s a good point. Yeah.
Adam: You’re already way in, so you’re already losing all that indent, which is why user mantracks5, awesome name by the way, says,
I use 120. Plenty of space to fit two code windows side by side, and one file browser. With HD screens and the verbose languages we use these days, it’s a bit silly to try to stick to 80 characters.
Another user, raverbashing has said it’s stronger than that:
Just confirming that 80 characters is idiotic and an arbitrary standard propagated by nothing much more than cargo culting oh, but it fits my screen. It fits two by two on my screen. Well change your font size.
Then this argument just goes on and on. Any place that developers are gathering or talking about their code, somebody says, it’s absolutely this. Somebody says, this is dumb. We’re going to go deep on this topic. Have you ever heard of Chesterton’s fence?
Krystal: No. Random.
Adam: Okay, perfect. So there was this guy named GK Chesterton. He’s a long dead Englishman. He was a contemporary of C.S. Lewis1. You know C.S. Lewis was the Narnia books?
Krystal: Narnia. Yeah.
Adam: So they were the influencers of their time, except being England in the 1800s, instead of hosting hot takes on Twitter or writing blogs on Substack. They would write letters back and forth. I disagree. Dadadada. It’s just same as Twitter basically.
Don: Just it took a lot longer, right?
Adam: So Chesterton’s fence is this argument that he has, that was later called that. Chesterton says in some essay, imagine there’s a fence blocking a path, and the fence is in people’s way.
The more modern type of reformer goes up to the fence and says, I don’t see the use of this fence. Let’s clear it away. To which I reply, if you don’t see the use of it, I certainly won’t let you clear it away. Go away and think, and then when you come back, tell me what you do see the use of it, and I may allow you to destroy it.
It’s a strange way to word things, but it makes sense. He’s saying you got to figure out why people did something a certain way before you stop doing it. If you think the 80 character rule is stupid and you say, “Let’s stop following it in our code base.”, Chesterton would say, we’ll find out where the rule comes from. And then you can decide on the basis of that, whether that rule still makes sense. I assume, in the case of the fence, you wouldn’t want to remove it and then find out, oh, it was blocking an area where the ground is unstable. Because there might be an important reason for this rule. Maybe your compiler just stops reading things at the 80th character. I don’t know. The Chesterton says, go find out first. And so Don, maybe you would blame Apple… I don’t know.
Don: You’re trying to get the Apple fans to come after me.
Krystal: So what is the equivalent of being blocked back in the day? What is the equivalent?
Adam: Oh, like how do you get canceled in the world of-
Krystal: Yeah, in their world.
Adam: … Writing essays and letters back and forth?
Adam: Oh, that’s a good question. Truthfully, they were a lot more conservative back then. Maybe you would get drummed out of the country. They’d be like, this person’s views are incorrect. Lord Byron, who was a poet, an influencer…
Adam: Yeah. He was like, whatever, English influencer. And he would read poetry out loud and women would-
Adam: Yeah. They would swoon. Anyways, he was kicked out of England for, I believe, basicly because … I think he was gay.
Krystal: Oh wow.
Adam: Things were much less understanding back then.
Adam: So 80 columns comes originally from IBM punch-cards. And I’m sure at least one person listening already knew this because the Stack Overflow question dates back to 2014. And as I said, it’s been shared a lot. But it’s crazy to think about to me. If you can imagine computers existing before computer monitors or keyboards existed, like on a factual level, I know that’s true, but it sounds super strange, right?
All my computer interactions have been mediated by keyboards and monitors. I mean, sometimes large CRT monitors, but still, it’s just a weird thing to think about. So before they existed, you had to input all your data or code into computers using punch-cards. And IBM punch-cards looked like recipe stock cards but twice as wide, like the size of a page of a paperback book if you turned it sideways. And the way the programming with punch-cards works is that each punch-card equals one line of code in your program. And a standard punch-card is a grid where you have 10 rows down and 80 columns across. And so that’s where the 80 character limit comes from. You would write your program out in long hand, in paper, and then you would punch it into the cards. And so if you went over 80 characters, you were dead. There was no more lines on the punch-cards. This is like a very hard rule.
We’ve kind of appeased Chesterton and his fence now. We know where the 80 characters comes from. It clearly comes because you couldn’t fit anymore on a punch-card. What does that mean? So we can remove the fence, I guess. We’re definitely not using punch-cards now. So the purpose of the limit seems to be gone, right?
Don: It’s pretty restrictive if you’re working in an environment that anything over 80 breaks your whole system. Maybe be more adaptive. I don’t know.
Adam: Shots fired.
Don: It’s like that one guy was saying, reduce the font size or we have so many tools and options available now that we don’t have to be locked into one specific convention.
Krystal: But I feel like not everybody has those tools.
Don: Yeah. We do have standards. I think our maximum line length is 240, but you can’t have crazy Adam lines.
Adam: I think 240 is a crazy Adam line.
Krystal: Yeah. This reminded me, one of my mentors, he was telling me that they actually had to use punch-cards to do their homework. And so they’re grouchy because they’re like, oh, you kids are spoiled with your control Z and your IDEs and stuff.
Don: Yeah. I don’t know. That seems to be like a common human thing. I suffered so you have to suffer.
Adam: So the 80 character limit may in fact be a leftover form of hazing?
Bytes and Nibbles
Adam: So I don’t want to give up on 80 characters so soon just because we figured out where it came from. But punch-cards is a super interesting thing to take a little bit of detour. A lot of stuff that we do in computing now actually came from punch-cards, but you just don’t really notice it. So the delete key is an example. Do you guys know how the delete key is sent to your computer?
Adam: If you imagine your punch-card, that’s like 80 columns by 10 columns, right? So each row is going to be a single key of your Fortran or COBOL program or whatever. If you want to type in the letter ‘A’, the character for the letter ‘A’ in ASCII is 97. punch-cards work the same way. That 97, you convert it to binary and it gives you 1, 1, 0, 0, 0, 0, 0, 1. And so you would punch the first hole, the second hole, and then a bunch of blanks, and then another one.
If these old mainframes spoke ASCII, which they didn’t, but you can imagine this would take a long time. So they had something called a key punch. Maybe you saw that, Krystal, at the computer history museum. I don’t know. The key punch is like a typewriter, but instead of paper, it took in these punch-cards. And when you type the word ‘A’, it would punch out the holes on the current row that were needed for that. So you wouldn’t have to do this look up. This relates to Delete keys, I swear. We’re going to get somewhere. So they didn’t use ASCII, which is seven bits. They used eight bits. So it’s basically like eight of the holes for each letter. So this became the byte. The byte is eight bits. And this became the unit of computing. Because before that time, computers varied in a lot of different ways. Each new computer might be different. Some might be eight bits. Some might be 12 bits.
Don: And four bits is a nibble.
Adam: This caused them to standardize on a bite, because that was how you could represent a character of text. Each row on a punch-card, became a byte. If you were inputting text, a punch-card give you 80 bytes. But here’s what’s wild. That’s still how we do things today. We went from a time when this was undecided, there was 12 bit, 8 bit, nibbles. And now everybody uses bytes, which, if you think about it is a very strange way to describe all space for everything. That’s just weird. A gigabyte is a billion text characters. If you were to put that onto punch-cards, a gigabyte would be 12,500,000 punch-cards.
Don: That’s a lot of cards. Do you think they would get one person to punch all those out? Or…
Adam: Imagine it’s just like a JPEG, like a meme.
Don: It’s just a meme.
Adam: So I promise this would all relate to the delete key.
The Delete Key
Adam: The eight bits that used on a punch-card was called the extended binary coded decimal interchange code. That’s really easy to say, EBCDIC. If you make a mistake in it, you typed a typo on your card. You hit F when you meant A, you can’t fill back in holes, once you’ve punched holes.
Don: Yeah. That’s true.
Adam: The only thing that they could do was punch out all the other remaining holes. So if you accidentally do F instead of A, you just punch out all the rest of the holes. In this eight bit mapping, all eight characters being ones, was called eight ones, which I suppose is a good name for it. Or in ASCII, where it’s only seven bits. The flipping all seven ones on is the highest value in ASCII, and that’s the delete key. The way delete keys work today, when I press a button on my keyboard, that’s delete and sends the value 127, it sends seven bits, all flipped to one.
And the reason for that was, that was the only way to erase something on a punch-card, was to punch out all the remaining holes. The ASCII value of delete is based on having a way to delete a column. And it’s even the same in Unicode. So if you’re sending people whatever, taco emojis, or I don’t know what the right emojis people are sending. If you want to delete that, you’re sending the 127 value and it all dates back to punch-cards. And it’s all just because you can’t un-punch a hole in a card.
Krystal: Whoa. That’s cool.
Adam: Here’s how it relates to our original 80 character thing. We don’t need delete to be all the holes punched anymore. We didn’t need that in Unicode with taco emojis and hearts and troll faces. We don’t actually care about punching holes, but there was a lot of things that assume that delete is like seven ones. So the original reason Chesterton’s fence is long gone, but it led to other reasons. I don’t know. Do you buy it?
The Past Was Less Constrained
Krystal: I went to the Computer History Museum. It’s really cool. We think about 80 characters and like that being tradition, but even back then, they were trying to think about different ways of representing, that would be more like the way we, as humans, process information. And we kind of accept these things today. This is how computer is. And so there’s more of this focus on incremental change these days and accepting a lot of things. And when you go into the Computer History Museum, what’s really cool is that they were radically redesigning things that we take for granted to date. It’s just wild how people were just, oh, I’m going to use this completely different thing and call it a computer. And yeah, I wish you would do more of that because it’s like pushing limits.
Adam: I guess the big question here is because some things get tradition, should you throw it out and rethink it? Or should you persist?
Don: I think it’s situational. If you have one of those reasons where you need it to be 80 characters, then obviously you can’t. But if you don’t have those restriction, why not?
Adam: Let’s muddy the waters here.
I’ve always wondered why the same people who say, oh, variable names should be long and descriptive. Then, when they want to count to five, they go and they write out a for loop and they write for
i equals one,
i less than five,
i plus plus plus. I mean,
i is not descriptive, right? That should be like food counter, blah, blah, blah, for… So why did they choose
i? And if you push them, then they’ll say, no,
i is for incrementing. Incrementing
i is fine.
Krystal: An adjacency matrix or something?
Yeah. And then if you push it further, they’re like, well,
j is fine too.
k is okay…
Krystal: Because, well, the way they teach computing too, is like you’re supposed to just follow the things. There’s so much about the way we think about computer science. There are all these things that are traditional ways of coding that everybody goes through, and we don’t really ask questions about why we’re doing things in particular way. Because you’re just like, you’re learning, you’re not supposed to ask questions. Just do the thing, learn how to write a for loop. It doesn’t make sense. But this is how we code.
Don: I remember when I was in school, learning how to program and doing loops and it was very much like you have to write it like this. If you want to do a for loop, i is the variable you use to maintain the count. But at some point, I found out that you don’t have to name it i.
Adam: Blew your mind. Yeah.
Don: I didn’t even know. I went through most of my school days just doing the i, and then eventually one day, I found out. I’m like, wait, it still works if you don’t have it named i? Like there’s nothing in the actual language itself that says that you have to specifically call it i, and I’m like, well, why am I naming it i? I could’ve been naming it something else this whole time. I was very outraged at the time.
Adam: Yeah, exactly. Eventually, I learned this rule that’s much better than the used descriptive variable names, which somebody told me, which was that names should be equal to their scope. Which makes a little bit of sense. It implies like if you have a little for loop, you can call it i, because the scope is very small. But that doesn’t explain why it should be i. Why not X or A or…
Krystal: Yeah. A foo, a bar…
Adam: Yeah. Foo, bar, and baz, those are more things that we just carry forward without questioning. But they’re idioms, right? These are programming idioms. And as you said, you learn them. People wrote for loops like this in C and then move forward from there. And people just keep following in their footsteps.
Krystal: Okay. I always think that people writing books, I would wish they would include those kinds of things in there.
It makes it so much more interesting if they can say here’s why, but so I know why it’s an
Krystal: Of course.
Don: So my assumption, because I don’t know the answer to why it’s i, but my assumption was always that it stood for index.
Krystal: Yeah, me too.
Don: And J and K were just because, well, we already have index and it’s I, so I guess the next index will have to be J. I always just assumed it was one of those things.
Adam: Okay. So you’re not far off. A lot of punch-card programming and mainframe programming that followed may be not using punch-cards, but just on mainframes. It was using Fortran and COBOL. And if you have 80 characters or even less per line, you want to be concise. So Fortran came up with ways to make each line concise because you only had so much width. One of these things was that they assumed that all variables would be real numbers. So 2.3 or 5.6. So you didn’t have to declare them as reals. They would just be real except for I, J, K, L, M, and N. Those were always integers. You didn’t have to declare them. I is just an integer.
Krystal: Oh, for integer.
Adam: So if you needed to do a loop, you would just grab an I because that is the first integer that’s available. So they just set aside six values to be integers. And in fact, I believe it’s any variables that start with those. So if you create a variable that starts with I, it’s going to be an integer. And then people just want to be short because they only had 80 characters. So they’re like, why would I type more than just I? And then once I use that, the next shortest integer I can use is J, and then K. So that’s why. The reason for using I dates back to Fortran. And it was just the first integer value available. And this whole thing is the root of what I guess must be one of the first programming dad jokes, which Fortran people would say, “God is real unless declared as an integer.”
Krystal: Oh no.
Adam: Because the variable God would be considered a real number unless you said it was an integer. So now you know that the i is somewhat arbitrary. But just because you know it’s arbitrary and no longer makes sense, because I’m not programming in Fortran, doesn’t mean I’m going to start going for atom equals one atom plus plus, well Adam, less than five.
Don: You could name it whatever you’re looping through. Row or user or index or something. You’d actually name it whatever you’re looping through and then it makes sense. Remember you have to write things for yourself three months from now, when you have no idea what this code is.
Shared Arbitrary Idioms Have Value
Let’s say I’m doing a transpose where the element at
j becomes the element at
Don: He’s making elaborate hand actions.
Adam: I can do four row and then four column. I’m not sure it’s better. I know the I and J. That’s just burnt into my head. It’s not I and J is only better because everybody knows this idiom. It’s burnt in.
Krystal: It’s cross disciplinary too. If you were to talk to a quantum mechanics physicists or graph theory person, they probably use I and J too. Everybody thinks about vectors as I and J.
Adam: Yeah. It is arbitrary, but it’s actually okay. Because… Don’s not buying it, but…
Don: No. I think in the context that you described, it makes sense. If I was doing it and I was working with an actual collection of something that’s meaningful, then I would probably name it that thing rather than I or J.
Adam: And then also Don’s like, I work in Scala. I don’t loop. I just map over something.
Krystal: Yes. Exactly.
Don: And I’m not going to name it i, right?
Adam: So we started with 80 columns. But really, what I’m trying to get at is the fact that arbitrary things become ingrained, and then we forget why they’re ingrained, but we keep doing them because there’s a value to uniformity and shared understanding or something like that. So it brings me to counting.
Counting From Zero
Adam: Okay. So I’m going to point at things. You guys count, I don’t know. Count out loud.
Don: One. Are we starting at zero or one?
Krystal: Four, Five.
Don: All right. Where’d you get five pens from? You have five pens floating around on your desk?
Krystal: I do.
Adam: One of these is a highlighter. I don’t know if that’s helpful. So you did start, at first, counting at zero?
Krystal: My professor usually says, if you’re not a psycho, you start counting at one.
Don: Yeah. Because you have one thing. You’re counting the number of things. You’re not counting an array.
Adam: Yeah. But it’s super weird. Right?
Don: Is it? Is it weird that if you hold up a pen and I’m like, that’s one pen.
Adam: No. That, I think is normal. What I think is strange is that when I start counting elements, like in an array that I start counting them at zero.
Don: Right. Because the index starts at zero.
Krystal: But it doesn’t have to.
Adam: Yeah. I mean, if you’re in Lua or MATLAB or some old version of Visual Basic, it might start at one. But in almost every programming language, you start counting at zero. So that’s strange, right? Why is that?
Krystal: Because computers are evil.
Adam: If you’re a professional computer programmer, you just know and if you want to get the index into an array, you start at zero. And you probably don’t know why. But if you’re a C programmer or a C++ programmer or something, you probably know why there’s zero based indexes because it makes sense there. But it has strange repercussions.
Krystal: Oh no. It feels like they’re just copied because hey, the C guy is wearing polka dots. We should wear polka dots too.
Adam: It’s the same as the C people copying the Fortran people to use i, for their for loop. You expect as a programmer, that things will start at zero. That’s just the way things work.
The Index Is the Offset
Don: It probably has to do with memory.
Adam: Say that again?
Don: So it would have to do with memory because an array would be stored in memory. So if you were going to be iterating through an array, you were really just iterating through memory. So you’d have to start at zero because that would be the first block of memory.
Adam: The short form way to communicate this is to say that the index is an offset. So you have a pointer to where your stuff is in memory, and the index is actually how far you move from that.
Don: And in the first element you don’t want to offset, so it’s zero.
Krystal: Yeah. Especially for a FAANG LeetCode interview.
Yeah. It makes sense if you understand this history. If you have this array like that, and you go to write your for
i for loop, then you do for
i equals zero. You start at zero because you know that you want to get that first element with no offsets. And then so once you’ve started counting at zero, you start counting at zero everywhere. And so people who worked in languages with pointers, it’s obvious to them why this is the case because they understand how memory works. And then they move on to work in other programming languages.
And of course, they probably build the compilers and runtimes for these other languages. And so they just carry this idea forward. And so then just everybody does it this way.
And because humans are pattern based. If you made a language that looks vaguely like C with curly braces and stuff, the first thing an experienced programmer are going to do is type up for I equals zero, blah, blah, blah, blah, blah. And if that doesn’t work, they’re going to be like, this shit is broken. What’s wrong with your language. Why don’t you count at zero, like normal people? Meanwhile, we’ve all just got Stockholm syndrome, not realizing that’s not natural to somebody who doesn’t understand pointers, to think that you would start counting at zero.
Krystal: But people get used to new things. Basically, Don’s not favorite company in the whole world, they change things all the time like the UVC and the lightning port or whatever stuff.
Don: That’s out of corporate greed. They want to have a proprietary interface so that it’s proprietary or else they would use an open standard.
ADA Speed vs. JS Speed
Adam: The track record is the thing. Because it’s like when you evolve, you slightly change something only with very specific purposes. It’s a lot safer. Like you’re not going to find some 10x better way to program by slightly improving on what exists. But, there’s a huge risk in changing all the things. You can go into your PR on GitHub and explain:
listen, 80 lines is based on IBM punch-cards. They’re gone. So I’m not using that. for i, the i comes from Fortran, gone. Everything starts with for Adam. I’m not going to count from zero, counting from zero comes from pointers. We don’t have any pointers, so I’m going to start counting at seven.
Nobody will understand what’s going on. It will be a very revolutionary approach to throw a lot of the old, some of which is bad, but a lot of the stuff is still around because it’s been validated and it works.
So this whole thing makes me think of houses. There are people who complain that they don’t build houses as well as they used to. There’s one house in Peterborough called Huntington house, and I guarantee if I walk by it with my friend Sam, whose house is old, by the way, so he’s not unbiased in this, but he’ll say like, “Oh, bet you your house won’t last as long as this house”, which is like from the 1800s. Well, that’s probably true, but it’s also the only house of that age that’s still around. There’s lots of crappy build houses from the 1800s that aren’t around.
Don: And who knows how much modernization renovations have been done to it over the years? I can’t imagine that they’ve got all knob and tube wiring and galvanized pipes. They would’ve had to do a whole bunch of restoration work on the inside that you don’t see.
Adam: Yeah. That house in Peterborough, it still exists, but lots of other houses didn’t, and there’s a million things about punch-card programming that they threw out. Almost everything, almost all of it is gone. The things that are left behind out of that, they’re the things that work. The reason that the people in C kept the 80 character limit wasn’t to do with punch-cards. Originally, they had small terminals that only supported 80 characters, but also people aren’t very good at reading super wide lines2. That’s why magazines have columns. The 80 started arbitrary, but the fact that it stayed means something. If all of these people before you saw that it wasn’t a problem and decided not to throw it out, that has weight. We threw out almost everything about how Fortran declares variables, unless you’re working in Fortran. But we left that i because whatever, it makes sense and mathematicians already used I and you probably took a math class and had vectors. It was arbitrary, but the fact that we’re still using it means that it might have been a useful standard.
Krystal: But i is imaginary in math.
Adam: Yeah. So you’re always looping through imaginary numbers. To bring it all the way back, the fact that some communities have kept this limit of 80 characters, it doesn’t mean that they’re dumb and stuck in the punch-card era. It means that probably, there was other benefits, the chief of which being everybody on the team had the same width. If you set up some complicated thing, I have my monitor sideways and Don has three columns on his screen. We all know as long as we have room for 80, whatever weird format we want works.
Krystal: Well, I still think it’s important to push back. So my kind of worry, generally, is that people get so stuck into thinking that this is the only way because nobody’s pushing back against that when people are learning programming, maybe they should have like the i telling people I is an integer, just so that people don’t get used to doing the thing where they repeats what everybody says for its own sake, but understanding the trade offs and with an understanding of why certain choices are made. I would be interested to know anybody who ever made a programming language that deliberately tried to push the limits of the whole 80 character limit. That would be interesting.
Adam: I propose a new language in which in every file, the limit starts at the top line, you can be 240 characters long. And it decreases by one every line so that the 240th line, all you can put is a closing brace. Before that you get two braces and so on …
Anyway … Krystal, being more of the academic bent is ‘we need to experiment more. Let’s not be constrained here, folks’. And Don and I, who probably spend a lot more time just working on a team, we’re more concerned with the team dynamics. And I think that that breakdown is probably about right. You shouldn’t at hand throw aside these old traditions, you should think carefully about it.
This is a weird position for me to take. I feel like I’ve changed in some way. You’re a different man. Like you guys are going to give me a talk? You’ve changed. We don’t like it
Krystal: mass unsubscribe.
Adam: I feel like in this case, you can innovate within constraints, right?
Krystal: Yeah. But you work at some organizations where they’re too square and it’s just not fun. I feel like the whole point of people who became interested in software engineering’s like, maybe you’re programming a game or artwork or architecture or something. And when you kind of take all of that away and it just becomes a whole follow the rules thing, it can get pretty boring and pretty depressing pretty quickly. There’s this should still be that weirdness budget, like a little bit of room for play.
gofmt and Standards
Adam: So I used to do a lot of Scala development, but now I’m working in Go. One of Go’s innovations is Go format. Go has a command, and it formats your code to a very specific standard. And it’s basically the standard for all Go code. This is what Go code looks like. There’s no arguments, right? There’s no tabs versus spaces fights. Go format picked tabs – controversial choice, but that’s what it picked. So there’s no arguments.
Don: I bet you there’s people complaining about it though.
Adam: So this idea, I think, spread to other programming communities. Stop fighting about code layout, whatever. Just choose something. There’s value in the uniformity. When I was on a Scala team, putting code formatters in was like a big boost because we could stop just arguing about it. Go, they threw their hat down, I guess, on standardization, but they refused to tackle line length.
Don: Line length, we can’t touch it.
Adam: I think they’re wrong. They took a stance on tabs versus spaces. But they were afraid to touch line length, but they should have. So Rust took a stance on this. So Rust has Rust format and they enforce a line length of 99 characters. They said 99 characters, it is. Why 99? Because they thought 80 was too small. If you set your IDE so it has columns of code that are a hundred wide each, you can always display 99. And then if you have to look at a diff with the extra pluses and minuses, then it still fits. So all Rust code, unless you put a special exception in the rule, has that line length.
Adam: It’s arbitrary, but it’s an idiom. And if you read Rust code, you just expect things to be that long.
Krystal: And people learn. I feel like when you sneak in in new idioms, people over time can learn to use them.
Adam: Yeah, totally.
When To Innovate
Adam: If you’re building a database in your spare time, make it a graph database. Nevermind tables. If you’re building your own programming language for fun, don’t allow variables named I at all. Just get rid of it. Try new things, right? Try 0.5. indexing. Don’t feel constrained by history. But if you’re working on a team or as a group, or you want humans in this timeline of the multiverse to be able to understand your code, then you need to understand the history and embrace the constraints.
In the midst of all this 80 character argument, on Lobste.rs, I found this guy who had a good take on it.
When a city wants to set a speed limit on a new road, they first measure the speed at which the cars are driving and they set the speed to the 85th percentile. Perhaps instead of throwing out numbers, one should measure the line lengths of source code in question and set the width appropriately
He’s saying, Don, if nobody goes over 120, set your limit 120. And then somebody else also said:
I found that something like wrap between 80 and 101 weren’t feasible and maintain a hard limit of 120 characters is a reasonable compromise and will work well for most people.
I think this is one of those personal issues where people will never agree. I think the most important issue is not so much what is better. That’s a very personal issue, which depends on your priorities, but rather what works best for everyone on the team and then stick with what works for the team.
Krystal: I like that.
Don: Yeah. That’s a reasonable answer.
Krystal: Hire that guy.
Adam: Yeah. So thank you to Don and Krystal for joining me. You can find them both on Twitter and on the Slack channel for this podcast.
And I’ve put all the links on the webpage for the episode, if you want to dig in more. And if you’ve made it this far and you want more content, sign up for the monthly newsletter. I’ll be sending out something special in the newsletter soon. And you can follow me on Twitter at Adam Gordon Bell.
But most importantly, if you want me to keep producing more episodes, support me on Patreon. If you go to corecursive.com/supporters, it will take you there.
And also, let me know on Twitter or Hacker News or wherever this episode shows up, what do you think of the 80 character limit argument. Did we resolve it? I think we did. Or at least we beat it to death, which must count for something.
And until next time. Thank you so much for listening.
Correction: This turns out to not be the case. C.S. Lewis was inspired by the writing of G.K. Chesterson, but read them in the 1900s. ↩
It’s only been studied in prose reading, but line lengths of 50-70 words were found to be the most readable. Code is probably read differently, but this is the closest thing to a study we have. ↩