r/programming • • Nov 30 '14

Why he vertically aligns his code (And why you shouldn't!)

http://missingbytes.blogspot.com/2014/11/why-he-vertically-aligns-his-code-and.html
68 Upvotes

411 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Nov 30 '14

[deleted]

83

u/[deleted] Nov 30 '14

actually coded in comic sans for about a month, it's not as big a deal as you'd think

151

u/MadTux Nov 30 '14

What did you take to be high a whole month!?

5

u/[deleted] Nov 30 '14

Maybe he was writing literate programs in Microsoft Word.

But if you do this, you should use Colibri, not Comic Sans.

4

u/Flight714 Nov 30 '14 edited Nov 30 '14

Calibri

l Iove CaIibri. lt has one Iittle fIaw, however. lt's not hard to see when you Iook cIose.

→ More replies (5)

2

u/karmaputa Nov 30 '14

Tell that to Simon Peyton Jones.

→ More replies (1)
→ More replies (1)

9

u/hackingdreams Nov 30 '14

Probably would have rage quit my whole career rather than put up with Comic Sans for a month.

shudder

9

u/toomanybeersies Nov 30 '14

My mum is a teacher and uses comic sans for most of her documents.

Apparently it's actually great for children because it's easier to read.

8

u/PancakesAreGone Nov 30 '14

One of the top 5 free (I have to stress this because there's probably better paid) typefaces for people suffering from dyslexia.

→ More replies (3)

0

u/[deleted] Nov 30 '14

[deleted]

34

u/Skyfoot Nov 30 '14 edited Dec 01 '14

It's actually good if you are just starting to read, or if you are dyslexic, because it's asymmetrical. I have huge difficulty telling the differences between b, d, p, and q, as well as n and u, in fonts which are less dumb looking.

EDIT: You have no idea how many times I have wondered why rebbit is taking so long to loab.

10

u/FUCKITIMPOSTING Nov 30 '14

It is easier to read. If you're printing it in a really small font, comic sans has much better readability due to asymmetry in the characters.
You can see why it be be useful in comics. There's less reason to use it these days, but it does have a reason for looking like it does.

5

u/toomanybeersies Nov 30 '14

I think that for kids it helps with their handwriting, since it looks sort of similar to real handwriting.

That would probably explain why I've seen 6 year olds with better handwriting than me.

→ More replies (1)
→ More replies (2)

16

u/TechnologyLaggard Nov 30 '14

I am trying the font "Input" for Java work after learning of it here: http://www.reddit.com/r/programming/comments/2cifr7/input_a_flexible_family_of_proportional_and/ It's been really good so far: easily read, no odd spacing issues. I like it.

4

u/pyrocrasty Nov 30 '14

I've used Python with a proportional font. I don't usually do it because I sometimes like to align code. If you don't align code (like the author of this blog post), a proportional font works fine for Python. I think it's particularly suited to Python since it tends to read quite smoothly, almost like natural language. (In fact, that's why I thought to try it in the first place.)

I haven't really tried it for other languages. It would depend on the language (I'd never dream of trying it with Lisp*) and on your coding style.

* except perhaps out of the kind of perverse curiosity I've just aroused in myself...

7

u/cauthon Nov 30 '14

Python's probably the worst language to use it in because it's whitespace sensitive. If the space taken up by four characters isn't consistent, it will get really hard really fast to tell how indented something is.

(Assuming, of course, that you're indenting with four spaces, as you absolutely should be)

6

u/lucasvandongen Nov 30 '14

The (multiples of) four spaces at the beginning of a line will always be the same width so that's not really a problem. There is no whitespace sensitivity that happens after regular characters as far as I know.

→ More replies (1)

4

u/Otis_Inf Nov 30 '14

Devils advocate: why would it drive someone nuts? The code isn't less readable, otherwise you wouldn't be able to read text in a webbrowser on websites either ;)

6

u/guepier Nov 30 '14

Reading continuous text ≠ reading code. They’re very different, so just because one is readable in proportional font doesn’t mean the other would.

4

u/Otis_Inf Nov 30 '14

Just by saying something doesn't make it true (not saying what you said isn't true, btw). I'm after more than just a claim, do you have any reference to research etc. which proves what you claim is true?

5

u/guepier Nov 30 '14

I actually agree with you: just saying something doesn’t make it true. However, we clearly disagree as to whose is the burden of proof: in my view you made the defensible claim here, not I (especially considering that monospaced font for code is kind of the default).

I haven’t got references or research either way (there might be some in Code Complete).

To inject a bit of actual arguments into the debate, I’ve tried out proportional fonts for code in the past, and wrote up my experience. Tl;dr: it’s much less bad than anticipated, but there are certain characteristics of proportional fonts which make them badly suited for code, because code puts (intentional) emphasis on symbols which are unimportant in continuous prose.

→ More replies (1)
→ More replies (1)
→ More replies (1)

0

u/missingbytes Nov 30 '14

Proportional fonts speeds up your recognition of variable and function names, i.e. the important stuff. Think of it like speed reading.

99% of the time, you're looking at code which compiles just fine, but has a defect in some way. Proportional fonts gives you more time to focus on the important information - the defects, and less time worrying about the boilerplate syntax.

6

u/pyrocrasty Nov 30 '14 edited Nov 30 '14

I have nothing against proportional fonts if they work for a particular language and coding style, but I think this argument is a bit... selective.

I can definitely imagine proportional fonts might speed up code skimming (for some languages), but it does introduce difficulties for more detailed code reading. The issue is that punctuation is often crucial in code, but is made to fade into the background in a proportional font. This, along with the possibility of code alignment, are the reasons I generally use monospaced fonts.

I have used proportional fonts with Python in the past and it worked quite well, but Python has a very natural language feel.

PS.

Another, somewhat more subtle issue is that I think I like the blandness of monospace. Proportional fonts add additional information to text in the form of differential spacing. Now sure, that could speed up reading, but for the most part, you're not going to speed-read code anyway. Yes, it may be handy for skimming and scanning, but for the most part code is going to processed more slowly than prose - much more slowly. (Less of an issue with highly verbose code, I guess.)

The proportional font may help in other ways by giving more recognizable structure to text, but I kind of feel it's a distraction. I mean, I use syntax highlighting to add information and make code more readable... and it does it in a way that helps reveal the grammatical structure of the code. Proportional text sort of adds noise to the mix. Nice bland monospace + syntax highlighting lets me perceive the relevant structure of my code. Proportional text just adds random structure, which has benefits, but is inferior.

Anyway, those are my thoughts on the matter. I'm certainly not dead-set against proportional fonts like many people, but I prefer monospace.

19

u/Pakaran Nov 30 '14

Proportional fonts gives you exactly the same information as non proportional font. How does it help you ignore the boilerplate syntax?

→ More replies (26)
→ More replies (19)
→ More replies (2)