News for hackers. Stuff that matters.
Re:Khan Academy: Computer Science by pjscott on Tuesday November 01, 2011 @06:24PM (#3184428)
In my head, I reserve the word "let" for immutable bindings. Or at least local bindings that people probably aren't going to mutate. I read it as "x equals five".

So, between three of us, we saw that simple line of code in three different ways. I wonder what other people see in more complicated code.

Re:Khan Academy: Computer Science by jcampbell1 on Wednesday November 02, 2011 @01:29AM (#3185573)
The point is that if you pronounce if(x=5) and if(x==5) both as "if x equals 5", then you are making things confusing for students. You as the teacher are saying the exact same words, but mean two completely different things. Kahn made this mistake and there are student comments showing the confusion.

Not correctly understanding assignment is one of the biggest failure points for beginners learning programming. The '=' operator has little relation to '=' in any form the students have encountered before. It means something like "evaluate the shit on the right hand side, and store it in a variable with the name on the left hand side". That meaning is not really even close to the meaning of the english word "equals".

You can personally call it whatever you want, but if you want to be a good teacher to beginning programmers, then you don't call both = and == the same thing. "x gets 5", "set x to 5" or "x is now 5" are all acceptable, but "x equals 5" is not acceptable for teaching purposes.

Re:Khan Academy: Computer Science by loup-vaillant on Wednesday November 02, 2011 @04:54AM (#3185880)
I note that the biggest mistake probably comes from C itself. If only it had chosen for assignment a syntax such as :

  x <- 5;
It would be more clear that "the shit on the right" goes to that garbage on the left. But no, they had to use the `=` sign, as if saving one character where more important than not changing the meaning of one of the most used sign of all mathematics. And now nearly all popular language is making the same damn mistake.
Re:Khan Academy: Computer Science by llimllib on Wednesday November 02, 2011 @02:37PM (#3188269)
The only thing I liked about PL/SQL back in the day was its use of := for assignment and = for equivalence.
Re:Khan Academy: Computer Science by pjscott on Wednesday November 02, 2011 @03:48PM (#3188630)
I pronounce "==" as "equalsequals", sort of slurring the two words together for speed, so they sound like all one word. This is consistent with the way I treat the bitwise-versus-boolean operator confusion, e.g. "&" is "and" while "&&" is "andand".

I agree with your main point, though, that failure to understand assignment is one of the biggest failure points for beginners. What programmers need to be able to do is trace through the execution of a program in their head, thinking "once this statement executes, the state will change in so-and-such way."

If I had to teach introductory programming again, I would focus more on having people fiddle around with variables in a REPL, just to get a feel for that sort of thing.