Creativity is a great motivator

14th of January, 2016
teaching, C/C++

After a few years teaching a beginners course, I realized that using creativity is a great motivator to learn programming. Even in a technical field like software engineering, even with logic-driven students, the desire to create and express oneself is stimulating and inspiring.

past: vim with code
past: vim with code

Many mornings I got up early to turn on the lights for the first semesters. Together we embarked on the journey to learn programming. In the past semesters, we used no additional tools. We wrote plain C, used the compiler directly and ran everything in the “black matrix” (terminal). We even used the text editor vim. Students learned everything from the ground up – with the most essential and basic tools. So, I saw students struggle:

past: text output as reward after a long exercise
past: text output as reward after a long exercise

They struggled with vim (did you know when you type hello in vim, you get nothing but an empty new line). They struggled with the compiler (overusing the tab key will overwrite all your source code, e.g. gcc prog.c -o prog.c). And obviously, they struggled with C. I gave it my very best to keep them engaged and to their credit, they stuck with it – even if yet another tiny mistake rose from the screen and hit them in the face. Eventually, we got over the hump and got excited about encrypting numbers, generating Fibonacci sequences and solved puzzles from Project Euler. But something was missing…

The birth of sketchbook

In preparation of the next semester I asked myself: How can I make programming more sexy? So, I curled up on the couch and browsed papers, course materials and looked at dedicated initiatives. I googled till dawn. I played with graphical approaches like Processing and Scratch again and got excited about them. I remembered that after a few students had asked me about graphics previously, I had played with a couple of C libraries. Yet, I could not in good conscience recommend any of them because they were too complicated.

today: code for sketchbook
today: code for sketchbook

So, there I was. I wanted something graphical and I had to teach the language C. But there were no existing (teaching) tools for that. Eventually, I realized that I had to move away from the bottom-up approach. I had to involve magic: Files had to appear out of thin air (using git). After typing out a spell, a lot of files had to be mixed together simultaneously (using make) and then without ever having heard anything about double buffering or event loops, a shiny new window had to appear in the black wall of the terminal.

That was a lot of change from one semester to another. It seemed like I had to change everything I had prepared previously. But I tried it anyway and a couple of hours of hunching over my laptop, I had the first version of sketchbook (Thanks Marco for the idea to simply call it “sketchbook”).

The first lecture

the first exercise in the past
the first exercise in the past

In October, new students found their way into my lecture: IT is essential today…, you will be rich and beautiful if you can program…, and look those guys say it too Then the moment came. The first exercise. Last year, we printed hello world together and the students then changed it to hello universe. This year, we drew the letter C using rectangles together and then I sent them off to draw a Mickey Mouse face on their own.

The next two days I got Mickey Mouse screenshots via email. I was blown away. I was expecting a few blocky gray faces, but I got beautiful colorful faces. The students went nuts with sketchbook. They went home and sat for hours to perfect their Mickey Mouse. Get this: Engineers-to-be drew comic figures in their spare time! The same people who are crawling underneath dirty cars on weekends. I was blown away.

the result I hoped for with sketchbook
the result I hoped for with sketchbook
what I got
what I got

Over the next weeks, I continued preparing my lectures. And it was fun. Finding exercises and examples became almost obvious. The looping structure of sketchbook made it seem natural that we needed variables, branches, etc. Pushed from the success of the Mickey Mouse exercise, I tried to administer more open tasks.

And the students kept surprising me. I got countless crafty, psychedelic, lovely and flat-out weird submissions. I decided to put them up on the lecture site for all students to see.

submission in week 2
submission in week 2
interesting submission
interesting submission
even the moon trajectories are correct
even the moon trajectories are correct
week 7 (no prior coding experience)
week 7 (no prior coding experience)
fully functioning minesweeper
fully functioning minesweeper
the student set all pixels by hand
the student set all pixels by hand

Why did it work?

past: tickle the logic center
past: tickle the logic center

During the winter break, I tried to find out why the lecture was so much more fun. After gazing into the chimney fire for hours and developing a little headache from thinking too hard, I had come up with four things that changed from last semester:

today: also engage the other half
today: also engage the other half

These things make a great recipe for a fun lecture. But somehow, it seemed too complicated; it seemed like there is a greater idea behind these reasons. And then it dawned on me:
In past semesters, I tickled the students’ logic center. They had fun solving sciencey, mathy puzzles. But this semester they had an additional motivation: The students could create something. They could tweak and polish. They could do something that was different to their neighbor and still have a correct solution. In short they were allowed – and even encouraged – to be creative.

creativity is a great motivator
creativity is a great motivator

Try it out! Build towers of cutlery when doing the dishes. Create a new visualization for the quarterly accounting. Come up with a fancy pattern when mowing the grass. Creativity is a great motivator.

I gave a talk about this, please look at the slides.
If you want to play around with sketchbook, please check it out on Github.