Learn to Code: A Beginners Guide

So you want to learn to code, huh? Excellent! I think you have made the right choice AND have come to the right place! The problem that most people in your shoes run into at this point of the journey is not knowing where to start. And that is precisely what this post is going to help you figure out.

When most people begin to investigate what it takes to learn to code, the process usually goes something like this:

  1. Search the internet for “learn to code”
  2. Read a few articles that tell them the “must learn programming languages of <insert current year here>”
  3. Try a couple of samples and copy code that is provided
  4. Get stuck on where to go next
  5. Lose interest and motivation
  6. Quit

This is a terrible cycle that I see repeated over and over again. And I take this very personally.

As a professional software engineer and someone that has taught hundreds and thousands of people to learn to code, I feel we can do better. That’s why, in this post, I will teach you a tried and true method that can help you learn to write code. Not only will it teach you how to write code, but it will give you guidance to succeed and stick with it for a long time.

So grab a pen and paper, or your favorite text editor, and get ready to take some notes! You are about to learn the process to become not just a coder, but a successful software developer!


 

Start At The Beginning

The title of this section may sound obvious, but the problem is that most people don’t know where the beginning is. How are you going to learn ANYTHING new if you don’t know where to start?

As I mentioned in the first section of this post, after doing a little searching, most people find a list of “must learn” languages and start there.

WRONG!

Just trying to learn a programming language for the sake of learning a programming language is a recipe for failure. Why? Because, learning a programming language is BORING! It’s just a bunch of keywords, structure, syntax …. ZZZZZZZZ.

OH! Sorry, I guess I fell asleep there for a second.

See! That is some boring stuff.

Now don’t get me wrong. In order to learn to code, you will need to learn at least one programming language. But for the sake of your sanity, PUH-LEASE don’t start there! In order to set yourself up for success, you need to start from a different direction. And that direction is inside your own head.


 

Find the Correct Starting Point

In order to successfully find the correct starting point to learn to code, you need to do a little thinking and self-reflection. So follow me down the rabbit hole for a few moments.

Think back to the last time you tried to “learn” something through straight memorization. It could be anything. Maybe you were cramming for a test in school. Trying to memorize someone’s phone number. It could literally be anything. Was it easy to retain that information? Could you recall it 5 minutes later? How about 15? What about even a day later?

Probably not.

learn to codeDon’t worry. This is completely normal. The information you store in your brain is very volatile. Which means it is very hard to put things into your memory and have then stay for long periods of time. Especially if it is just a bunch of seemingly random information.

That’s what it’s like trying to “learn” or “memorize” a programming language. Your brain is going to treat it like a bunch of random information and, believe me, it will not last in your memory very long. Sure, you might remember a few pieces, but the vast majority of it will be gone within 24 – 48 hours.

Don’t worry, there IS a solution.

Studies have shown that using associations (or memory palaces) when trying to study or memorize something helps to better “burn” that knowledge into your memory. Your brain works better when it can associate facts and concepts with other concrete visuals. So how can you better learn to code and ultimately learn a language? By building an association. So let’s work towards that.

Start With Something You Know

Believe it or not, the first thing you need to do if you want to learn to code is to identify a very common activity that you take part in during a normal day, or even week. You can stretch it to even monthly if you want, but I find that it works better if it is something you do a little more regularly. It can be anything from the simple and mundane (going to the grocery store), or something exhilarating (maybe skydiving).

This event should be something you are fairly well versed in. Meaning, you need to know what you are doing already. It shouldn’t be something you need to do a lot of research to figure out. Remember, something you are familiar with.

Now, I want you to think about this activity. Break it down into small activities and think about them individually.

For example, if your event is going to the grocery store, maybe your list of activities looks something like this:

  1. Plan meals for the week
  2. Look up recipes for meals
  3. Figure out which ingredients you don’t already have
  4. Make a shopping list made up of ingredients you need
  5. Find time to go to the grocery store
  6. Go to the grocery store
  7. Put groceries away

This is just my sample list for my chosen activity. Remember, you are free to go into as much detail as you want. The more the better.

Choose an Area For Automation

The next step is to look at the list of activities you put together and identify a part of it that some sort of application could help with. When I look at my sample list in the previous section, I can think of at least six applications that could assist with this process. Here they are:

  1. Meal scheduling (finding which days you need to make meals)learn to code
  2. Meal planning (identifying the meals that you want to make)
  3. Recipe storing (saving recipes & ingredients needed for the week)
  4. Ingredient inventory (keeping track of what ingredients you have and how much of them)
  5. Shopping list creation (generate a shopping list based on weekly meal ingredients and what you have on hand)
  6. Grocery shopping scheduling (tracking family schedule/calendar to find time to go shopping)

As I said, these are just the things that came to mind fairly quickly. Given your activities and a little bit of time, I bet you could come up with several as well.

So take a little time and write down your own activity list based on some sort of common event you are familiar with. Now pick one that sounds useful and interesting and …

CONGRATULATIONS!!!!

This is your first application you are going to write as you learn to code!


 

Choose Your Vehicle

Now that you have identified what sort of application you are going to write as you learn to code, it’s time to figure out how you are going to get there. In other words, you need to pick a vehicle. And that vehicle is…

A programming language.

This is where you are going to figure out which programming language you are going to learn that is going to help you accomplish your goal of writing the application you have picked. And let me give you a little bit of a hint as to the programming language you will need to get there.

IT DOESN’T MATTER!!!

That’s right, with a few exceptions that we really don’t need to go into detail on right now, just about any programming language will work. That may sound crazy, but it’s true. I’m not even going to give you a list of possibilities. Why? Because, at this point, you are too primed for influence. If I say you should consider using language flippidity-doop (which isn’t actually a programming language as far as I know), you would start by looking up flippidity-doop.

So…how do you find a programming language?

You are in luck. I have written another post that is a guide that will teach you exactly how to find which programming language to learn. Not only will it teach you which programming language to learn, it will also teach you which kind of application to write and which type of platform it is going to run on. Sound awesome and confusing?!

That’s OK. It will make more sense when you read it. So I will leave you to it to go read that post once you have finished this one.


 

Break It Down!

Wait?! Again?!

Yes, again.

It’s now time to take a look at the activity/application you chose previously and break it down into little, itty-bitty, bite-sized pieces.

How far?

Nearly gory details far.

How about an example?

For my example, I’m going to take idea #4 from above (Ingredient Inventory). I want to break this down into little chucks (or sub-activities) so that I can figure out exactly what this application needs to do. In order for this to be successful, you need to think about the little details that you probably do without thinking.

Remember…Computers are dumb.

learn to codeIf you miss a step that you just know about inherently, the computer will miss it and you will create your first BUG. But that’s OK. It’s actually very normal. Bugs are a part of writing software. I wrote a bug one time that ultimately cost the company that I worked for nearly a half a million dollars. OUCH! So know now that it is going to happen. Make your peace with it.

My activity is broken down into the following steps:

Ingredient Inventory

  1. Create a list of ingredients that I currently have in my pantry, refrigerator, and freezer
  2. Include the following pieces of information about each ingredient
    1. Name and Amount on hand
  3. Every time I use an ingredient, reduce the amount of that ingredient I now have on hand
  4. Every time I go shopping, increase the amount of that ingredient I now have on hand

There we go. I broke my activity / application down into 4 sub-activities.

WARNING: At this point, if your activity is broken down into more than 5 – 7 activities, I would strongly suggest that you either simplify your idea (application) or choose a subset of the sub-activities that you want to work with. The more the sub-activities, the more complex the next step will be.

Explain It to a 5 Year Old

learn to codeA 5 year old?!

Yep.

Remember what I said about computers in the last section? They’re dumb!

Telling a computer what to do is like trying to get a 5 year old to do anything. A 5 year old is capable of doing lots of things. But, unless you break it down into very small manageable chunks that are clearly defined, that 5 year old is going to wander off the tracks and all heck is going to break loose. So you want to dumb it down even a little farther than you may think.

So here is my list of instructions for the 5 year old:

Ingredient Inventory – 5 year old instructions

  1. Create an empty list of ingredients
    1. An ingredient has a name and an amount
  2. For every ingredient found in the pantry, refrigerator, and freezer
    1. If that ingredient exists in the list
      1. Add the new amount to the existing amount for that ingredient
    2. If that ingredient doesn’t exist in the list
      1. Add the new ingredient to the list
      2. Set the amount on hand for that ingredient
  3. For every ingredient that I use
    1. Remove the used amount of that ingredient from that ingredient in my list
    2. If the ingredient in my list now has an amount of 0
      1. remove it from the list
  4. For ever ingredient that I buy
    1. If that ingredient exists in the list
      1. Add the new amount to the existing amount for that ingredient
    2. If that ingredient doesn’t exist in the list
      1. Add the new ingredient to the list
      2. Set the amount on hand for that ingredient

Now go through your list of activities and break it down into details similar to my list here.

Here are a 2 very important tips to remember:

  1. Think of activities that happen together in groups and bundle them together.
    1. Use words like “for”, “for each”, “while”, etc to go through the activities in a list
    2. Activities that take place in these groups should be indented under the line that starts with these words
  2. Mark decision making steps with words like “if”, “else”, etc
    1. The activities that take place as part of these “if” and “else” statements should be indented under them as well

Congratulations!

You just put together your list of instructions you want your computer (or a 5 year old) to take care of. This little gem of a list that you just put together is what is known as pseudocode. This is a very important topic that we will cover a lot here at Start Writing Code, but we will save that for another day.


 

Start With Your Language

Now it’s time to get your hands dirty and actually learn to code with your selected language. You have identified the application with instructions and pseudocode that you are going to write. You have hopefully gone through the other post to choose a programming language. And now it’s time to get to work.

Here is the process to get started with your application.

First, you need to figure out what kind of online learning you prefer. Some people like reading articles, while others like watching videos. Choose a learning method and head out to your favorite search engine and use the following search query:

<type of learning> tutorial for learning <language>

So, let’s say that my favorite way of learning is video tutorials and my language was C#, then my search query would look something like this:

video tutorial for learning C#

In those results, I’m going to pick one or two of those tutorials and follow them from beginning to end. This is going to give me some background in that language, hopefully force me to actually install some tools on my computer, write some code, and see things happen because of what I did.

Along the way, I want to make note of some of the websites that I visit that I like so that I can refer back to them later when I need to refresh my memory on how to do things with that language.

Make Some Modifications

This part of the process when you learn to code is incredibly important. When you follow any tutorial online when learning a programming language you will probably follow it word for word. Meaning, you are going to write (or copy) every line of code that it tells you to the letter. That’s fine at the beginning, but it will cage your knowledge and understanding to only what you were told.

Now you need to make some changes.

More than likely, when you followed the tutorial you will have some sort of functional (albeit simple) application. Now you need to user your imagination and make some changes. Look at the code and walk through what it is doing in your head. Now pick something it’s doing and change it. I don’t care how simple the change is, just make a change.

Re-run the application and see what happens. Do this a few times.

A couple things are probably going to happen:

  • You are going to get a better understanding of how the code is functioning
  • You’re confidence in writing and editing code will grow
  • The code will break and won’t run (a bug)
  • You will need to fix some broken code

These seemingly simple tasks are exactly what I do on a day-to-day basis in my day job. And this is exactly what I have done for the last 15+ years. This is how you learn and get better at this. By doing it.

You are so close! Only one more step!


 

Write Your Own Code (From Scratch)

Using the fundaments you took from the previous section, your new knowledge of a programming language, and some target instructions that you can explain to a 5 year old, you are ready to learn to code.

Now is where you build your coding muscle.

Take a look at your list of instructions, one at a time, and start to create a new application to implement those tasks. The key idea here to to go slowly. Start from the beginning and work through to the end.

Odds are fairly good that you are going to run into a few operations you need to write that you aren’t going to know how to accomplish. This is great! Want to know why this is great?

It happens to me almost daily!

I’ve been writing code for many years and I still don’t know how to do everything. Not only do I not know how to do everything, I learn the same things many times over and over throughout the years. Which means I forgot how to accomplish certain tasks in a programming language quite often. Don’t worry if this happens to you.  It’s normal.

Finding Solutions

If this happens to you, you simply go back to your favorite search engine and use the following query template:

how to <difficult operation> in <your programming language>

Following my previous example, let’s say that I’m not sure how to add a new object to a list in C#. Then my search query would look something like this:

how to add an object to a list in C#

How do I know that you will be able to find the answer to your problem on the internet?

Because there are probably thousands of people that have run into the same problem you are running into now. And because of the internet, they were not only able to find the solution, but many of them have also created posts to help other people like you.

The goal here is simply to work through all your steps and create a simple, yet functional, application that you can actually use. Start simple. Don’t worry about being fancy.  Just get something to work. You can always go back and tweak it. Evolve it over time. But if it is something that you can actually use in your day to day (or week to week) life, you won’t mind it. It will actually become fun for you.


 

Rinse And Repeat

Congratulations! You have now written your first application and are moving down your own personal learn to code path. So where to from here?

Do it again!

If you are truly interested in learning to code and building the process of writing code as a skill, you need to do this more. A lot more. So every once in a while go back through your list of things you do on a daily or weekly basis and update it. Pick a new one. And follow the same process.

The more you follow these steps and write little applications for yourself, the more you will commit not only this process to memory, but you will also start to commit whatever language you chose to memory. And that’s the beautiful part. You are going to start to memorize this programming language through association via these applications that you write that are useful to you.

This will make learning this language and any other language that you choose easier and easier. Because, you are no longer just trying to memorize a bunch of random keywords, structure, and syntax. You are putting these things to use in a context that makes sense to you.

Magic!


 

In Summary

There you have it!

A simple, structured approach to help you learn how to code. It really isn’t all that hard. The most important thing to remember in all of this is to not start with a programming language. You are more likely to get overwhelmed and quit if you start there.

Instead of trying to force a programming language into your memory, make the programming language you are ultimately going to learn part of something that you can relate to. Then follow this repeatable process:

  1. Identify a process in your life you can automate
  2. Choose your own appropriate platform and language
  3. Break the process down
  4. Learn your programming language
  5. Build your application
  6. Rinse and repeat

By following this process over and over again, you are going to really start to build some coding muscle and more importantly, you are going to start to have some fun doing.

And in the end, that is what is going to make this new skill of yours stick for the long run.

Finally

Please leave a comment below and let me know what process in your life you are automating and what platform and language you have landed on. I would love to hear about all of your projects!

Happy Coding!

Leave a Reply

Your email address will not be published. Required fields are marked *