9 ms·
For the standard library and such that train has left the station... way too much legacy code and learned knowledge. As to why it happened in the first place:
by Tactic 8y ago
For the standard library and such that train has left the station... way too much legacy code and learned knowledge.
As to why it happened in the first place: it is from an era when some compilers only looked at the first 8 characters for uniqueness of a name. Toss on top of that that a screen was only 80 characters wide and short names made a lot sense.
Now it is just tradition, I feel, more than anything else.
- Sohcahtoa82 8y ago> Toss on top of that that a screen was only 80 characters wide There are still developers that insist on code only ever being 80 characters wide, even in today's world of 24+ inch, 1920x1080+ monitors. I understand wanting code to be narrow enough to be able to have diffs side-by-side, but you can get 120-character wide lines and still achieve that. I've seen others argue that if a line is too long, it's harder to understand what it's doing, and I would agree with that with one caveat: In this context, "line length" should be understood as the number of operations being done, not necessarily absolute number of characters. A line that is 110 characters long but has meaningful variable and function names is going to be easier to grok than a line with only 60 characters but has terse names.
- davemp 8y ago> There are still developers that insist on code only ever being 80 characters wide, even in today's world of 24+ inch, 1920x1080+ monitors. Resolution is largely irrelevant. The size of the font and screen size/distance is what matters for readability. Think in terms of books that are pleasent to read. If the lines are too long it’s easy for some to lose track of where they are. If the font is too small people with poor eyesight will have trouble reading anything. Character limit is an accessibility issue. I am personally limited to ~80 characters for my use case. Though the issue is largely irrelevant for people who are know of therecent AST aware formatting tools that can limit lines to whatever length you’d like.
- yongjik 8y agoI'm one of those dinosaurs who prefer 80 character limit, thank you. I have a 24-inch monitor, and I like seeing three different files, a terminal output, and a stackoverflow page on Chrome, preferably at the same time. Regarding variable names, it's a matter of taste, but for example: NumberOfDocumentsProcessed += MaybeFindUpdatedDocuments(ClientPool->GetClient(NextClientIndex++)); n_docs += find_updated_docs(cli_pool->get(next_cli_idx++)); I find the second line much more pleasant to read, especially if these variable names repeat several times in a function, which they usually do. The problem with long lines is that the style inevitably drifts toward the first example, because nobody can say no to "Can we make the names more descriptive?" With 80-character limit there's a certain friction that acts as a counterbalance.