Teaching Coding to Kids: What Programming Language Should We Use?

column | Computer Science

Teaching Coding to Kids: What Programming Language Should We Use?

By Sheena Vaidyanathan (Columnist)     Mar 11, 2019

Teaching Coding to Kids: What Programming Language Should We Use?

One of the most common questions I get from teachers and parents is: What programming language should we use to teach kids to code? Is it important to always start with block-based languages like Scratch? At what age should they transition to text-based languages? And how do I choose between Python, Java or JavaScript?

Having taught coding for almost 10 years to hundreds of students, I often present at conferences or run workshops for teachers new to computer science. Many teachers are trying to build a CS program in their schools for the first time, and it’s understandable why they worry about which programming language to choose. In addition to trying to figure out what’s best for their students, teachers have to strike a balance between what they’re comfortable teaching, and what administrators, parents and students feel they should be learning.

So, is there one “right” coding language to start with?

The coding language is not important. The concepts of programming are!

As you can guess, the answer is: No! What is important is not the language, but how to teach students how to solve a problem with code. Understanding how to create an algorithm (step-by-step instructions) to tackle an assignment, and coming up with the best way to write this in code, is probably the hardest part.

Learning the fairly small number of keywords and simple syntax of a specific programming language is easy—a lot easier than learning an actual, spoken human language! By contrast, in order to program independently, one must understand the underlying concepts in programming—variables, lists, conditionals, loops and functions, for example—and then know when, where and how to use them to convert your algorithm into code.

Once a student grasps these concepts and has programmed successfully in one language for some time, it is not that difficult to code in another language. Switching languages is not immediately easy, but it can be done.

However, does that first language change the way you think and code in the future? Is it important to learn the most popular language in industry today?

Programming languages come and go—and you will adapt.

The popularity of programming languages change, and there is no guarantee that what we teach our kids today will be used by the time they enter the job market. My first programming language was Pascal. (Yes, you probably have to look that up now.)

Over the years, I have learned to use different languages on different machines—some too obscure to be mentioned. Over the last 10 years as an educator, I have learned just enough Logo, Scratch, Processing, JavaScript, Arduino and Python to be able to use it as a teaching language in my classes.

Six years ago, I suggested that kids start with Logo, the earliest CS education language, and I still believe it remains a strong option available today. Here’s the most important part: If you can teach kids the basic concepts in programming, and they have spent enough time coding in one language, then they should have developed the fundamentals to switch languages later as needed.

There is another question that often comes up: Do we need to start all kids with block-based languages instead of text-based languages?

Block or text?

I started to use Scratch, perhaps the most popular and kid-friendly block-based language, in a digital design class for sixth graders almost 10 years ago, and I continue to love using it at all grade levels. I am excited to use the new features in Scratch 3.0 just released—especially the extensions to support text-to-speech, and language translation.

Block-based programming takes away so much of the frustration for young and early coders, such as missing a comma or forgetting to close a parenthesis, and leaves more time to focus on understanding concepts. In addition, Scratch’s focus on creativity and easy access to creating graphics, editing sound, sharing and remixing projects makes it a perfect first coding language for all ages. It is positioned as a tool to create art, animations, stories and games and not as a “coding” language, a branding that makes Scratch much more welcoming and less intimidating.

I have found that after a few years of using Scratch, students want to try text-based coding because they associate it with “grown ups” and the “real” coding that is done in industry. I have also seen that sometimes just a change in language is needed to review concepts like variables and loops.

My middle-school students are willing to put in the extra effort it takes to learn text-based coding; often they slow down in order to be careful with their spelling and syntax as they tackle the challenge of programming in Python, JavaScript, Arduino and Processing. But once students can get past the initial “I have to really watch what I type” part, they often appreciate the flexibility and power of text-based coding, especially when they find how much easier it is to copy, paste, modify and collaborate on text code to create projects.

At the Foothill College KCI Computer Science Crash crash course that I teach each summer, I offer teachers both Scratch and Python and show the same project in both languages. They love seeing the parallels between the two types of languages, and even more if we first start with “pseudocode” or a flowchart—a way to write down the algorithm before writing any code. Here’s what a small project that involves checking a password looks like as a flowchart, in Scratch, and in Python.

Flowchart
Password checker flowchart diagram
Scratch
The same password checker, in Scratch
Python
The same password checker, in Python

Both teachers and students who had no exposure to block-based programming are easily able to learn Python in my classes, showing that with the right projects, starting with text-based language also works.

What makes any programming language a good language for teaching kids to code? Are there any criteria to help pick a language?

While it may be good to know that teaching coding is more about concepts, and that you do not need to stress about picking the perfect first language, the question remains: What should a language have that will make it a good choice for teaching kids to code? While programming languages are often evaluated in numbers of ways—on speed, applications, libraries available, industry support—here are some important criteria I consider.

Does it have a strong community of educators?

One of the reasons I always point to Scratch and Python is their access to a network of educators using these languages in their classrooms. They have such large communities behind them because they have always been free, open and welcome to a wide range of users from across the world. Having a large community means you can find more resources, such as projects, lesson plans, tutorials, videos and books dedicated to teaching the language in the classroom. It’s also likely that you can walk into an education conference and find a session giving you tips.

Is it easy to pick up?

There are many text-based languages to choose from—some more popular today in the tech industry than others, some with specific features that make them good for creating a particular project. While many high-school students may have to ultimately learn Java for an AP Computer Science course, it is not necessarily the easiest language to start with. Python is by far easier and has been gaining popularity in education because it is so simple. After three years of using Python for a computer science elective class, I am constantly surprised at how little it takes to get something done, and how quickly my middle-school students learn to code in Python. Inspired by how well Python works in teaching coding to kids, I spent time writing a book about it.

What is the design philosophy behind it? Was it designed for this age group?

It is important to offer tools that are age-appropriate, and programming languages can hide or showcase features based on the target age group. Scratch, rooted in the philosophy of using code for creative expression, deliberately simplifies some constructs one may expect to see in a coding language. Scratch Jr. is designed for kids who are still learning to read, and has no variables or conditionals, which may be too confusing at their age. Python offers extensions to support many types of projects, but these are available as modules that have to be explicitly added, so you do not need to see them until they are needed. Languages for older students working on complex programs must have support for debugging, a fundamental skill. If teaching “object-oriented” programming is critical, then using Java is not a bad choice.

How easy is it to install, and does it run across platforms?

These are things to keep in mind, especially if it is important that students continue to code at home. Some only work in specific environments, like Apple’s Swift coding language. If students are working on Chromebooks, then having a stable, browser-based tool is critical. Another thing to consider: Is the language really available for free so every student can use it at home, or are there hidden extensions only available for a fee?

How easy is it to share projects with the community?

One of the fundamental ideas behind Scratch has been the community, and letting kids share and learn from each other. That community is also useful for teachers as well. However, sharing also requires planning: when and how much you want students to share, comment, reuse and repurpose others’ projects. While JavaScript may be frowned upon as a first text-based language to learn and is not as easy as Python, it does have the advantage that it just runs on the web. Showcasing projects is as simple as posting them on a school web server.


There are many other considerations when choosing a language. What kind of projects are possible? Different languages have supports and extensions for different types of projects; for example, Processing and P5.js make it easier to do media projects and create art and animations. Python makes writing complex data analysis and even machine-learning projects possible. Teachers may also want strong classroom tools to manage assignments and grading, especially for group projects.

One of the most common questions is: “Is this language popular today?” Popularity can certainly shape the choice of programming language to encourage students to sign up for a class. It’s understandable that parents want educators to teach what is marketable for jobs. However, teaching good programming habits trumps teaching a popular language.

While we can stress about finding the “perfect” programming language to start, let us not forget that the ultimate goal is to let students explore fundamental programming concepts. They may never choose to program after your class, and the language you teach may become obsolete as they get older. What is important is that teaching coding will help students understand how computers solve problems, acquire critical thinking skills—and hopefully learn just how much fun it is to make stuff with code.

Learn more about EdSurge operations, ethics and policies here. Learn more about EdSurge supporters here.

More from EdSurge

Get our email newsletterSign me up
Keep up to date with our email newsletterSign me up