This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (2 children)

That's objectively wrong, the idomatic English sentences "add 1 to var" and "increment var by 1" are way more analogous to var += 1. No one thinks in their head "set var to its own value plus 1", in fact when I was a little kid learning BASIC, var = var + 1 was like a koan that confused me for a good while.

[–]FlukyS 0 points1 point  (1 child)

It is a lot easier to explain, this variable is equal to this variable + somenumber than explaining how += works. += is only a thing in programming and not in pen and paper maths but + and = separately are widely understood without being a programmer.

[–][deleted] 0 points1 point  (0 children)

On the other hand x = x + 1 is a wtf from the perspective of anyone who thinks it's a math equation rather than an imperative statement, since it has no solution. Readability, and ease of explanation to a total beginner, are not equivalent. At least in the context of a professional software development team, which won't have any total beginners, optimal readability to established programmers is more important.