News for hackers. Stuff that matters.
Re:The language brain matters more for learning programming ... by xigoi on Friday May 02, 2025 @03:56PM (#43874004)
Do you think mathematicians don’t have to think about naming variables and structuring proofs?
Re:The language brain matters more for learning programming ... by voidspark on Friday May 02, 2025 @04:02PM (#43874054)
Of course they do, but that part is not "mathematics". It is communication. If they use the English language to write the proof that doesn't mean English is also mathematics.
Re:The language brain matters more for learning programming ... by xigoi on Friday May 02, 2025 @04:04PM (#43874070)
Writing proofs is just as important to mathematics as writing code is to programming.
Re:The language brain matters more for learning programming ... by voidspark on Friday May 02, 2025 @04:07PM (#43874091)
Yes it is important but that's not the point.

Structuring sentences and naming variables so that it is easier for other people to understand is less about formal mathematical reasoning, and more about communication.

You could name a variable x, y, or Banana, but it doesn't change the logic.

Re:The language brain matters more for learning programming ... by godelski on Friday May 02, 2025 @06:01PM (#43874968)
Neither is it "the point" in programming. You should be concerned with communication and have every right to get upset when someone is being needlessly convoluted but that's as much of a point in programming as it is in math, physics, or any domain.

I mean the reason we get mad at this is because it is someone destroying "society" in some sense. Even if that society is your team or just the set of programmers. It would be a pretty dick move were I to just use a word that significantly diverged from conventional meaning and expected you to mull it over. Similarly if I drop a unknown out of context math equation. It would be meaningless.

And I'm on your side, really! I strongly advocate for documenting. And let's be real, the conclusion of your argument more strongly argues for documentation than good variable names. Because variable names are much more constrained and much more easily misinterpreted considering how any word has multiple definitions. Surrounding code is often insufficient to derive necessary contextualization.

https://news.ycombinator.com/item?id=43874738

Re:The language brain matters more for learning programming ... by QuercusMax on Friday May 02, 2025 @04:45PM (#43874403)
The presumably-mathematicians who wrote my Algorithms textbook (CLRS) didn't seem to think giving the variables in their algorithms useful names. They just use i, x, etc. all over the place and don't even consider giving things actual names. This makes the book much less accessible than it would be if they treated it more like most people write code.
Re:The language brain matters more for learning programming ... by godelski on Friday May 02, 2025 @05:24PM (#43874738)

  > They just use i, x, etc. all over the place
I do agree with your point btw, but I did want to note that there are good conventions around symbols. The brevity is heavily influenced by the medium. Variable names sucked when you had punch cards. It's still burdensome to write long names when using paper, chalkboard, whiteboard, or any system that doesn't have autocomplete.

In general, lower case letters are used as constants, excluding x,y,z,t,i,j,k (sometimes u,v,w). It isn't a hard rule, but strong preference to begin at the beginning of the alphabet for these. Capital letters usually are held for things like Variable Sets (like random variables). Greek letters need context for constants or variables. BB and Cal typefaces for sets (e.g. Real Numbers, Integers). And much more.

I think a lot of the difficulty in it is that these "rules" or patterns are generally learned through usage and often not explicitly stated. But learning them can really help read unfamiliar topics and is why "notation abuse" leads to confusion. But after all, math is all about abstraction so technically any symbol will do, but no doubt some are (significantly) better than others for communicating.

  There are two hard things in Computer Science:
    - Cache Invalidation
    - Naming Things
    - Off-by-One Errors
Re:The language brain matters more for learning programming ... by drdeca on Friday May 02, 2025 @05:21PM (#43874716)
Picking what letters to use for what things can still be a struggle.

Mathematicians do have to deal with difficulties in naming things.

Re:The language brain matters more for learning programming ... by GoblinSlayer on Saturday May 03, 2025 @10:50AM (#43879404)
They just invent new characters.
Re:The language brain matters more for learning programming ... by xigoi on Saturday May 03, 2025 @03:10PM (#43881342)
What do you mean? Most letters used in math are just Latin and Greek letters in different fonts or stylizations.
Re:The language brain matters more for learning programming ... by voidspark on Friday May 02, 2025 @04:50PM (#43874448)
That's how it is in applied mathematics. That's a hardcore computer science textbook. If your job is computer science research, inventing new algorithms, that is the kind of book you will get used to. There are better options for practical learning.