"Gofmt's style is no one's favorite, yet gofmt is everyone's favorite."
We need more of the same, I really wish C# had a similar opinionated tool I could use to bring dozens of company projects in line.
Something that can be run locally and in CI and has ZERO configuration, it just enforces a static style with no possibility of bikeshedding.
[0]: https://journal.stuffwithstuff.com/2015/09/08/the-hardest-pr...
I'd go for the opposite. Find a highly configurable formatting tool and standardize on a particular configuration for code in your repo, and enforce this format when code is checked in.
Provide some scripts or wrappers or hooks (whatever is best for the source code control system you are using) that can on checkout automatically run that formatting tool but with a configuration supplied by the user instead of company standard configuration.
With a tool like black, taking it into use is a binary selection of yes/no.
Just fiddling with an .editorconfig (https://editorconfig.org) setup for a single project can take WEEKS to decide what bits to flip in which position
Nit: to whit
EDIT: nit: to wit
> Traditional line length research, limited to print-based text, gave a variety of results, but generally for printed text it is widely accepted that line lengths fall between 45 and 75 characters per line (cpl), though the ideal is 66 cpl (including letters and spaces).[1] For conventional books line lengths tend to be 30 times the size of the type, but between 20 and 40 times is considered acceptable (i.e., 30 × 10pt font = 300 pt line).[1]
* https://en.wikipedia.org/wiki/Line_length#Printed_text
There's a section of "electronic text" as well which goes into some factors (flicker, glare), but the number doesn't seem to change that much.
LaTeX defaults to that, but Plain TeX defaults to 10pt font with 1in margins, which is ~100 characters per line (which much too long to be readable).
The blog referenced in the article as "extremely, almost unreadably bad" clocks in at ~300 characters per line, with the classic wall of text appearance which makes it very tiring to read.
I wonder if technical density affects optimal line length.
\typeout{xlvchars is \the\xlvchars; lxvchars is \the\lxvchars}Although I would recommend focusing at least one level higher than :vsplit, either at the terminal multiplexerv level or the (tiling) window manager level. Otherwise you end up wanting to run a shell in your editor... And what do you think this is, emacs?
My mainframe indoctrination there.
In terms of screen reading width, there's some sweet spot where characters per screen "page" and characters per line are easily readable without the text being "big". I need to be able to move my eyes left to right without losing track of my vertical position on the page.
Wrapping at 88 in java code, where I have method names almost that long, would use too much vertical space and lead to constant scrolling.
This may be an issue with the information density of java code, absolutely, but I don't want ordinary-length functions disappearing off down the screen.
YMMV.
When I write JS or Python, In getting along with 80 no problem.
But when I do TS or Java, the annotations can stretch lines quite a bit.
This article includes a throwaway link to the wikipedia page at the end of that quote. I recommend reading the relevant section (https://en.wikipedia.org/wiki/Line_length#Electronic_text), because it's pretty limited. There is really no way to tell if it (or Glyph) are accurately summarizing the research.
Overly long lines have a similar flaw - they compress too much information, so there's quite literally, no rhyme or reason.
So my approach is to have some sort of honor system: write something that you believe that will be readable to a variety of humans, where similar things are grouped together, and different things are laid out apart.
I do have a limit like 240, but that's more like a guardrail, not an invitation for every line to be that long.
Well yeah, this seems to be a bit of a straw man. Nobody is suggesting 200 characters. But 80 is definitely anaemic. I think 100 is quite low too, so it seems bold to say "maxing out at 100".
120 is the most comfortable I've found, striking a good balance between readability, excessive wrapping, and side-by-side viewing.
Most lines fit under 66. A lot more than 50%, even code written by other people. I'd say most lines also fit under 80, and very rarely do lines actually cross 120.
I wonder what it is that makes different people choose different limits.
> Big screens are super useful as they allow us to leverage our spatial memories to keep more relevant code around and simply glance around as we think, rather than navigate interactively. But it only works if you remember to do it.
I use a single, not especially large monitor, and have worked like that essentially since I first touched a computer as a child. (Granted, today's "not especially large" monitor is much larger than the ones on the "luggable" first-generation Macs.) This is... mostly because I'm a cheapskate, but also I feel like I'd have even more trouble focusing on stuff in general with one of those massive "battlestation" setups.
And I generally keep my code inside 80 columns because I just like the aesthetic of the terminal window, and because it's an extra impetus driving my refactoring.
And that's before we factor in all the nonsense IDEs like to clutter the screen with.
- easy to lay out multiple splits side by side. Over 100 tends to have issues.
- long variable names or function names tend to be a code smell. Same thing with too many parameters.
- git works much better at diffing and merging vertical lines than things on one long line.
The main downside is that monitors are wider than tall in general - so fitting more code on the screen is certainly nice! But I find moving my eyes and head up/down to be tiring over the course of the day and tend to use vim to keep things centered for myself anyways. zz, LSP search, go to definition, etc.
> Even before typewriters, consider the average newspaper: why do we call a regularly-occurring featured article in a newspaper a “column”? Because broadsheet papers were too wide to have only a single column; they would always be broken into multiple! Far more aggressive than 80 characters, columns in newspapers typically have 30 characters per line.
Yes because a newspaper has a frontpage and a fold, and you want to have many headlines on the frontpage above the fold, all with a size matching their importance.
llimos•5mo ago
matt_kantor•5mo ago