An Approach to Motivating Coding

Posted

One of the many challenges when teaching programming to adults is to find motivating examples. There’s not a lot people do in real life that you can do in five or ten lines of Python, and the things you can do (like Scratch-style graphics) aren’t things most people with jobs and families have time to care about.

Data analysis is an exception. I’m increasingly convinced that analytics-first is the best way to convince most adults that lessons will pay off, but R and Python both have unfortunate quirks. Tidyblocks was an attempt to build something Scratch-like as a bridge between spreadsheets and textual coding, but foundered on the inability of click-together blocks to express joins (and on the fact that nobody would fund further work). I’m now wondering whether some combination of click-together blocks and block-and-connector dataflow would work better, and whether we could use the question, “How does a spreadsheet work?” as a running example. A possible teaching sequence would be:

example

I know this isn’t how spreadsheets actually work (mumble mumble observer/observable, mumble mumble), but what I don’t know is if anyone has ever used calculations on columns to motivate basic programming for adult learners? I think it would be easy to extend this: for example, the next step could be “how to create a function that operates on an arbitrary column”, which opens up all sorts of interesting learning possibilities. If anyone has done this, I’d be very grateful for pointers.