Skip to main content

Anyone can code

· 5 min read
Ohm Patel

Trust me when I say anyone can code...

Really? Anyone?

Coding is hard.

I have to be very smart to code.

I’m doing [INSERT OTHER CAREER HERE], I can’t possibly code.

It’s a common misconception that you have to be taught or go to school to learn how to code. In fact, the most successful coders I’ve worked with are those that are capable and willing to teach themselves.

Those same people come from varying backgrounds. Some young, some old. Some looking for their first job, some deep into their career.

Regardless, there’s a path here for everybody. The skill to teach yourself is by far the most sustainable and valuable to grow as a coder, and if you can build that into a habit, I have no doubt the outcome would be success.

What does it mean to code?

Before learning what coding is, you have to first understand what a computer does.

info

A computer is a system that executes instructions.

What does that mean? Simply put, a computer is the best assistant anyone can find. Anyone can tell it what to do, and unlike people, it will do it fast, correctly, and consistently.

caution

The above should excite you. If it doesn't, then we should go over the implications together.

Now the limitation of what a computer can do is mostly based on your imagination. If you can imagine it and explain it to a computer, then the computer can do it for you. This can be broken down into three steps:

Outcome

Have a vision as to what you want to have done. Do you want a computer to make a website or an app for you? Change the color of a button from red to green? Remember what you have to do tomorrow and remind you? The first step before even starting to type is to figure out what you want to do.

Decomposition

We have to be able to take that problem or outcome and break it down into steps and many smaller problems.

info

A computer is able to do a lot of things. But its intelligence is probably close to that of a 5th grader.

If you can break your problem down to the point where you can have a 5th grader do it, you can probably get a computer to do it without much friction.

Exercise

Before you move forward, I want you to write down a set of instructions to make a peanut butter and jelly sandwich. A fifth grader (Alice) has in front of her

  1. A loaf of bread
  2. A jar of peanut butter
  3. A jar of jelly
  4. A butterknife
Don't open the following until you're done!

Now take those set of instructions and imagine Alice listened to you, but took you extremely literally.

Here’s an example:

  1. Get two slices of bread
  2. Spread peanut butter on one piece
  3. Spread jelly on another piece
  4. Put the slices of bread together

Looks fine, right? Well, somehow Alice ended up with

THIS!

What happened? Well I wasn’t specific enough. Remember, Alice is going to take every single instruction I give as literally as she can.

Alternatively, let’s say the jar of peanut butter is closed. She could have gotten stuck at Step 2 and just stopped because nobody told her to open the jar.

Keep working on the same exercise and each time you create a set of instructions, see where Alice can mess up and be more specific.

Translation

Now that you have a set of instructions fit for a 5th grader, you have to tell the computer to do it.

This is the part people feel will be the hardest, where you have to actually learn a programming language. Luckily for English speakers, learning a programming language is not nearly as hard as learning another language. The instructions we give the computer are completely in English!

The difference is that the computer has its own subset of instructions it can do. Our job is to learn what the computer knows how to do, and morph our simple instructions into that language.

What does this look like?

Let’s say you have a list of fruits

  1. Apple
  2. Banana
  3. Pear
  4. Mango

And you want a 5th grader to go through each fruit, and count how many letters are in its name.

Simple enough, right?

Well for a computer this would look something like

fruits = [“Apple”, “Banana”, “Pear”, “Mango”]
for fruit in fruits:
number_of_letters = len(fruit)
print(number_of_letters)

which would output

5
6
4
5

Don’t get worried if this doesn’t make sense to you today. But let's break down what the above block is doing. We've broken our instructions down into...

  1. First, make a list of fruits. fruits = [“Apple”, “Banana”, “Pear”, “Mango”]
  2. Go through each fruit in that list. for fruit in fruits:
  3. Count the letters in the name of the fruit. number_of_letters = len(fruit)
  4. Write that number down and go to the next fruit. print(number_of_letters)

After putting that all together, the computer outputs the numbers 5, 6, 4, 5 which are the number of letters in each of our fruits' names.

Now what?

That’s it! You’ve just read your first program and are on your way to learning what it means to be a software engineer and programmer. It's not going to be easy, but if you were able to understand the above, you're making great progress.

caution

If the above didn't make sense to you, let's work together on exactly what didn't make sense and break it down into a simpler problem

Anyone can code, and that includes you!