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

I can just as well argue that long rambling variable names are unreadable, because they obscure the macro-level structure of the code and the continuous repetition creates extra cognitive load ("is this really the same variable as the other one? It looks like the first three words are the same, but...") especially when one tries to keep track of several of these huge names and follow the dataflow.

Also, left and bottom together refers to a point, not a side; so I would be doubly perplexed upon encountering such a name.




>I can just as well argue that long rambling variable names are unreadable, because they obscure the macro-level structure of the code and the continuous repetition creates extra cognitive load ("is this really the same variable as the other one? It looks like the first three words are the same, but...") especially when one tries to keep track of several of these huge names and follow the dataflow.

This problem you describe occurs in the english language. In formal documentation of code written in English tends to be by far more verbose in their explanation of code than the code itself.

Yet we don't complain about english? Why?

What if I take all the crazy shortcuts we use in programming names and use that in documentation and daily communication. Would it make my communication seem less like rambling and seem more clear? Would it help lessen the obscurity of the macro level structure of my point? Will removing the continuous use of grammatical repetition with words like "the" or "and" lessen the large cognitive load on your brain so you can understand my english?

No it likely won't. In fact it will make me LESS understandable.

The dichotomy here illustrates a bias within human nature. For some reason people perceive a certain level of verbosity in code to be bad but not so in english. Given the fact that even among programmers English is much more readable than code I would say that there is definitely a huge unrealized mass delusion going on here.

Have you heard of literate programming by donald knuth? It's literally about taking every line of code and upping the verbosity by 10x by replacing it with a macro of an english paragraph. Literally an extreme version of the verbose variable naming I'm describing.

If you can see validity in literate programming than basically my variable naming is a tiny tiny step in that direction.


> Yet we don't complain about english? Why?

I'm pretty sure now that you are a native English speaker. I am not and I do complain. But if one only knows one language then I can only quote Lutwid Wittgenstein: "The limits of my language mean the limits of my world". (he refers to thoughts)

> If you can see validity in literate programming than basically my variable naming is a tiny tiny step in that direction.

No need for that, because history has shown that people like English keywords, but that's about it. Just look at SQL - many people complain about the verbose syntax, which comes from trying to make it read like English "for business people" (who don't use it anyways). Check discussion here: https://news.ycombinator.com/item?id=24730713

But SQL is not a general purpose programming language - let's look at one of these: COBOL. It is literally what you want: programs look like text, which comes from trying to make it read like English "for business people" (who don't use it anyways). And guess what? No one who actually uses it really likes the syntax.

Maybe you should start with Mathematicians and ask them to stop naming their variables "x" or "f" and use English instead of symbols. How about that? :)


>I can only quote Lutwid Wittgenstein: "The limits of my language mean the limits of my world"

Except I don't see how a quotation proves anything or how this is relevant. First off is Lutwid correct? Can you think of things outside of language? Can you think in pictures? If so than I would say he's wrong.

Second off, what does this have to do with bad naming in a programming language? Nothing.

>No need for that, because history has shown that people like English keywords, but that's about it.

I'm not arguing for english or english keywords. I'm arguing for phrasing in naming things, this is exactly what literate programming is arguing for. I may have used the word "English" because HN is an english forum but you can easily replace that with "Any relevant language"

>Check discussion here: https://news.ycombinator.com/item?id=24730713

Check out my response to it here: https://news.ycombinator.com/item?id=24733487

The article is talking about composability not readability which is a separate problem. SQL is in fact quite a readable language. Many people can read a query and instantly derive meaning. Either way I am not talking about programming language syntax. I am talking about naming within the bounds of the syntax.

>let's look at one of these: COBOL. It is literally what you want: programs look like text, which comes from trying to make it read like English "for business people" (who don't use it anyways). And guess what? No one who actually uses it really likes the syntax.

It's not about whether or not the writer likes the syntax. Clearly program writers have a bias for elegance over readability. It's about whether someone can read your program and completely understand it in one pass. Clearly COBOL was first off, not guaranteed to be readable and second off had many many other issues outside of readability. Readability was definitely not the main issue with COBOL.

>Maybe you should start with Mathematicians and ask them to stop naming their variables "x" or "f" and use English instead of symbols. How about that? :)

All mathematicians are expected to write paragraphs in "English" or some other relevant language outside of equations. Many math papers and math books have more written english than equations.

Whenever a mathematician uses the letter "x" or "f" they define the meaning with an english phrase or paragraph. This is expected for clarity in math and in english but for some odd reason not expected for programmers. The mathematician can only get away with an "x" or an "f" because he has an accompanying english explanation defining those variables right next to the equations.

Programmers are like mathematicians writing conceptual papers using only equations and math symbols without the english explanations. We have the luxury to insert some english into the naming of primitives so we should take advantage of that lest all our programs devolve into primitives with single letter names.

Sure we can comment our code. But people tend not to do that to the degree that it's done to explain things in a mathematical research paper.


> It's about whether someone can read your program and completely understand it in one pass

That's not the only thing. It's also how fast they can read/understand the program code.

> All mathematicians are expected to write paragraphs in "English" or some other relevant language outside of equations.

Sure, we do that for software also - we document things outside of the code. For example in a wiki, a README.md or sometimes even just above the code as comment/docs. But that's not what I was talking about, right?

> Whenever a mathematician uses the letter "x" or "f" they define the meaning with an english phrase or paragraph.

So you are fine if a developer does e.g. `c := (some super complex expression) // find relevant customer` and then goes on to use just `c` everywhere in their code instead of `relevantCustomerBlaBlaBla`?

Also, mathematicians don't always do that. Sometimes they just say "let x be [insert complex equation]". See for yourself in https://en.wikipedia.org/wiki/Conformal_geometry or https://en.wikipedia.org/wiki/Riemann_surface

I'm sure your will find a lot of papers, books and articles where they do this.


>That's not the only thing. It's also how fast they can read/understand the program code.

What are you doing? Speed reading? Even 2xing the reading time with verbosity is not a factor if lack of verbosity forces the reader to switch context multiple times in order to elucidate meaning.

>Sure, we do that for software also - we document things outside of the code. For example in a wiki, a README.md or sometimes even just above the code as comment/docs. But that's not what I was talking about, right?

Major difference. In math it's required. In programming it's recommended and rarely done. When it is done, it's rarely done in a form that's as complete or as detailed as math. YOu get an outline at best. Programmers are expected to read code without documentation because program writers are too lazy to write documentation.

SO what I'm saying is put your documentation into the code itself. Self documenting code with readable names as opposed to elegant.

>So you are fine if a developer does e.g. `c := (some super complex expression) // find relevant customer` and then goes on to use just `c` everywhere in their code instead of `relevantCustomerBlaBlaBla`?

relevantCustomerMetric is way better than c everywhere. Autocomplete should alleviate the pain of typing. Not every programmer arrives at the variable where it was incepted so they can't see the comment.

>Also, mathematicians don't always do that. Sometimes they just say "let x be [insert complex equation]". See for yourself in https://en.wikipedia.org/wiki/Conformal_geometry or https://en.wikipedia.org/wiki/Riemann_surface

Isn't "let x be" english? What's the purpose of those words? Clarity.


> Isn't "let x be" english

How is `let x be ???` any different from `let x = ???`


"let" is still english. "let x =" is short for "let x equal"


Exactly - so why do you treat them different? Because programmers use "=" and mathematicians write "be"?


> The dichotomy here illustrates a bias within human nature. For some reason people perceive a certain level of verbosity in code to be bad but not so in english. Given the fact that even among programmers English is much more readable than code I would say that there is definitely a huge unrealized mass delusion going on here.

People definitely perceive overly verbose English as bad. "Legalese" is essentially a pejorative for verbose language, and advice like "never use a long word where a short one will do" is common.


No you misunderstood me. I'm saying the normal level of verbosity in english when applied to code is considered to be over verbose. I'm not even talking about areas where there is domain expertise. There's no need to spell out the meaning of the word decoherence in quantum mechanics for the language of english or python when communicating with domain experts. But in python someone tends to use the words

   decoAB = True
over

   decoherenceOfTwoParticlesAandB = True
but in English they use.

   The decoherence of two particles, particle A and particle B. 
and not.

   The deco of A B. 

It's opposite logic for what is essentially an attempt to communicate the same concept.

Two languages where different levels of verbosity are considered to be normal. For programming be less explicit, use shorter names that are prettier but less clear, for English be absolutely clear, use correct grammar.... Why? Why do we feel programming languages need to less verbose and the english language needs to have a higher level of verbosity to be normal?

Regardless of the why behind our biases, what is clear is that it is a bias because two conflicting levels of verbosity indicates irrationality.

When you analyze it logically, it's by far easier to read english than it is to read a programming language even by a programming expert. Therefore the verbosity level of english must be the level of verbosity that is baseline for humans to have the most clarity in a single read.

This means that in general variable names are not verbose enough in programming.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: