Fragment: Teaching Coding By Example, a Line of Code at a Time

One of the things I try to do in many of my demo Jupyter notebooks is explain what’s going on so that readers who aren’t (yet) Python programmers can hopefully form some understanding of what the code is doing.

This Simple demo notebook originally started out as a really quick notebook containing little more than code blocks that showed how to download and review some WEC (World Endurance Championsip) laptime data; but then I started iterating it, adding in more explanatory code steps,  prefaced by markdown text that tried to explain what the following line of code was going to do.

One of the ongoing debates we have in our TM351 Data Management and Analysis course is whether students need to know how to programme in Python to do the course, i.e. whether the module should have a Python programming course prerequisite, or at least a programming skill prerequisite (I argue in favour of no prerequisites).

Certainly, explaining each step of the code adds more words and makes each notebook a much longer read; but a lot of effective distance teaching does involve repetition and rehearsal.  The line by line, “explain what you’re want to do and how you’re going to do it; do it’ preview the output” approach also “unpacks” each line of code in a problem solving / goal directed context (“I want to do this, which requires that I have previously done that“).

Author: Tony Hirst

I'm a Senior Lecturer at The Open University, with an interest in #opendata policy and practice, as well as general web tinkering...

One thought on “Fragment: Teaching Coding By Example, a Line of Code at a Time”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.