Hacker News new | past | comments | ask | show | jobs | submit login
Even my grandmother got immutability (mrspeaker.net)
53 points by mrspeaker on Nov 28, 2011 | hide | past | favorite | 23 comments



Actually, what grandmother got was something different: the problem of overloading the "=" operator with variable setting. If you instead use, for example, arrows (as Knuth does in TAOCP) the problem goes away, and grandmother is no longer confused.


As much as I'd love to imbue his grandmother (and by extension all grandmothers) with innate understanding of some programming principle that some seem to have trouble with I'm afraid this event or at least the authors recounting of this event does not lead to that conclusion.

The grandmother may not have been having trouble with the immutability of X. Her question was not "how can X be anything other than X?" It was "How can X be X+1?". Which could convey the more likely case of the unlearned coder not understanding the order of operation in program flow. I'm sure she understood that X could be assigned a value, I'm sure she even understood that X could be changed--what she was having trouble with, most likely, was how could you use X on the right hand side of the equator? How can you define a value with the value itself (Circular reference). And I can totally relate--when I first learned programming it was something that confused myself at first as well. I hadn't learned that the right hand side of the equator gets evaluated with X being resolved to it's "present" value which is then used to calculate the value and finally stored back in the variable.

I hate to be a downer, it certainly is a fond memory, but the initial supposition is inconclusive.


There are a few quotes from college I'll never forget. One of them was by my chemistry professor who said, "I have a great deal of respect for the equal sign."

He put one student's homework on the screen. Instead of answering:

  A + B = C
  C + D = E
she took this shortcut:

  A + B = C + D = E
(Variables replaced for simplification.)

It was clear what she intended, but what she ended up with was a total fail.

Funny this post reminded me of a little incident and a great quote so many years ago. To this day, I still have a great deal of respect for the equal sign.

Thank you, Professor State...

http://sites.allegheny.edu/magazine/fallwinter-2003/best-abo...

http://www.memorialsolutions.com/sitemaker/sites/hathew0/obi...

EDIT: I just realized that Professor State's class was one of the few that actually helped me develop good work habits for life. I once wrote about that here on HN:

http://news.ycombinator.com/item?id=1544573


Grandmother parses code as X == X + 1. Hilarity ensues as her confusion of the misapplication of the equals sign from math is later mistakenly attributed to a grasp of immutability.


The article mentions that grandmother was possibly a teacher, and it seems reasonable for a schoolteacher to be confused by programming's "variable x" vs. algebra's "unknown x", in addition to the confusion of "assignment operator =".


Another grandmother gets thrown under the bus. Grandma as the archetype of computer ignorance is a played out plot device.


I've disliked that stereotype for a while.

My mother (who is 68) started off programming with punchcards when she was working on her Masters in Economics, she eventually moved into executive work but still kept up her chops with Basic and Fortran well into the 1990s. Nowadays, she uses VNC to telecommute into work every morning to avoid having to deal with traffic.

If I had married earlier and had kids as soon as some of my schoolmates did --and my kids did the same in turn-- she could have been the great-grandmother of 20+ year olds.

I think we should almost be to the point in computer history where age-based archetypes/stereotypes of computer ignorance can be safely retired.


Haha...you've got to be kidding!

Have you ever seen an old person drive?


but... in this story Grandma's the hero and the one that gets it, right? So this Grandma doesn't "get thrown under the bus".


Well, the author unknowingly does: his grandmother mistakes the assignment operator for the equivalence operator.


Actually, he points out his grandmother is well ahead of you fools since she has an intuitive understanding of immutable data structures and is distraught that one would modify state in-place like that.

In her head she probably thought, "hmm that's what the state monad is for" or something like "yeah that'll get you in trouble when you make your code multi-threaded".


Hardly a mistake only made by grandmas.


sounds like she might not have been confused if the bit to the right of the equals sign didn't contain an "X".

in other words, maybe it's not mutability that is confusing her.

...this isn't to say i'm not a huge fan of immutability :-)


I don't think is relates to immutability. This is an example of the "=" operator being overloaded for assignment.


I have to confess that I read this as his grandmother _acquiring_ immutability, the way, say, one might _get_ "+5 health" in a game.

Why you'd want an immutable grandmother, I'll never know.


Another nail in the coffin of the claim that imperative programming is more intuitive, persistently asserted without good evidence.

I submit that when people make claims of this sort, what they usually mean is actually "I'm used to doing it this way". Some actual studies of how new programmers learn would be valuable, and allow us to begin to evaluate claims like the above with at least a modicum of objectivity.


I don't think that referring to a single anecdote as a "nail in the coffin" of a position while complaining of the lack of "actual studies" in support of that position is terribly consistent.


The position I'm attacking is the claim that it's just obvious that imperative programming is more intuitive, not that it is more intuitive. By exhibiting counterexamples to this supposedly obvious assertion, it's shown that it is not in fact obvious. Whether imperative or declarative programming is in fact more intuitive is, of course, not something to be settled by the anecdote give in the link.


This is explored very well in Rich Hickey's 'Simple Made Easy' talk, check it out: http://www.infoq.com/presentations/Simple-Made-Easy


this isnt an issue with imperative programming, it's an issue with BASIC and the stupid way that computer scientists use math symbols


Sweat anecdote, however it has even less value than people realise.

If you want to explain an algorithm to Grandma, it's far easier to make her think at cookbook recipes -- X is a cup of sugar, now imagine that at every step you're adding one more cube of sugar to it.


Great example of "Involuntary Memory" : http://en.wikipedia.org/wiki/Involuntary_memory


Dijkstra's mother asked the very same question. The story can be found somewhere in the EWD archives[1].

[1] http://www.cs.utexas.edu/~EWD/




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

Search: