See a typo? Have a suggestion? Edit this page on Github
I’ve been wanting to give my eldest child (Eliezer, now 10) a chance to learn to code for about a year now, with little success. My second child (Gavriella, now 8) is also ready to start learning some coding. “Ready” to me means “they have a decent enough grasp of written English.” (Yakov, my 6 year old, also wants in, but unfortunately is going to have to wait a bit.)
I know how I learned to code: sitting at a DOS prompt since the age of 2 and reading a massive “Teach Yourself QBasic in 21 Days” book. For various reasons, this doesn’t seem to apply to the next generation. I’ve looked into other modern approaches, including the graphical programming environments. My kids enjoyed some of this, but this week told me that “it’s fun, but we’re not learning anything.”
Previously, I tried teaching Eliezer some Haskell by writing up lessons for him. Whether because of my writing or his interest, it didn’t work at the time. I decided to not go down this path again, and an hour ago sat down with Eliezer and Gavriella for their first lesson. I’m winging this completely, but here’s the approach I’m taking:
This is the first of these summary blog posts. Caveats:
I considered making these private notes for myself instead, but thought some others may be interested, so I’m posting publicly.
Without further ado!
hello-world.pyfile and demonstrated you could write the same stuff from the REPL in a file.
This was the point where Eliezer commented that it looked a lot like the Haskell he’d seen. I’m not sure what it was, but somehow it clicked with him that whatever scared him off of Haskell previously wasn’t a real issue. We decided together to switch over to learning Haskell instead, which I’m quite happy about (more because I know the language better than anything else).
2 + 3 + 4was, they got that
2 * 3 + 4was, they got that too
2 + 3 * 4, and I was surprised to find out that they knew about order of operations already. Yay school system.
(2 + 3) * 4.
print 2 + 3. They had some inkling that this wouldn’t work, but couldn’t be sure of why.
Int, and defaulting to
Num a => a, blah blah blah, this is fine for first lesson)
print 2 + 3because of order of operations (just like math) really is
(print 2) + 3, what does that mean?
fart = print "Sorry, I farted"lots of giggling. What is the type of fart? Is it a number? No. Is it a dog? No. It’s something that you do, or the computer does. That’s what an action is. (Gavriella translated some words into Hebrew at that point, and the ideas clicked. Got to remember: they’re learning both programming languages and how to learn things in English at the same time.)
print 2 + 3doesn’t make sense!
print (2 + 3).
Note: Somewhere above, I briefly showed them that you could use
notation and put multiple
I started them off with:
main = do | -- prompt started here
They both got the answer, one of them with a bit of help:
main = do print "2+3+4" print (2+3+4)
Things to note:
print "Hello World"resulted in output that kept the double quotes. I’ll have to explain at some point about
putStrLn, but that can come much, much later.
I don’t want to plan out what to cover next time too intricately, because I want to experiment with them and bounce things around. I’m thinking about showing them how to create their own functions, maybe with lambda syntax, not sure.