Your Perfect Code Might Be Terrible for Teaching

Published on 2017-07-01 by Stuart Spence

When I post tutorial videos people often make suggestions on how to improve my computer code. Thank you for your code suggestions! However, we may have a problem.

I often find that code suggestions are not teaching suggestions. Almost all computer programmers are not experienced educators, so this is understandable. However consider that the best designed software might be terrible for teaching. Your perfect code might be terrible for teaching.

These are some of the things I consider when choosing what computer code to put in my videos.

Simple Code

If you think that the clearest and simplest lesson is the best way to teach a challenging concept, you're making a big claim. These claims can be tested. They have been tested. The claim is often wrong. Clear and simple lessons convince the learner they know the material, even if they don't know it. Confusing lessons are annoying but they make you think.

I'm not arguing people should make confusing lessons. However if your core argument for a code suggestion is that it's simpler, then your code belongs in the workplace and not necessarily in an educational video. Simplicity is not always the best approach.

Programming is Not Education

I recall someone once asked an online algorithms group "what are the first algorithms I should learn?". There were many responses.

Nobody asked the poster why they wanted to learn about algorithms. Nobody asked what the poster's math background was, or whether they were interested in biology or physics or economics. How could anyone make recommendations without knowing this? These are the first questions any decent educator would ask. Well, there weren't any decent educators in this discussion because it wasn't an education group. I suggested the poster should ask a "computer science teachers" group instead of a technical algorithms group.

Programming is not education. When making a code suggestion don't make computer programming arguments in support of it. Make education arguments.

Schemas and Accommodation

When people learn, they don't start at zero and jump to a complete understanding. In psychology this is the theory of schemas and accommodation. From this website:

Consider, for example, how small children learn about different types of animals. A young child may have an existing schema for dogs. She knows that dogs have four legs, so she might automatically believe that all animals with four legs are dogs. When she later learns that cats also have four legs, she will undergo a process of accommodation in which her existing schema for dogs will change and she will also develop a new schema for cats. Schemas become more refined, detailed, and nuanced as new information is gathered and accommodated into our current ideas and beliefs about how the world works.

When you make a computer code suggestion, please consider how big a leap is required from the learner. Code that is shorter and simpler among programmers may actually be enormously more complicated for a learner.


I constantly struggle to keep my ego in check when making technology instruction videos. If I can think of ten ways to code a lesson and I choose the "dumbest" looking one, I know that people will think I'm dumb too.

If you are able to make computer code suggestions, consider the possibility that you are not my target audience. That means that the code you wished had been in my video is code for you. It might not be good code for my audience.

How You Can Help

If you want to help improve the code in my videos, thanks! But first, please consider some of the things I value and don't value about code improvements for educational videos.

Things I value less:

  • Execution speed
  • Coding standards
  • Concepts and features that only apply to specific software.
  • Code length
  • Memory use
  • Number of variables

Things I value more:

  • Teaching the core concept better
  • Fewer prerequisite concepts
  • Concepts that are powerful and can be used for later learning.

I love high quality software too, but that's a different conversation.