Unlocking Loops with Coding Stories: A Fresh Approach to Teaching Programming

Unlocking Loops with Coding Stories: A Fresh Approach to Teaching Programming

As computer science teachers, we’ve all seen it: students grasp the syntax of loops but struggle to recognise when and why to use them.  I’ve been reinforcing the concept of loops with my Year 9-11 students for a while (excuse the pun), yet many still hesitate when it comes to applying loops to real-world problems. The issue seems to be bridging the gap between the problem and the necessary code.

A further common stumbling block is variable naming – many students find it difficult to choose a sensible name that aligns with the problem they are trying to solve. Is this due to brain development and the challenge of abstract thinking? Perhaps.

I wanted to try something different to help them make those crucial connections.

The Power of Coding Stories

We know that visual tools like Logo can make the link between code and output more tangible. But what if we flipped this around and let students first experience the link between the output and the code? Enter: Coding Stories.

The concept isn’t entirely new. books like “Once Upon an Algorithm” explore similar ideas – but I hadn’t tried it in this way before. The results from my small, non-scientific survey* have been promising, indicating that it made a big difference for 27% of 74 students that completed it, and students not only engaging more deeply but also asking for more stories!

How It Works

Storytelling: Students are given a short, engaging story and asked to visualise what’s happening.

Breaking it Down: The story is then shown as a structured ‘plan’ in natural language, describing the key actions in the story.

Coding the Narrative: The story is translated into Python, reinforcing the logical steps required to turn ideas into functional code.

Applying the Concept: Students are given a similar story and use their understanding to write the corresponding code.

By connecting programming to familiar real-world experiences, students can better assimilate coding concepts. This method encourages deeper thinking, creativity, and, most importantly, confidence in writing code.

Example: [Google Docs – Best format]. [PDF]

What’s Next?

I’m considering expanding this idea – perhaps writing additional short stories or even presenting them in an interactive format, but alas this is not at the top of my priority list at the moment. However, could this be a game-changer for helping students internalise key programming concepts? I’d love to hear your thoughts!

Continue the discussion on LinkedIn

*Postscript: Small non-scientific survey!

Here is the brutally honest feedback from my students!

Question: “Which phrase helps to best describe the extent to which this task helped you to understand how to code?” If none of the comments feel right, please add another comment.”

CommentComment typeCountPercent
Didn’t really help me because I am already familiar with the coding concepts in the stories.Default1318%
Helped to make clear what I already know about codingDefault3447%
Helped me a lot to understand how code worksDefault2027%
Didn’t help me at all. I think doing my personal revision would’ve worked better.Other11%
Didn’t really learn much because I was basically just copying the code and just changing the namesOther11%
I now understand most of it with the scenarios and a story but still need more practise.Other11%
I still don’t get itDefault23%
It helped me understand a few parts of code I did not understand.Other11%
  74 

Another student also commenting on not liking the AI images.

Comments are closed.