Hacker News new | ask | show | jobs
by Wyverald 3676 days ago
I think you missed his, though -- which was that any person with a high-school math background can easily grasp the concept of monoids with just a tiny bit of effort.
2 comments

I see what you mean, but what I meant is that either we get much better at explaining math or we exclude a good portion of our population from being able to program. If you respond with "all you need is high-school math plus more math in college" you're missing my point!

I'm not in any way anti-math.† Imagine that monads were a part of Scratch (the children's programming environment), and I was trying to explain them to my young daughter. If she couldn't get it should I say to her, "this is only high-school math plus a bit more, come on, don't use the fact that you're 11 as an excuse". The other day somebody pointed out that in Tufts they have shown that children as young as five can think computationally. This is the level I'm talking about. I'm talking about being able to teach programming to people who are normally (for whatever reason) math-phobic.

(† I took three years of 3rd-level math.)

Could you explain GoF's design patterns to your 11-year-old daughter? Reflection and metaprogramming? Heck, would she be able to understand why the concept of object identity matters for some types (say, any user-defined type in Java) but not others (say, integers)? Are you proposing that we ban those things too?
Re: GoF. Interesting. And GoF got their ideas from the influential philosophical works by Christopher Alexander on architecture didn't they? (Which I haven't read, maybe I should. Christopher Alexander I mean, not GoF) So I could talk to her about patterns _in general_, but could I then make the leap to object-oriented patterns? I don't know. Tricky. I remember several light-bulb aha moments going off when I read that work. It'd be amazing to try to instil that type of wonder in her.

Re: Reflection and metaprogramming. I guess you're suggesting teaching her some variant of Lisp? In the Coder Dojo I brought her too they/we were doing either HTML/CSS/JS or Scratch or Python. And all simple examples. I guess a version of reflection and metaprogramming exist in Python (I don't know off the cuff (I'm a Rubyist) but I presume so).

I had to Google object identity. Is this [http://www.cs.sfu.ca/CourseCentral/354/zaiane/material/notes...] what you mean?

> Re: Reflection and metaprogramming. I guess you're suggesting teaching her some variant of Lisp?

I wasn't talking about Lisp specifically. Many libraries and frameworks written in “mundane” languages like Python and Ruby make use of metaprogramming facilities to great effect. Now, you can't say with a straight face that monoids are scary but metaprogramming is not.

> I had to Google object identity.

In most object-oriented programming languages, every object has a unique identity, which is assigned when the object is constructed, and from then onwards can't be mutated. The uniqueness of these object identities can get in the way when you want to program with compound values, for example, the Java expression `new Point2D(2,3) == new Point2D(2,3)` evaluates to `false`, simply because the objects have different identities.

> Is this [http://www.cs.sfu.ca/CourseCentral/354/zaiane/material/notes...] what you mean?

Yes.

Or even without effort, since all programmers have used monoids all their lives! This situation is very much like knowing about Fido, Spikes and Bones, but lacking a word for “dog”, and thus being unable to talk about a dog without referring to a specific one.