Why teach coding? Who should teach it? And how can teachers get started? Get tips on how to bring coding into your classroom.

two elementary students learning to code

What is coding?

Coding is the process of writing out steps for a computer to follow to achieve a goal or perform a task. Typically, coding is done using a programming language -- like Java or Python or JavaScript -- which the coder uses to translate his or her ideas into words, phrases, and syntax that the computer understands. These instructions are also called "commands."

Coding is typically done as one critical step in the larger process of computer programming. Computer programming involves identifying a problem or challenge, considering potential solutions, writing code that can enact those solutions, and then testing and revising the code to achieve the desired results.

Computer programs, also called "apps," can generally be run on a wide range of machines and devices, including computers, laptops, tablets, gaming consoles, and more. They include everything from operating systems, like iOS, Windows, or Android, to robust applications like Office or Photoshop, to web-based programs like Netflix or Instagram, to games like Minecraft or Candy Crush. Everything that a computer or device does is through a program.

Code Conquest, which provides a free coding guide for beginners, has a helpful history and summary of the most common programming languages. For beginners, there are also several programs that allow users to use blocks or visual elements, and to toggle back and forth between blocks and the programming language.

Here's a simple example of code (using Python): print 'Welcome to my program!'

This particular command, "print," tells the computer to display the text that follows -- in this case, "Welcome to my program!" This command does not include any variables, which are commonly used in coding. Variables are placeholders that tell the computer what to do based on a particular user action, like a keystroke or click.



Why teach coding?

Coding isn't just for "techies" or kids who want to work on computers. There are lots of compelling reasons for all students to learn to code.

First, it teaches students how to be digital creators -- to create their own websites, apps, and programs. Coding allows students to wield the full power of the internet -- and multimedia -- to share their ideas, talents, and creativity with the world.

"Most people won't grow up to become professional computer scientists or programmers, but those skills of thinking creatively, reasoning systematically, working collaboratively … are things that people can use no matter what they're doing in their work lives."

Coding also provides students with skills that apply across content areas. By learning to tell machines what to do, students engage in problem-solving and computational thinking, which apply to academic and professional disciplines across the board. As computer scientist Mitch Resnick from MIT explains, "Most people won't grow up to become professional computer scientists or programmers, but those skills of thinking creatively, reasoning systematically, working collaboratively … are things that people can use no matter what they're doing in their work lives."

Learning to code also teaches students in a concrete way how the technology they use every day works. Students get a better understanding of what apps are actually coded to do and, in turn, what some of the larger consequences of using them are.

For example, consider heavily used platforms like Instagram or Amazon. These platforms use algorithms, which are coded formulas, designed to get users to use the platform as much as possible. Knowing that these platforms are coded this way helps students understand the larger ramifications of their use: The platform is able to collect more and more data, and there is potential for overuse and for being manipulated into using the platform more than is healthy.

Coding can also be lots of fun and provide students with a creative outlet, and it will give them a leg up when they begin pursuing a career and other professional goals.



Is coding relevant to non-STEM subjects?

Yes! Because learning to code involves logic, problem-solving, backwards planning, and other broadly applicable thinking skills, teachers of all subject areas could consider making coding a part of their content area. In fact, students can use coding projects to demonstrate knowledge in any subject. In language arts, for example, you could add a challenging and creative new dimension to a literature unit by having students create code programs that allow users to interact with characters. Or, students could extend the plot of a novel by creating a choose-your-own-adventure story.

Coding projects not only potentially enhance specific subject areas like English, science, or art but also are great opportunities for cross-disciplinary, project-based learning. Check out "5 Ways to Get Your Students Coding Across the Curriculum" from Kids Discover for more ideas for cross-discipline coding projects.

Because of the technical skill involved, some teachers might shy away or think they aren't qualified to teach a class on coding. Not true! Like any subject, coding requires some expertise, but there are lots of ways to learn the fundamentals quickly, and to stay a couple steps ahead of your students. Check out this video and tips sheet for some helpful ideas. Code.org has a whole suite of courses specifically geared toward teachers who want to teach coding. And Edutopia's Coding in the Classroom article also provides some guidance.



At what age can students learn coding?

Coding instruction can begin as young as 5 years old. Code.org, for example, has a full offering of courses for grades K to 5. Many also point to the findings of child development experts in relation to learning a new language: Ages 2 to 7 are prime for acquiring fluency. Learning to code is like becoming fluent in a foreign language -- your brain is learning new vocabulary and syntax and synthesizing them into creative expression.

With young students, there will of course be missteps and challenges when it comes to getting started. Young kids learn differently from how older ones do, and they often have less resilience. But these setbacks are actually important steps, as coding, at any level, always involves some level of failure, of learning why and how a piece of code fails and how to improve it. By experiencing these challenges from the beginning, kids learn that failure is part of the process of coding.



What do students need to know before taking coding?

The short answer is, nothing. No formal prerequisites or specific skills need to be mastered before kids get started. Coding, does, however, challenge students to use their existing knowledge and skills in several areas, including:

  • Basic computer skills. Students will need to know or learn fundamental skills for using a device, including clicking, typing, logging in and out, etc.
  • Logic. Coding challenges students to: identify cause and effect, sequence, make inferences, and perform other cognitive skills.
  • Perseverance. Coding requires students to experiment and use trial and error to figure out which commands, syntax, and sequencing will lead to the outcome(s) they desire. This requires a certain level of stick-to-itiveness that can be challenging for learners of all ages.
  • Attention to detail. Sometimes the smallest of details can cause coding syntax to error out or to not function as desired. Students will need to apply or learn mindfulness and patience when reading and writing their code.



How do I get started teaching coding?

Your first steps will depend on your situation. You may need to plan the course logistics, get trained to teach the course, make the syllabus, or maybe all three. Below are some basics to consider, whatever your situation.

When, where, and who?

As with any new subject or class, it's helpful in the beginning to limit the number of students in the class to a manageable size. If possible, it's also preferable to start with students who have chosen to be there or who have shown an interest in computers and even coding.

In-class demos are a great way to spark student interest. You can also introduce the Hour of Code program from Code.org to students, so that they can see how other students and schools across the world are challenging each other to be creative and innovative. One teacher describes it as "An Hour of Code for a Lifetime of Knowledge."

It's also a good idea to target students who come from backgrounds that traditionally have not been represented in computer science and technology. Check out "How to Start and Build an Inclusive Computer Science Program" from KQED's Mindshift and these three programs aimed at diversity: Girls Who Code, Coding Girls, and Black Girls Code.

Finally, if the class can be part of the normal school day -- and even graded -- that is ideal, as students will more likely have an academic mindset in the class.

How much time do I need?

There's no specific number of minutes or weeks that the class needs to be. Coding is fundamentally a creative endeavor, so once students have learned the basics, they can continue honing their craft and taking on more and more sophisticated challenges. That said, at a minimum, students will need sessions that are at least 30 minutes long. The course should also include at least five sessions.

What should I cover?

If your school or district has already contracted with one of the big three  -- Microsoft's MakeCode, Apple's Swift Playgrounds, or Google's CS First -- then of course you'll start there. However, those programs start at third grade or later, so you'll need to look elsewhere for younger students.

For beginners, apps that use blocks rather than just coding language are more accessible. Our list of Best Apps and Websites for Learning Programming and Coding has several highly rated options for getting students started. If you'd prefer to begin by teaching a particular coding language, you'll want to choose one that is common and accessible, like Python, Java, or Ruby. Check out these blog posts from CoderZ and Self-Taught for more information.

As students develop their skills and begin to create their own programs, consider assigning coding projects to continue pushing them. Khan Academy and Code Conquest each have some good ideas for this.



What are the best resources for teaching coding?

There are lots of great apps out there for teaching coding, and the landscape is changing rapidly. Our Best Coding Tools lists for elementary, middle, and high school include the most highly rated options and detailed reviews.

Over the last two to three years, teaching coding has evolved to include broader topics and developing trends in technology. Students are no longer just being asked to learn a programming language or create a program out of context, but are instead being asked to learn coding in the context of the real-world technologies that are affecting their lives.

Approaching coding in this way -- as a tool for navigating the digital world -- helps students make use of their existing knowledge, experiences, and values in the learning process. It supports them in making coding projects that are actionable and applicable to the real world. Some examples of standout apps that have taken this broader approach include Tynker Junior, Cubelets, Gizmos & Gadgets (invention), Unity Learn (game creation), MAD-learn (design thinking), Machine Learning for Kids (artificial intelligence), Root Coding (robotics), and Technovation Families.

This article was updated on November 17, 2020.

Jamie K.

As an education consultant, Jamie created curriculum and professional development content for teachers. Prior to consulting, Jamie was senior manager of educator professional learning programs at Common Sense and taught middle school English in Oakland, California. For the 2016–2017 school year, Jamie received an Excellence in Teaching award and was one of three finalists for Teacher of the Year in Oakland Unified School District. While teaching, Jamie also successfully implemented a $200,000 school-wide blended-learning program funded by the Rogers Family Foundation and led professional development on a wide range of teaching strategies. Jamie holds a bachelor's degree in philosophy from Eugene Lang College and a master's degree in philosophy and education from Teacher' College at Columbia University. Jamie currently lives in Sao Paulo, Brazil with his 4-year-old son, Malcolm, and his partner, Marijke.