I should learn to code

(This blog post was covered on Lifehacker and translated into Spanish and Chinese.)

It seems like everyone is trying to learn to code: Code.org has celebrities like Bill Gates, Mark Zuckerberg, and Chris Bosh telling you anyone can code; CoderDojo’s are springing up all over the country; the UK has made it part of their official curriculum for all grade school kids.

I think this is slightly misguided. Don’t get me wrong - I do think the world would be better off if everyone had some familiarity with coding - but coding itself should not be the goal. Computers and programming are just tools. They are a means to an end.

The real goal should be to teach people a new way to think. In other words, we should be trying to teach computer science and not just coding. In this blog post, I’ll explain the difference between the two, and why focusing on the right one is critical for the movement to succeed.

If you prefer a video explanation, I highly recommend Simon Peyton Jones’ wonderful TED talk Teaching Creative Computer Science, which was the inspiration for this post:

Still here for the written version? Great. Let’s get started by asking a key question: why should you care about coding or computer science at all?

To answer that, we’ll take a walk.

Welcome to the real world

Red pill or blue pill

You’re probably reading this blog post in Chrome or Firefox, running on Windows or OS X, on a laptop or desktop. I’m guessing you also spent some time today reading email, checking your friends’ Facebook statuses, or watching a video on Youtube. Much of your life is on computers these days: your medical records are in a database; you resume is on LinkedIn; you use Google and Facebook to market your products; you use Amazon to buy them; you file your taxes online; you manage your bank account on a website; perhaps you even dabble in digital currencies.

Now, look up from your computer: in your pocket, purse, or on a desk nearby, you may have a smartphone. It’s loaded with a GPS, camera, touch screen, and tons of apps. If you’re in your living room, you might also have an LCD TV hooked up to digital cable, a DVR, DVD player, Apple TV, XBox, or PlayStation. The movies, music, and games you may play on those devices are packed full of computer graphics and digital audio processing.

Let’s head outside. Did you walk past your car? Modern cars are designed using software, built in a factory full of robots, and stuffed full of computers. If you drive your car, you might use Google Maps to find your way around, Yelp to find a place to eat, or TripAdvisor to find a place to stay. Now, look up: somewhere above you, a plane will pass by that is controlled by auto pilot, has in-flight Wifi and entertainment systems, and is constantly communicating with other planes, traffic controllers, and its manufacturer. Somewhere above that, satellites and space stations are orbiting the earth, taking pictures, measuring the weather, and routing phone calls.

Software is eating the world. But this is only the beginning. Before you know it, you’ll be wearing technology, locking your doors with computers, using robots to deliver goods and clean your house, building your own electronics, running your own manufacturing plant, living in virtual reality, traveling in self driving cars, and flying to space.

The matrix is everywhere

The matrix

Absolutely all of the technology I just described is powered by software. In every aspect of your life, you are surrounded by code. And the amount of code is only going to increase in the future.

Now, just because a technology is ubiquitous doesn’t mean you have to study it in school. For example, we all fly in airplanes, but getting your pilot’s license is not part of the K-12 curriculum.

However, the tools you need to understand how to think about flying are part of the curriculum:

  1. Physics and math help you understand gravity, forces, pressure, velocity, friction, and lift.
  2. Biology teaches you what happens to the human body at high altitudes, with limited oxygen, and extreme cold.
  3. History explains how the airplane was developed, how it evolved, and its role in travel, commerce, and warfare.

By the time you graduate high school, you have an idea of what a plane is, how it works, and how to use it safely. General purpose classes like physics, math, biology, and history teach you how to think about a wide variety of topics, including airplanes; this is in contrast to a class that teaches you how to use a tool, such as how to fly one specific type of airplane.

For the same reason, we should focus on teaching computer science and not just coding: the former is a general purpose way of thinking, whereas the latter is a specific tool. Let’s look closer at computer science to get a better understanding of the distinction.

What is computer science?

Lambda

Computer science is the study of computation: that is, how to represent and process information. Here are just a few of the concepts you might study:

  1. Problem solving: you’ll learn algorithms - that is, general strategies, such as divide and conquer, recursion, heuristics, greedy search, and randomized algorithms - that help you model, decompose, and solve any kind of problem.
  2. Logic: you will start to use precise and formal methods of thinking, including abstraction, boolean logic, number theory, and set theory, so you can solve problems in an air tight manner.
  3. Data: you will touch information theory and start asking questions like what is information? How do you represent it? How do you model the real world?
  4. Systems: how do you design and build complex systems that satisfy a set of requirements and constraints? Systems engineering is an essential topic in almost every business.
  5. Thinking: one of the best ways to understand the human mind is to try to replicate it. Topics like artificial intelligence, machine learning, computer vision, and natural language processing are at the forefront of not only computer science, but also biology, psychology, philosophy, and mathematics.

Note that the above list doesn’t really mention coding or programming, because they are just tools that can perform computation: they are not, in and of themselves, computer science.

Computer science is no more about computers than astronomy is about telescopes, biology about microscopes, or chemistry about beakers and test tubes. Science is not about tools.

Michael Fellows and Ian Parberry

It turns out there is another tool that we rely on for computation even more: the brain! The goal of computer science is to teach your brain new, general purpose, and widely applicable ways to think. As technology becomes more and more ubiquitous, this new way of thinking will become just as important as physics, math, biology, and history.

All that said, thinking alone is not enough: we need to know how to apply it. In physics, you do experiments with scales, prisms, and magnets; in biology, you might use test tubes, plants, and petri dishes; in computer science, you learn programming.

What is programming?

Coding

Programming, or writing code, is how you instruct a computer to perform some operation. If you’ve never written code before, you’re probably used to interacting with a computer by clicking on things in an existing app. Under the hood, this app consists of code that tells the computer how to display the application, where to store or retrieve data, and how to react to your clicks.

All of programming is based on the principles of computer science we discussed above. It is remarkable that the same set of concepts - logic, algorithms, data, systems engineering - can be used to build everything from the web browser you’re using to read this post to the autopilot software on an airplane. Although programming involves lots of math and structure, it is also a remarkably creative exercise: you think products into existence, one line of code at a time.

Learning programming as part of a computer science education brings about a number of benefits:

  1. DIY: if you can code, you can build things for yourself. You can start simple: create a script to rename a bunch of travel photos or an Excel formula to help calculate your taxes. Then, get fancier: create a website for your portfolio; create a mobile app for your company; build a game to play with your friends.
  2. Troubleshooting: once you’ve built a few apps yourself, figuring out other apps is easier. Once you stop fearing the computer - the unknown - you will become a master of tech support. As technology touches every part of your life, knowing how to navigate it will become as important as knowing how to read.
  3. Career: the goal of learning computer science is not to become a professional programmer. We all study math, physics, and chemistry in school, but we don’t all become professional mathematicians, physicists, and chemists. However, if you do have a passion for it, you’ll find that software engineering is one of the highest rated, highest paid, and fastest growing jobs out there.

Putting it all together

Binary

Let’s recap:

  1. Computer science is a new way of thinking. The concepts in it are useful for every single person in a technology-filled world.
  2. Programming is an essential part of learning computer science by applying the new way of thinking. However, by itself, programming is not nearly as general purpose.

Confusing these two concepts is causing problems for the learn-to-code movement. Slate published an article called Maybe Not Everybody Should Learn to Code; the Atlantic wrote Should Journalism Schools Require Reporters to ‘Learn Code’? No; Jeff Atwood wrote Please Don’t Learn To Code, where he asks a question that neatly summarizes the confusion:

How [would] Michael Bloomberg be better at his day to day job of leading the largest city in the USA if he woke up one morning as a crack Java coder?

This is, of course, the wrong question. It is the result of public campaigns that suggest that learning to code, as opposed to learning to think, is the end goal. If even Jeff Atwood, an experienced and respected programmer, is fooled by this distinction, then the average person has no chance of getting it right. The question we should be asking is:

Would Bloomberg—or anyone else—be better at their job if they improved their ability to think by learning new problem solving strategies and developing a better grasp of logic?

I think the answer here is obvious. As the world fills up with more and more technology, I think the answer becomes even more obvious. This is why we need to focus on teaching computer science and not just coding.

How to get started

Keep calm and learn to think

The good news is that you don’t need to wait for Code.org to get this message - you can start learning computer science right now! In fact, it’s one of the easiest topics to learn, as all you need is a computer and an Internet connection, and if you’re reading this post, you probably have both.

Here are some great resources to get you going:

University courses

  1. Coursera
  2. Udacity
  3. MIT OpenCourseWare
  4. Stanford Engineering Everywhere
  5. Academic Earth

Online tutorials

  1. Khan Academy
  2. Treehouse
  3. MIT Scratch
  4. Codecademy
  5. Code School

Communities and clubs

  1. CoderDojo
  2. Girls Who Code
  3. Girl Develop It
  4. Code.org
  5. Coding meetup Groups