Within the past two years, about a dozen people told me they’re extremely interested in learning how to code. Today, none of them are programmers, developers, or even hobby coders. Most of them, as far as I know, have never even opened a text editor.
The conversation always goes the same way. They want to learn, they have ideas, but it’s all too hard. One of my more determined friends — an art major — admired the idea of focusing on a single project all day, but he would routinely shudder at the sight of actual code.
In his words: “That crazy $%@! just makes me…just…ugh dude.” He clutched his side in mock pain and limped away.
I want to explore the reason they gave for not learning — that it’s too hard.
To be clear: I’m not going to try and say that coding is a walk in the park. A newbie cannot manage Facebook’s back-end systems. Obviously. Every programmer I know, myself included, worked very hard to untangle and understand the abstract concepts of programming, computer science, and development. Coding is most certainly not easy.
But it’s probably easier than you think. And that’s what important.
True Story Time!
We’ll call him John. John is a bright kid with a good heart, but by his own admission, he was never the left-brained type. He likes basketball, League Of Legends, and watching movies.
Two years ago, I was a staff member at a community event — details omitted for anonymity. John was there, and he seemed distracted. He was fidgeting anxiously — twiddling his thumbs and tapping his feet. Later, I saw him storm off. He slammed the door behind him. I followed.
He eventually confessed that his college applications were due in a week, but he hadn’t picked a major. He was so anxious that he couldn’t focus on anything else.
Initially, I did what all older people would do: I asked him what he was interested in. This led to a predictably useless end point: “I like a lot of things, but I don’t like any of them enough.”
In his book, Blue Like Jazz, Donald Miller says, “Sometimes you have to watch somebody love something before you can love it yourself.” So I started talking about what I do.
“I’m a web developer. I build sites by typing words on a screen.”
He didn’t immediately understand how words on a screen (that is, how code) could result in a functioning program, so I used atoms as a metaphor. When specific atoms are arranged in a certain way, you get all kinds of things with different behaviors and properties. Water, rifles, tacos — everything was built with atoms. The metaphor wasn’t perfect, but he seemed to understand the gist.
I stepped through some more examples with him. An hour later, we were talking about puzzles, loops, and simple algorithms.
And that’s when I realized. When non-coders see code, they see the text itself, not the ideas that drive the text. (It’s an obvious realization in hindsight, but yeah.) And in so doing, they miss out on everything: the elegance of the concepts, the fun of building something from scratch, the raw ingenuity of it all.
These are qualities that everyone has an appreciation for, not just some rare breed of human known as a programmer.
Here’s my goal with this post:
To make non-programmers realize that they already understand, intuitively, many of the basics of programming. I’m going to give you extremely basic introductions to four essential concepts in programming: syntax, variables, control flow/conditionals, and algorithms. My guess is: you won’t struggle at all to understand them.
This definitely not is a in English valid sentence!
How It Relates To Code: You probably stumbled through the above sentence a little bit. That’s because the syntax of that sentence is messed up. The order of words matter, both in English and in coding languages.
Just like we expect certain patterns of speech, so do computers — the only difference lies in the languages used.
You’re moving to LA to pursue a rapping career. Good on you. You’ve got stuff to pack, and different things have to go in different boxes. You use labels to help keep your junk organized.
How It Relates To Code: A code variable is like the label on a box. Since you can use a box to store anything (clothes, headphones, cats, etc), labels help you know what’s inside the box without having to open it up.
Computers do the same thing — they use a system of “boxes and labels” to store data. (This is a simplification, obviously.)
3. Control Flow & Conditionals
Question: Are you at least 18 years old?
- If yes, you CAN watch R-rated movies.
- If not, you CANNOT watch R-rated movies.
How It Relates To Code: Computer programs have to account for a lot of different possibilities. They test for conditions, just like we do every day. They just do it a lot faster.
By checking for conditions like this, a well-coded program can handle many different cases. This is referred to as control flow: controlling the flow of the program, usually based on conditions.
You’ve probably heard this word from some movie as part of a techno-babble speech. It basically just means a set of decision-making steps that help you get something done. And you have a bunch of algorithms already “built” into you!
Your Morning Preparation Algorithm, probably:
- Wake up.
- Is it a week day? If so, continue to Step 3. If not, go back to sleep.
- Go to the bathroom.
- Brush your teeth.
- Are you a girl? If so, proceed to Step 6. If not, skip to Step 7.
- Do you have a makeup routine? If so, do your makeup routine. If not, proceed to Step 7.
- Are you on a diet? If so, get an apple. If not, bust out three poptarts.
- Eat whatever you created in Step 7.
- Go to work.
This is an algorithm in plain English. It’s a single set of steps, but it’ll yield different results on different days and for different people. It may also utilize variables.
For example, steps 7 and 8 could be rewritten like this to use variables:
- Are you on a diet? If so, BREAKFAST is apple. If not, BREAKFAST is poptarts.
- Eat BREAKFAST.
How It Relates To Code: Programmers write programs containing algorithms, variables, and control flow to get stuff done. To solve some problem.
As you can see, all of these concepts sort of stack on each other. I think that’s sweet.
Some Closing Thoughts
For anyone who has been thinking about code as some arcane, cryptic art, it’s not. It’s certainly not easy, and it will uncomfortably bend your mind, but for some of you, it will absolutely be worth the effort. Coding encourages you to approach problems in new ways, to view situations more objectively, to juggle and consider many factors, and to constantly seek optimal solutions. And many of the fundamental concepts are things you already understand!
So, I hope that’s enough to whet your appetite. I’ve only barely scratched the surface, but this is only a blog post after all. Hopefully it’s a decent start that piqued your curiosity a little more. If you have any questions at all, feel free to email me directly at email@example.com. Otherwise, good luck.