lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 06/06/17 20:15, Ross Berteig wrote:
I've had my head stuffed in a book design task (using LuaLaTeX) recently. There really is good rational from book design for shorter line lengths based on studies of readability of running text. Printers (the people who handle lead type and spill ink on things) have known this intuitively about as long as moveable type has existed. The rule of thumb is that lines of print should be perhaps 45 to 75 characters long to avoid tracking to the wrong line as one reads. Mitigating that in code, you have the varying indentation, but generally keeping the ink to 66 characters more or less is likely easier on the reader.

I read code very differently than books, so I don't think that rationale translates well. Wen reading book one reads "horizontally", in the sense that you don't go to the next line until you've reached the end of the current.

In code, there's both horizontal and vertical reading. It's pretty common to read a piece of code only reading the first word/few words across multiple lines. For example, just reading the names of the functions being called, the variables being updated, or how the iterators are nested, and only caring about their order and not the exact parameters (they're obvious) nor the assigned expressions (you do not understand them anyway :)). This kind of "vertical" reading can be repeated once and again until I understand what's going on.

So, the vertical structure is at least as important, probably more, as the horizontal. I usually will gladly compromise on the horizontal legibility for the sake of the vertical one, because I spend a lot of time scrolling trough code.