case studies

The pedagogic value of Live Coding: Case Study – Civil Engineering

Teaching live coding in a classroom environment

Live coding—where instructors write and execute code in real time while verbalising their thinking—has become an increasingly prominent teaching strategy in STEM disciplines, particularly computer science. It is typically framed as an active learning method that exposes students to authentic problem-solving, debugging, and iterative development practices. This paper reviews the effectiveness of live coding in higher education, with a focus on structured pedagogical models and scalable approaches suitable for large, campus-based cohorts.

Liz Lewis – Civil Engineering

Firstly, can you provide a bit of context to what and who you are teaching

I teach 2nd year civil engineering undergraduates. Class size ~80 but with maybe 30 students actually showing up! I teach an introduction to python (6 weeks) for general purposes but also for implementing numerical methods for engineers.

Do the Students have prior knowledge of Coding? 

We start from scratch. They do a tiny bit of Matlab in 1st year, but I just start over right from what is a computer and a program.

Why do you run a Live Coding sessions as opposed to a Lecture & Tutorial type format? If not super focussed on Live Coding, how did you decide on the format of teaching and why does it work well for teaching coding?

I teach 1 x 1hr lecture and 1x 2hr computer lab each week. The lectures cover the topic of the week. I mainly use slides, but sometimes open up a Jupyter notebook and live code. In the practicals I have Jupyter notebooks in Colab with a work-at-your-own-pace practical laid out. Me and a team of demonstrators then walk around the lab providing support (and writing code for students) and then at regular intervals throughout the class, I live code the solutions. This updates the main copy of the Jupyter notebook so that the students have a reference of all the answers.

What are the main skills you expect students to learn throughout the Live Coding sessions?

I want them to develop a basic appreciation for what coding is and how it can be useful to them throughout their degree and in their careers. I also want to expose them to the code underlying much of the software that they will go on to use later in the course/workplace. In addition, we look at GitHub and how to code collaboratively. By the end of the course they should be able to: Write simple code in python, handle matrices with numpy, read in data with pandas and do basic analysis with it, create graphs and figures using matplotlib, create documentation and comment code well, collaborate on code using Github.

How are you assessing your students?

The practical sessions are designed so that the students have a go at small coding challenges with the support of me and the demonstrators. There are formative quizzes on canvas that they can test their knowledge on each week. Then they are examined via a group coursework that they do on GitHub and a written exam. 

How do you plan each session? Do you pre-write code or improvise? How do you incorporate theory and background into the sessions

I have lecture slides for the lectures and prewritten examples for the practical sessions. However, I also include other improvised examples during the live coding parts of the practical sessions based on what I have seen them do as I have been walking around- there are often many different ways of coding an answer to the challenges I set.

What programming tools or environments do you use for live coding? How do you ensure all students have a consistent set up? Do you provide support for students who may not have used these tools before? 

I do everything on google colab. This ensures that students can practise their coding on any device (they could even do it on their phones if they wanted to!) without having to install python anywhere. It has been really reliable for all of my coding classes (7+ years of them!) and has everything they need already installed. I am always willing to help them install python on their own computers if they want to, but often only one or two students ask.

What is the room set up in a live coding session, are students working in groups/duo’s/individually? Do you have GTA support – if so what role do they play in the sessions

I do them in a computing cluster. I like the one in the Simon Building as it has somewhere for me to stand and teach from. Very few computer clusters are set up for teaching well, I could really do with a projector and whiteboard to do live coding properly. Students work individually but are encouraged to talk to each other. I start the session with an introduction, then they work at their own pace with myself and 4 demonstrators walking around to help them. I interrupt and stand at the front again to do the live coding of answers throughout the session.

How do you pace the sessions? Are students working at the same time as you or do you split the sessions to instructor led then student led sections. How do support the mixed abilities within the classroom?

As I walk around I check the pace that they are working through the notebook at and match that pace for the live coding demos. Some students ask a lot of questions, others are hesitant to ask. I go to every single student and look at the code they have written to see if they are struggling or not and tailor my support accordingly. There are enough demonstrators to support everyone comfortably.

What is your approach to trouble-shooting & de-bugging? Do you purposefully introduce errors? How do students react when their own coding doesn’t work.

We talk about error messages from session 1 and I often deliberately (and sometimes accidentally!) introduce errors into the live code to show them what does and doesn’t work. The students are often frustrated when they get error messages, but I try to teach them how errors can be helpful and that it is just part of coding. 

What is the biggest challenge you face when Live coding? How have you modified your approach to live coding since you started these sessions?

The biggest challenge is often balancing live coding and one-to-one support. The pacing is different for every class and every session, so I have to read the room to determine what is the best use of time. I’ve had to introduce AI and ‘vibe coding’ and emphasise that this is a beginner class, so AI will do a great job at answering your tasks, but unless you actually learn the fundamentals, you will never be able to check if it is right or not. 

What advice would you give for someone interested in starting live coding to support their teaching?

Use google colab- it is so robust and transferable and you can access your materials anywhere. But make sure you turn the AI support off in all of your notebooks for teaching. Don’t be afraid of making mistakes live, it’s good for them to see how code is really written- many many many small trials and errors.

Thanks to Liz for sharing her experiences.


The Pedagogical Value of Live Coding – Overview

The Pedagogical Value of Live Coding – Case Study: Chemical Engineering

The Pedagogical Value of Live Coding – Case Study: Computer Science

The Pedagogic Value of Live Coding – Case Study: Physics and Astronomy