The Power of Live Coding
Published by Tammam Kbeili On 2019/05/02
After many years of teaching new developers-to-be at CodeCore Developer Bootcamp, we have found live coding in the classroom to be an effective teaching technique. By live coding I mean the instructor writes the code she is teaching line by line as if she is coding on a job.
There are two approaches to live coding: students can either type along with the instructor or they can watch and get access to the code later. I prefer the first approach but that’s a topic for another post.
Regardless of the live coding approach, here are the key reasons live coding is so effective:
The oppositive of live coding would be something like showing completed code on slides. Every developer knows, lots happen from the idea until the completed code. Usually, coders start to write a piece of code one way then look at the finished piece, then find a way to improve it then modify a variable name, then take a second look and make it more concise just to come back an hour later and delete the whole piece of code because they didn’t need it in the first place. So when you live code you show the code getting written line by line which reveals the information slowly allowing time for students to absorb, think and internalize the concepts and principles. As a nice side effect, this usually encourages the students to ask questions and participate. If the code is shown all at once, the students may get overwhelmed and possibly shy away from asking questions as there can be more than one thing they are not sure about.
As most developers can attest, coding is a process, a way of thinking. Experienced developers have a process about writing code to solve a problem. The process differs between developers especially depending on whether you’re writing code for back-end service, front-end service, mobile phone, blockchain…etc. It can be something like: write X then test it well then write Y, then test X and Y working together, then try some edge cases, then write some tests…etc. Such a process may seem intuitive for experienced developers, however, it’s far from being so for new ones. New developers will benefits greatly from building the mindset for writing code. Live coding enables instructors to verbalize the process and explain the reasoning behind the little decisions made which makes a huge difference in the overall outcome.
When you reveal the information bit by bit through live coding, you can problem solve part of the project with the entire classroom (or group of viewers if you are streaming online). This can be done by asking questions such as How do you think we can solve X? or Do you think we need a new model or use an existing one?. If you show completed code slides, it can make it hard to work out a solution together. It sometime could be helpful to deliberately go a wrong route and then retrace and try another solution that works. This is especially true if one of the students suggested the solution so it’s good to see it till the end and explain why it wouldn’t work or why there may be another better solution.
If you are in a capacity of teaching coding, please give live coding a try. If you are not doing it already, you will notice a big difference in the outcome of students and in the interactions with your students.