ALL CAPS SQL
A while ago I read The Mac Is Not a Typewriter by Robin Williams. In it, the author claims:
> Many studies have shown that all caps are much harder to read. We recognize words not only by their letter groups, but also by their shapes, sometimes called the “coastline." –pg. 31, The Mac Is Not a Typewriter
I’ve found this to be true. When we teach SQL, students are often surprised that we don’t capitalize PostgreSQL keywords, preferring this:
select * from posts limit 5;
To this, which you might see in an SQL textbook:
SELECT * FROM posts LIMIT 5;
My arguments against the latter syntax: it’s practically redundant in PostgreSQL, it’s harder to type, and it’s unnecessary because any good text editor highlights the keywords. Now I have another: such writing has been, in typesetting, shown to be harder to read. WHERE
and LIMIT
look similar from a distance in all-caps, but they mean and do different things.
It’s a style opinion each developer gets to refine for themselves. To quote Williams: “Be able to justify the choice."
Tweet