Tinkering in code

Summer is the busiest time for SparkFun Education. We run professional learning sessions and present at conferences all over the country.

I just returned from the ASEE conference in Salt Lake City, and am now preparing for a session with ITEST and RET teachers in New York. Then it's on to Virginia for our Microcontrollers for Educators class there.

As I formulate my approach to delivering content this summer, I ask myself a couple essential questions: “What are the learning objectives that cross standard classroom practice with what I see in emerging technology?” and “What is the pedagogical framework for what I’m delivering?”

As we’ve developed content through the years, we've gotten much more focused on how we tie SparkFun’s decidedly non-traditional approach to key frameworks into traditional education and how teachers around the country approach learning.

With the publication of “Invent to Learn” a couple years ago, there was a great shortcut to the “maker” mindset. As I go through the years teaching our classes, I find more and more ties to the pillars of educational theory. Our former Education Engineer, Brian Huang, brought many great resources to our teaching practice. As we move forward, the reading selections for our five-day class now include Seymour Papert, Cynthia Solomon, Sherry Turkle, Sylvia Martinez and Gary Stager.

Invent to Learn

 

This brings me to the idea of tinkering, and more specifically, tinkering in code.

I recognize that my specific practice involves two very different skill sets: creating physical objects, and adding interactivity and autonomy to those objects through code.

There are some well understood methods for working with our hands that define physical construction. Design, measure and cut have been explored through shop class, garage time and any number of after-school or summer camp experiences.

What is less understood may be the fundamentals of tinkering in code. Let’s look at a simple example for getting a learning progression underway in Python.

I am going to use Trinket.io, a web-based Python editor. When we open up Trinket, we’ll get some example code that we can change.

I think it’s fun to let students run with the code right off the bat, so they have the experience of looking at how code is formatted and how we can change parameters to understand what’s happening in the code itself.

Trinket generates a number of different code example when you open it up. I have written a basic example below. This is a simple effort to understand how the Turtle module works, and how commands are written and formatted.

If you copy and paste the code in blue italics above into the Trinket code window and press the right arrow button, it should run.

interactive Python

I deliberately introduced an “error” into this code. This gives students the chance to troubleshoot the code and start to think about what it’s like to read code for an error and fix it. I try to introduce common mistakes in coding on a regular basis. I didn’t write anywhere near perfect code the first time, and students won’t either. By giving flawed examples in the classroom setting, I can encourage students to read through the code and not just copy and paste.

The comments are on the lines following the “#” symbol, and give a basic explanation of that line and what it does.

There is a documentation page on the Trinket site that talks about using commands from the Turtle module: https://trinket.io/docs/python

code spirograph

When you click on the module, it will also give you an example to explore the commands and how they are written, as well as how values are passed to them.

I want to touch base on a couple of earlier points. What is the learning objective of this? It’s to introduce computational thinking and to encourage synthesis from students by asking them to fix a “broken” piece of code.

From a pedagogy view, I want to build a hands-on interaction that asks learners to delve into the example code and make changes and additions to construct a personal knowledge base.

This example is a starting point. It’s a great topic prompt for a math class or an arts project. It can be adapted as needed and I am very curious if anyone digs in with their kids.

Happy Hacking!