Summary: LispCast Introduction to Clojure teaches Clojure with an "interactive bakery simulation". Metaphors that you can embody are a great way to learn abstract things like programming.
In LispCast Introduction to Clojure, the video starts off with an introduction of the main character. He’s a robot named X5 who wants to learn to bake. Your job is to help him. He comes built in with some basic functions like grab, pour, and mix. It’s your job to build up the routines for baking cakes and cookies.
Starting at the REPL, you type in those commands and the environment changes. The bowl fills up with flour, eggs, and milk. You finally put the pan in the oven and it will tell you what comes out. Maybe you didn’t follow the recipe and it’s ruined. Maybe you made a nice cake.
The reason I did that is to engage your imagination as much as I could. It’s easy to imagine actions like pouring milk, scooping flour, and breaking eggs. Learning a new language has so many challenges. I wanted you, the learners, to be engaged in something you could intuitively get. And baking a cake is not only something you can imagine, but something you can imagine doing.
There’s a lot of research about learning something abstract by having a surrogate in that world. Seymour Papert’s Logo programming language is a classic example1. You learn to program by directing a turtle. The turtle isn’t just a cute triangle on the screen. It’s a visual representation that you can relate to and so use your own reasoning about space and movement to give it instructions. I wanted to tap into that same natural ability while learning Clojure.
Besides it being intuitive, the baking metaphor was great in other ways. Concepts like "add 1 egg" built out of "grab egg, squeeze egg (to crack it), add it to bowl" are a great lesson in abstraction. And a recipe is a nice metaphor for a function. The metaphors don’t end there, but you’ll have to follow the course to see them.
And I try to do that in everything I do. I use metaphors and the more intuitive the better. I really like physical metaphors that you can use your spatial intuition about. We’ve been learning to move since we were in the womb! It’s not always easy to find a good physical metaphor for a topic, but I usually find something. Visual metaphors are great, too.
I’m not talking about metaphors that "dumb down" the material. Some metaphors don’t work that well. In the weak metaphors, you can see a slight connection between the thing you’re learning and the thing in the metaphor. But once you try to apply the metaphor, it’s full of holes. The metaphor is overstretched.
The metaphors I look for are rock solid and really feel like something you can rely on until you develop your own experience. The metaphors in LispCast Introduction to Clojure are pretty good, from cracking eggs to building a recipe database. The biggest thing I regret is that I couldn’t make it more interactive and visual. It’s all done with text, either at the terminal or a text editor.
The richness of metaphors in LispCast Introduction to Clojure is one of the reasons I say that it’s the best way to learn Clojure for someone who has never programmed in Clojure before. It engages your imagination and your inherent desire to help a fellow robot in need. If you’d like to learn Clojure, Intro to Clojure is available as part of the PurelyFunctional.tv Online Mentoring program. And there’s plenty of material there to continue your Clojure journey. I hope to see you in the program. 🙂