Hacker News new | past | comments | ask | show | jobs | submit login

Except it's not! If it is, you need to make text much bigger. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2016788/

If readability of lower-case was the issue we would write all variable and function names in upper case, even in languages that have lower-case keywords.




Remember that this stuff was designed in the era when dumb terminals and early PCs had text-only displays which were incapable of showing more than one character size or one colour.

Secondly, upper-casing some parts is not about global readability; it's about contrasting code on monochrome displays.

The PARTS IN CAPITALS are the parts the language (compiler or whatever) defines and must have spelled exactly that way. The parts in lowercase are the names, symbols etc. that the programmer defines rather than the compiler or OS.

Personally that is how I learned and even now, some 40 years later, I find that C-style everything in lower case is MUCH less readable for me than mixed CAPS and minuscule.


I get why they did it back then (when only uppercase is available, of course you'll use uppercase). I also get why it's something people learn by imitation and then never question.

I'm just wondering what the utility is today for people who have questioned it but decided to go with uppercase for parts of the code anyway.

As someone else said, if one is prone to confusing keywords with identifiers, syntax highlighting has existed for many years now, and solves that problem MORE elegantly than INTERSPERSING a few SHOUTED words in the CODE.


Why should my personal preferences change just because technological trends change?

I am not a programmer, but in the last decade I worked for 2 of the biggest Linux vendors writing documentation in DocBook XML. Both companies followed the "docs as code" approach so we used programmers' editors, programmers' version control systems, etc.

I don't really want multicoloured code. I find that visually intrusive. I prefer fewer colours in my UI, not more. I find editors that indicate syntax with colour to be loud, irritating, and annoying.

I find the simple traditional look of black on white, as humans have been using for text for millennia, and capitals for keywords and minuscule for the human-written parts, easier on the eyes and brain.

I am not telling you that you should use it. I am not telling you that your preferences are wrong. I am just telling you that yours don't match mine and I prefer mine.

You seem to feel that my preferences are wrong and I am wrong and want to tell me that.


If your preference were applied to typography, books would look like this:

IT WAS A dark AND stormy night; THE rain fell IN torrents, except AT occasional intervals, WHEN IT WAS checked BY A violent gust OF wind WHICH swept UP THE streets (FOR IT IS IN London THAT OUR scene lies), rattling along THE house-tops, AND fiercely agitating THE scanty flame OF THE lamps that struggled AGAINST THE darkness. THROUGH one OF THE obscurest quarters OF London, AND among haunts little loved BY THE gentlemen OF THE police, A man, evidently OF THE lowest orders, WAS wending HIS solitary way. HE stopped twice OR thrice AT different shops AND houses OF A description correspondent WITH THE appearance OF THE quartier IN WHICH THEY WERE situated, AND tended inquiry FOR SOME article OR ANOTHER WHICH DID NOT seem easily TO BE met WITH.

(The verbs be and do get capitalized in all their conjugations, because they have special roles in the grammar, making them keywords.)

If typography for prose were like this, people would be used to reading it, and more code in more programming languages would look like that.

The on the other hand, people have experimented with syntax coloring for parts of speech. That actually looks quite bad and detracts from readability; yet lots of coding is done that way.

Code is laid out in certain two dimensional ways that prose is not, and the keywords that get emphasized (whether through CAPS or color or both) occur in certain predictable visual structures rather than as soup ingredients in a wall of text.

Formatting of and typography of prose are not absolutely linked.


No, absolutely not.

You are trying to apply your personal preferences, which are the trendy ones, as if they were absolute rules. They aren't.

(This is highly offensive, BTW.)

Also, I don't think you have read much 17-18th century literature, because people did do things similar to that... much as German still today capitalises all Nouns, English too put a capital Letter on all Nouns in the Language just a few Centuries ago.


The important thing is, the style needs to be consistent over the whole codebase. If most of the SQL has uppercase keywords, a small portion that does not will be harder to read.

I dislike the PEP8 style for python, but I use it anyways, mostly.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: