Coding: It's a Kind of Magic

Python Code“It's a Kind of Magic”, is not just an underrated Queen album and great quote from the classic film, Highlander, it is also most people's attitude towards technology. While most people these days are comfortable using whatever technology they find in front of them, so few are capable of actually utilizing that technology to truly meet their individual needs.

Recently, I was asked to help a colleague set up an online request form for our school's Japan Mini Day.  JMD is a great cultural event where students and staff get to participate in three sessions related to Japanese culture. In the past, students filled out a paper request form.  There are three sessions on that day and approximately 30 topics offered.  Students are asked to choose the top nine they would like to attend.  Someone then has to take all those forms (300), sort them based on who had priority, and assign students to each course one at time while keeping track of the maximum number of students allowed, which varied by session. Needless to say, this took quite a long time; last year it took someone 3 days to complete the process.

This year, a new full-time teacher was assigned this task...I imagine the conversation went something like this, “Welcome! Now, here, do this horrible task nobody else wants to do, newbie.”  So, she came to me to see if we could do some of this online. We broke the problem down into three stages:

1) Getting the student requests into digital format
2) Assigning the students to their sessions
3) Compiling that information by student, homeroom, and by session

Stage 1 - Getting the requests into digital format: This was the easiest part.  We had two convenient choices: Google Forms and the Moodle database activity.  We decided to go with the Moodle database activity as it would be available in the future no matter what staff changes occurred, or if the responsibility for this duty changed to someone else.

Stage 2 - Assigning the students to their sessions: This is where programming came in handy.  Since I have been teaching a new Python programming course (and learning Python myself as we go along), I felt this was a good opportunity to get some experience using Python to solve a real world problem.

So, I spent 4 to 5 hours programming a solution that would take the exported .csv file, parse it, and assign the students to their sessions. I would have been able to do it quicker in another language, but since I had to teach myself how to do lists, reading and writing files, and more importantly classes in Python it took a bit longer than I expected.  The Course class declaration looks something like this.

class Course

It was time well-spent as I am now much more well-acquainted with Python and have earned the undying appreciation of the Japanese Department for doing this. As the HOD (Head of Department) said to me, “I can’t believe it. It’s like magic.”.

Stage 3 - Compiling the information by student, homeroom, and by session: My initial version of the program simply printed the course registration for each student in the order they were in the .csv file.  At the request of the teacher involved, I added the following:

1) A list of each of the sessions and how many registrations each had
2) A list of the registrations by homeroom for easy dissemination to students
3) A list of the registrations by session for easy dissemination to the session leaders

Interestingly, once the main program had been created, adding these last three only took about 10 minutes each. This is the power of classes and the power of Python, a language I am growing to like more and more each time I use it.

Altogether, I probably spent about a day working on this project, including meeting with the teacher, answering emails, coding the solution, and completing the final data export and session assignment. So right there, a 3-day job was reduced to a 1-day job.  That time savings will just extend as we move forward.  Each year, the available sessions change, so I expect updating the program and the Moodle form will take about an hour or so - a far cry from the 3 days it used to take.

There is a lot of talk about teaching coding in schools and the importance of learning “algorithmic thinking”.  I wholeheartedly agree, however, the above tale is a concrete example of the time savings and efficiency gains individuals can expect when they learn to truly master technology.  During my TEDxTokyoTeachers talk on the importance of teaching programming, I closed with the following quote, which is ever more relevant each passing day:

“Do we direct technology, or do we let ourselves be directed by it and those who have mastered it?”

-Douglas Rushkoff in Program or Be Programmed



Post new comment

The content of this field is kept private and will not be shown publicly.



What LMS does your school use?: