Teaching Coding 2: How Does it Work?

code-org_logo After one great session with all of the students where we focussed in on the question, “What is Coding?” we next turned to the question of, “How does it work?”  The plan was for them to explore coding and start to see the basics of how a simple structured language can communicate with a computer to produce a desired result.  To do this we used the great resources compiled by Code.org for Hour of Code, but I wanted to ensure I wasn’t limiting them.  With hundreds of possibilities out there, leaving them with a single activity seemed unfair.

Instead, I asked them to find something that they thought was interesting, try it for five minutes, then decide if they were going to work on completing the activity or to choose another.  I also had given them the option of working on any personal coding projects they had already started (knowing that I had several students who already were engaged in coding activities.) Within ten minutes everyone had chosen something to work on in all of the classes.

I enjoyed a number of surprises during those periods.  I found many students, and also many girls who were really enjoying working with coding.  Not only did they seem to enjoy it, but they also were good at helping others around them.  Over the course of two days, I saw a surprising number of my students seem engaged and excited about what they were accomplishing in coding.  One of those students was by far a standout moment from the lessons.

She already had started working on coding through the school’s coding club.  On the first day, she had come to me with a challenge she could not solve using Codecademy’s Python courses.  I am far from an expert in any coding language, but it had been almost two years since I had done anything in Python.  I went back through some of the courses to familiarize myself with the basics.  When she came in for this lesson, we worked together to solve the problems in her attempt.

As we worked on it, I tried to think out loud to model the logical thinking process and also to see if anything I was saying would spark ideas for her.  Between the two of us, we were able to figure out the solution.  While most kids would complete a problem and be excited to quickly move on to the next challenge, she wasn’t.  Instead, she turned to me and asked, “How does it work?”

We then went through what each line meant in the code.  We discussed what each variable and statement did and how they impacted the lines that followed.  When she felt as though she understood everything about that set of code, she was ready to move on to the next challenge.  I was surprised to find out how many students were interested in how their code worked.  From that point on, I made it a priority to explain, however simple, how the lines of code worked in any example I gave.  It was a great moment for me as an educator, and a great experience for the students.

Teaching Coding 1: What is Coding?

code-org_logo

The hour of code has been thrust upon us again.  I missed the “designated week” because I had something else already on the schedule. Instead I asked the teachers I worked with for three days for each 7th and 8th.  The first day was a surprise.  Kids walked into the lab, to find everything off: the lights, the computers, everything.  They had two simple instructions, don’t touch their computers and sit with a friend.

In the nearly four months I have worked in my new district my students have come to expect some surprises, some unconventional moments, and a flair for being somewhat dramatic when a lesson is all mine.  Many of the lessons I work on are collaborations with teachers, but often I the material is my own.  In this case, coding is entirely on me.

For two days, five hours each, I introduced coding in my own way.  These are kids that have grown up with Hour of Code. They have been doing it for three or four years, the class period of code studio work and they take a mixed approach to coding activities.  Today was different.  Instead of teaching them about how to code asked them a question: What is coding?

They came back to me with “programing”, “typing lines into the computer”, and many more along those lines.

I wouldn’t tell them right away.  Instead I simply told them that coders solve problems.  I asked what problems we had. Clearly, it was dark in the room.  The solution was simple, turn on the lights.  It seemed so simple, only, I would be playing a programable robot.  I followed every direction they gave, exactly as it was given to their remarkable frustration.  But, just as in coding, we went back, found the bugs, and tried again.  Before long they were making adjustments, not just to the directions, but to the types of language they were using.  After the lights were on, I asked them a question: Why was this so hard?  Their answers were spot on.  It was hard because I didn’t understand them, or at least, I misinterpreted what they were telling me to do.

Coding is a language.  It is not a traditional language like English, Spanish, or French (subjects most of them have) but it shares many similarities.  It has rules, it is used to communicate, and it can be understood.  Unlike those other  languages, however, coding is devoid of common context.  Any normal person would know to avoid the obstacles on their way to the light switch.  Any normal person would know not to walk into walls, or how to raise their arm and hand to make contact with the switch.  Computers are not a normal person.  They are without that context unless we give it to them.

The lesson was impactful, and I ended with one last reminder.  Learning a new language isn’t easy.  It takes practice and continued use.  More importantly though, learning coding takes four things.  They would need to learn to be clear, learn to be concise, learn to be critical thinkers, and above all they would need to be persistent.

This whole lesson went beyond coding, but you can’t teach a language in an hour.  Let alone the realization that it is actually many languages.  Instead all I can do is provide them with an overview of what coding is, how it works, and the potential it has in their lives.