Other Posts

What Does Learning to Code Actually Mean?

There’s a weird feeling that new programmers face: they’re working through an intro class, but despite their progress, everything they’ve learned somehow feels contrived and disconnected from real projects. They say things like,

“Finding a tutorial on while statements is easy, but learning when and where to use them is much more difficult." learner on /r/learnprogramming

How do you connect the dots between the abstract concepts you’re learning in class and realizing your cool app idea? The problem here is one of terminology. Learning to code, as most people use the phrase, encompasses a much broader set of skills than just programming.

You don’t want to learn how to program, you want to learn how to build cool stuff and “solve problems,” whatever that means. Any time you start a real coding project, you’ll be confronted by dozens of random issues that generally have nothing to do with programming in the narrow sense of the word.

Teachers wisely hide a lot of hairiness from students in intro classes, because they understand that teaching the core concepts is more important than all of the random trivia. When I took AP Computer Science in high school, it took most of the semester before I could tease out what all of this junk means, even though it was in every program I wrote:

public static void main(String[] args) { // huh?

It leaves the students feeling like they are trapped in a walled garden and that they can’t actually do anything without the teacher holding their hand. Sadly, they are basically right. The teacher was prudent hiding this stuff from you up front, but in reality, most of the time spent "learning to code" is spent learning things besides programming.

Starting something from scratch requires wading through tons of trivia, from setting up boilerplate to figuring out how to actually run the code outside of your editor. Some information will be broadly relevant, but some of it is probably a total waste of your time. Often, learning to code feels like walking into a maze in the dark.

Go do a project?

The most common and annoying piece of advice given to new programmers is that they need to go out and find personal projects to work on. The idea is that in order to really learn to code, you need to step out of the classroom and expose yourself to all of these random challenges.

It is well intentioned, but this advice is pretty useless. Most of the time, newbies will get totally overwhelmed and confused by the sheer complexity and variety of skills needed for even ostensibly simple projects.

Case study: building a Reddit bot

For example, imagine I get the idea to make a little reddit bot. If you aren’t familiar, reddit bots are little programs that read comments on reddit threads and automatically make some kind of funny or useful reply.

Factorial Bot is a silly little program someone wrote that detects whenever someone comments a number followed by an exclamation point, such as “I can’t believe you ate all 30!” It cheekily replies the solution to the factorial:

Factorial Bot

Seems like a decent project idea to me. I already know how to calculate a factorial with a for loop- it is a classic homework question. How much harder can it be to turn that into a reddit bot?

This notion illustrates the main problem with the “find a project” advice. If you are in unfamiliar territory, you won’t be able to guess how difficult a project will be. By just guessing, it is unlikely you’ll pick a project well suited for your current skill level. It’s even harder to tell if the reasons the project will be hard will translate into useful learning or wasted frustration.

Where to even start?

Getting started is always the hardest part. If I were to do this manually, I’d go to reddit every once in a while, read through posts, look for factorials, solve them, and post the reply. So a reddit bot needs to be able to read comments, process them, and make replies.

So how can get my program to read reddit comments? Right away, the learning curve is steep. Making a web scraper sounds complicated, but I know enough about the web to know that reddit has an API. I dig up the documentation, and it's a sheer wall.

"A modhash is a token that the reddit API requires to help prevent CSRF”

Sorry, but what the hell is this talking about? How do I use this to write my program? How do I do a GET? What’s OAuth? Do I know how to code or not?

I throw my hands up in the air and did what I should have done initially: I google “how to make a reddit bot” and find this guide. Now this seems more doable. The key is to use this nifty PRAW library.

A lot of real programming is just figuring out the right things to hook together. It is rare in the real world that you’d need to write a factorial program, for instance, because somebody’s already written that for you. But how was I supposed to know that PRAW existed?

By the way, how do I actually run this thing? Looks like I need to get comfortable with the command line. If I want to set it up to run on it’s own without my intervention, I’ll probably need to figure out some kind of cloud server thing.

Quickly, I’m diving deeper and deeper into web development. In the final product, there’s no trace of the factorial algorithm that inspired the project in the first place.

What does learning to code actually mean?

Lets summarize. Even for this simple project, “learning to code” requires a variety of skills:

Programming

The core of the project was my little function that takes a number and calculates a factorial. I can’t even consider making an app without knowing how to program, but programming itself is usually not enough to do anything interesting.

Secondary skills

For most coding projects, there’s a list of other skills only tangentially related to programming that you need to learn. For my reddit bot, I needed to know how to use the command line, make HTTP requests to a REST API, and set up a server, among others.

What does this actually mean? There’s no one answer because it totally depends on the project you are doing. If you want to make a web app, for instance, you’ll need to think about networking, databases, web design, and many other subjects. Check out the Web Development Guide for a detailed breakdown.

Surrounding technologies

As I mentioned, a lot of real coding is knowing how to hook up the right components together. That means finding random GitHub projects and memorizing a bunch of opaque acronyms. OAuth? CSRF? Writing the reddit bot became tractable when I discovered that PRAW thing, but how was I supposed to know to look for it? Coding must become pretty unpleasant if every project requires stumbling upon a new random solution.

Web development is especially notorious for having a huge number of gizmos. This is in some ways an unavoidable side effect of being the largest and most vibrant software ecosystem, but it makes learning to make web apps a mess of confusion and opinions.

Theory

For any of these random acronyms, its difficult to know how deep the rabbit hole goes. If you already know how the internet works, understanding CSRF isn’t too bad, but to learn REST, it wouldn’t hurt to understand HTTP and by the way all of computer networking while you’re at it. Time to crack a textbook.

Computer science and programming are not the same thing. Learning theoretical knowledge like networking is not programming, but you’ll need to fit that in to your learning plan as you transition from amateur to pro.

So what do you do?

Now things seem even hazier than they were before! If your teacher isn’t going to fully teach you how to code, how are you going to learn it? You need to be intentional. Do the research to figure out what you actually need to learn and why. For example, making websites isn’t programming, but you need to know how to do it before you can build your app.

Not sure if your project idea is a good one? The best advice I can give you is to find someone to help you. Leveraging the experience of a seasoned developer to point you in the right direction will help you convert time-wasting confusion into fun progress. Check out the mentor section in the Atlas. Email me and I'll help you myself.

Not sure where to even begin? I’ve written the Developer Atlas curriculum to help put the wide range of skills you’ll need in context. We'll start from the beginning and won't leave anything out. Along the way, I’ll give helpful suggestions and propose achievable projects that will push you just enough. You’ll learn quickly and (usually) won't feel helpless.