You Need To Learn How To Program

Make a free weekly coding lesson your New Year’s resolution.

Learning computer programming.
Code Year is a free computer coding course.

Photograph by iStockphoto/Thinkstock.

If you’re looking for a New Year’s resolution, let me suggest an idea that you might not have considered: You should learn computer programming. Specifically, you should sign up for Code Year, a new project that aims to teach neophytes the basics of programming over the course of 2012. Code Year was put together by Codecademy,* a startup that designs clever, interactive online tutorials. Codecademy’s founders, Zach Sims and Ryan Bubinski, argue that everyone should know how to program—that learning to code is becoming as important as knowing how to read and write. I concur. So if you don’t know how to program, why not get started this week? Come on, it’ll be fun!

Code Year’s minimum commitment is one new lesson every week. The company says that it will take a person of average technical skill about five hours to complete a lesson, so you’re looking at about an hour of training every weekday. That’s not so bad, considering that the lessons are free, and the reward could be huge: If you’re looking to make yourself more employable (or more immune from getting sacked), if you’d like to become more creative at work and in the rest of your life, and if you can’t resist a good intellectual challenge, there are few endeavors that will pay off as handsomely as learning to code.

But this isn’t only about you. Let’s talk about how all of us—our entire tech-addled society—could benefit from a renewed interest in coding. Over the past 20 years, and especially in the last five, computers invaded every corner of our lives. Most of us accepted their ascendancy with grudging tolerance; even if they’re a pain to use and don’t ever work as well as they should, these machines often make our jobs easier and our lives more enjoyable. Part of the reason we’ve all benefitted from computers is that we don’t have to think about how they work. In their early days, the only way to use a computer was to program it. Now computers require no technical wizardry whatsoever—babies and even members of Congress can use the iPad. This is obviously a salutary trend. I’ve long argued that computers, like cars, shouldn’t require technical skill to operate, and the easier that computers are to use, the more valuable they’ll be to all of us.

Yet the fact that any moron can use a computer has lulled us into complacency about the digital revolution. You can see this in the debates over SOPA, the disastrous Internet piracy bill that has been embraced by politicians because many of them simply don’t understand its technical implications. Or, as Thomas Friedman points out, consider the absence of any substantive topic relating to technology from the Republican presidential debates.

I noticed something similar in the summer, when I published my series about the robots that are poised to steal high-skilled workers’ jobs. I was surprised, during my research, to find that many people who are vulnerable to replacement by machines had no idea how quickly they could become irrelevant. Lots of people I spoke to insisted that their jobs required too much schooling, or relied on several “fundamentally human” skills, and would likely remain forever dominated by humans. (That’s what travel agents thought, too.) There’s bliss in this kind of ignorance, but it’s dangerous. You don’t need to know how a computer works in order to use it—but if you learn how computers work, you may avoid one day working for them.

There’s no better way to learn how computers work than to start programming. “Learning to code demystifies tech in a way that empowers and enlightens,” Gina Trapani, the app developer and former editor of Lifehacker, wrote when I emailed to ask how coding had changed her life. “When you start coding you realize that every digital tool you have ever used involved lines of code just like the ones you’re writing, and that if you want to make an existing app better, you can do just that with the same foreach and if-then statements every coder has ever used.”

Programming can come in handy even if you work in a nontechnical field. Say you were a travel agent in the 1990s: If you didn’t know how to code, you wouldn’t have been able to see the coming demise of your profession. But if you’d dabbled in programming, not only would you have had the skills to appreciate how the Internet might hurt your profession—you might also have been able to play a part in the online travel bonanza, either by building your own travel site or going to work as an expert for one of the new Web travel firms.

Sims, the co-founder of Codecademy, says there are countless such opportunities in the workplace—places where a little bit of code can make you much better at your job. “When we were raising money, we met one investor who created a script for Angel List”—an online directory of startups looking for cash. “When a company would hit a certain number of followers on Angel List, his script would automatically send out an e-mail to the company looking for a meeting. That’s an example of how knowing a tiny bit of coding helped him get better deals without hiring an associate,” Sims says.

But knowing how to code will improve your life even if you don’t ever program anything useful. I learned the Basic programming language when I was a kid, and then I sharpened my programming skills in high school and college. I am by no means an expert programmer, and I rarely take up coding in my job, but I learned enough to alter the way I approach problems. And that’s the most interesting thing about taking up programming: It teaches you to think algorithmically. When faced with a new challenge—whether at work or around the house—I find myself breaking down the problem into smaller, discrete tasks that can be accomplished by simple, repeatable processes.

Want to train your baby to sleep? Try this algorithm, which my wife and I found in a book called The Sleepeasy Solution when our then 1-year-old was driving us crazy every night. At bedtime, put your baby in the crib. Leave him to cry for five minutes, and then go in to comfort him for 30 seconds. Next, leave him to cry for 10 minutes before you comfort him, and after that go in to comfort him every 15 minutes. Do it until he sleeps, which should happen in an hour’s time.

After a few days of this, our baby was sleeping through the night for the first time in his life. I can’t say for sure that this method worked because it was a well-defined algorithm, but I suspect that was the case. Babies, like computers, seem to like predictable, rigid routines. Maybe we’re all born with a capacity to think in code—and perhaps it’s time you took advantage of that awesome power.

Correction, Jan. 4, 2012: This piece originally and incorrectly referred to Codecademy as Code Academy. (Return to the corrected sentence.)