learn to code

Learn to Code – A Detailed Guide (with videos!)

Learning to program as a humanities person is one of the best ways to improve your employability and demonstrate intellectual flexibility to potential employers. At Human Jobs, we think learning to code is an amazing idea and have written an entire post about why it is so worth pursuing. If you are ready to learn to code, this guide will explain some important concepts and recommend amazing resources to kickstart your journey.

How to learn to code: don’t quit and practice!

The biggest obstacle in learning to program is quitting during your introductory course. Coding is a rich and interesting subject, but let’s be honest, there is a very steep learning curve at the beginning.

Just setting up a development environment – the place where you actually type your code and run it– can be tricky and kill your programming dreams before you even get started.

There is also the dual challenge of learning a new language while learning new concepts.

Unlike learning a new human language, where you learn new vocabulary and grammar that map onto ideas you already know, learning to program is completely different.

Both the grammar and the concepts will be new to you, so it is much easier to get overwhelmed and just give up.

As you learn, try to separate the concepts from the specifics of the language. This way you will avoid getting overwhelmed by both.

Learning without practice = no learning

Coding is not something that can be learned from reading books or passively listening to lectures.

The only way you will make progress is to practice the things you have learned in class. For humanities students, the closest parallel is probably active notetaking while reading a book.

Just as you annotate interesting quotations, you must commit to practicing the new concepts encountered in each lecture of your chosen course. My recommendation is pausing lectures, typing out the code, and running it yourself as you watch the videos.

All the of courses recommended below provide you with the code used in lecture, so you can easily follow along and tinker.

I cannot emphasize enough how important this is. If you wait until the problem set or exam to actually write code, you will fail, become dispirited, and quit.

3 tips on how not to fail

  • Listen to programming lectures when you are wide awake. As I said, you must be ready to participate and break code during the lecture. If you find yourself passively listening, you might as well do something else. There is basically no point in just listening to a programming lecture.
  • Prepare to become incredibly frustrated. You will sometimes become super frustrated while learning to program. Just accept this. When you cannot find a sneaky bug or are lost trying to write your first recursive function, you will experience a particular kind of intellectual hell. But trust me, the satisfaction when you find that bug or write down the correct function will be enormous. And every moment of frustration that you ultimately resolve is a major point of learning. You won’t forget the annoyance, so you won’t repeat the mistake.
  • Take breaks when stuck. It is very easy to fall into a deep dark hole when coding, especially at the beginning. When you are faced with a seemingly impossible task, go for a walk, watch a movie, take a break, and come back later. On so many occasions, I would discover a bug that had stumped me for hours right after a twenty-minute break. Well-chosen breaks can make you a more efficient learner, so use them wisely.

Now onto some practical questions and resources to get you started.

Working in coffee shops? Don’t get hacked.

If you are like me and love working in coffee shops or frequently connect to public WIFI, having a VPN is an absolute must. A VPN, or virtual private network, is a crucial tool for protecting your activity on the web from hackers in public places. At Human Jobs, we use NordVPN and think it is reliable, secure, and fast. We highly recommend it, so head over here to get yourself set up.


Which programming language should I start with?

This is a question many beginners spend a lot of time stressing over. But it really isn’t very important.

Every programming language has its own quirks and learning the syntax and conventions of any language will take time. But the real challenge of learning to program isn’t language-specific. The real challenge comes from learning novel and powerful concepts, like abstraction, recursion, and composability, to name a few.

No matter which language you start with, after a few weeks you will develop the muscle memory necessary to write basic programs.

Like learning human languages, there is often a lot of frustration at the beginning when you forget a semi-colon here or insert an incorrect comma there. Just like learning to spell, these mistakes recede with practice.

Plus, once you have a firm grasp on the basic concepts and are familiar with one programming language, it becomes much easier to learn your next language. The investment of time with your first language will definitely pay off when you acquire others later on.

Okay, but which one should I choose?

Here are some great languages to start with:

Python

Python is an amazing first programming language because it has a relatively simple syntax. Syntax is just the set rules that determine what Python code will run. This simplicity is great because it forces you to focus on concepts rather than syntax from the outset.

When you encounter your first challenging concept in Python, you’ll be focused on the idea rather than how to express the idea.

Beginners tend to like Python because you can get started easily and impress your friends quickly.

Virtually every programming course begins with printing “hello world” to the screen. Below is a 20-second video of me printing “hello world” in Python. You can appreciate how simple it is to write this basic program in Python.

“hello world” in Python

Simple, elegant, and intuitive.

And because Python is an interpreted language, you don’t have to worry about the interesting, but complicated process of compilation that is required in other languages, like C. Interpretation versus compilation is a huge topic, which is beyond our scope here, but is fascinating and something you’ll learn about if you stick with programming.

Python is also great if you want to do machine learning, because the most popular machine learning libraries are written in Python. Libraries are basically just a collection of tools, which other people have created and are available for you to use.

If you want to start with Python, here are some great courses in order of increasing difficulty:

  1. Python for Everybody (University of Michigan/Coursera). iconThis is a great place if you have zero experience. The course walks you through everything required to get set up. Setting up a coding environment is actually a major hurdle and a lot of people quit because of this challenge, so being walked through the setup is really helpful. If you are particularly worried about these initial hurdles or have quit a programming course because of setup issues, make sure to check out CS50 below. The course is also part of a sequence of courses, so you can move right on to the next course in the sequence if you like it. Python for Everybody has super high ratings on Coursera and has a flexible schedule, so is very suitable for people who want to fit programming alongside a job or full-time study.

Here iconis the link to signup for Python for Everybody.

  1. Introduction to Computer Science and Programming in Python (edX/MIT). This is an amazing course, which is the introductory computer science class at MIT for people with no background in the subject. The course is very well taught but has much less “hand holding” than Python for Everybody. Although there are instructions about setting up a programming environment, you will be on your own to install the required IDE (interactive development environment – the program where you actually type in the code and run it)

The course also moves faster than Python for Everybody and the problem sets are quite a bit harder. But the course assumes no prior knowledge, so if you are able to commit the time, Intro to CS is really worth the time. You will feel a real sense of accomplishment after finishing the course, and it also has a follow-up which is focused on data science applications.

Check out the course video for Intro to CS:

  1. Structure and Interpretation of Computer Programs – CS61a (UC Berkeley) Although this is an introductory course, it does require knowledge of Python fundamentals from the beginning. This is my favorite online computer science course. It is so well-taught and will profoundly change the way you think about programming.

But only take this course, if you have some background in programming. It moves way too fast for total beginners, and you will likely get discouraged and quit (remember: the main goal of learning to program is not quitting!) But for those who have some experience under their belts, take CS61a from Berkeley – totally life changing! It is free, as well. Here is the link.

C/C++

C and C++ are two other languages that are also great for beginners (they are often discussed together because they share many similarities – we’ll just say C going forward, but everything said here applies to C++, as well. To be precise, C++ is often termed a “superset” of C because it contains C but has extra features.).

C is a relatively old programming language – much older than Python – and its syntax is  more complex than what you’ll encounter in Python. Plus, C is a compiled language which means you can’t just press enter to run your program. You will need to compile it to generate an executable, which you then can run. Check out the video below to see what that looks like.

This all sounds intimidating and not beginner friendly!

But C has some other advantages. C is a “lower-level” programming language than Python which means you will learn more about how computers actually work when executing code. Python “abstracts away” many of the low-level details you will work with in C.

C is empowering

It is really empowering to learn C because you will come away with a good fundamental understanding of what goes on underneath the hood when you develop and run a program.

Although the semicolons and curly braces look very scary at first, you won’t think twice about them after a few weeks.

Here is how to print “hello world” in C:

#include <stdio.h>
int main() {
   printf("hello world\n");
   return 0;
}

If you want to see what it looks like to write “hello world” in C, compile it, and then run the executable, here is a one-minute video of me doing just that:

“hello world” in C

Maybe that looks ugly but trust me, once you have mastered the basic syntax, you will feel really powerful when you can confidently program in C.

You will notice the extra step compared with Python when I compiled the code into an executable. That was the bit when I typed in “gcc hello_world…” at the so-called command prompt.

That is the kind of interesting and fun stuff you will learn in C, that you don’t get in Python.

And there are many more topics, like memory allocation and pointers, that you will not encounter in Python but are fundamental to how computers work and really useful to know.

Top C/C++ Learning Resources:

  1. CS50 (EdX/Harvard). This is probably the single best introductory computer science course available online and is reason enough to learn C. There are tons of directions about setting up a coding environment, so there is little danger of getting overwhelmed and quitting at the beginning. The course is also well-paced and has a very straightforward structure. Each lecture has an accompanying problem set and a series of explanatory videos that provide more depth on the topics covered. The lecturer, David Malan, is incredibly clear and very entertaining. He does his best to make the course approachable without dumbing it down too much.

Here is the video intro to CS50:

2. Accelerated Introduction to Computer Science (University of Illinois/Coursera). This is a more advanced course for those who already know some programming. The course delves deeper into data structures and algorithms, topics which are fundamental to mastering basic computer science. It is taught in C++, and it also introduces topics from object-oriented programming, which is an important programming paradigm. I took this course after CS50 and thought it was a fantastic follow-on that built directly on CS50 material. Sign up for the accelerated Introduction here.

3. Introduction to Programming in C++ (edX/NYU). Look back at the code snippet written in C. C and C++ are a bit weird, so having another resource to hear different explanations and get a fresh perspective can be really helpful. This course from NYU should give you a nice grounding in the subject and introduce you to ideas from object-oriented programming, which aren’t covered in CS50.

Important tip: You will never find the perfect course or book

When I was learning to program, I was constantly searching for the perfect course that would meet all of my needs. But such a course doesn’t exist, and it is more important to find a couple great resources that complement each other.

As you encounter challenging new concepts, you may require several different explanations before the idea sinks in. That is why it such a good idea to learn across a couple of different courses/resources at a time.

Main takeaway: mix and match until you find the right learning cocktail for you.

5 more resources to help along the way

Learning to code is a journey, and drawing on multiple resources is one of the best ways to keep momentum and avoid quitting. Here are five more resources to help you along the journey:

  1. Computer Science: Programming with a Purpose (Coursera). This course is taught by two legends from Princeton, and unlike the courses discussed above, this one is taught in Java. Java is a very popular programming language and also suitable for beginners. Programming with a Purpose is the perfect preparation for Princeton’s more advanced course on Data Structures and Algorithms (also in Java). Check it out here.
  2. Teach Yourself Computer Science (TYCS). This isn’t a course but a detailed list of online resources on computer science. Programming and computer science aren’t the same thing, and the detailed reviews of learning materials on TYCS will introduce you to a many topics that a programming course might not cover. The list covers an enormous range of fields, but if you are looking to build skills over the long-run, this is an awesome resource.
  3. Lecture Notes from Introduction to C++ (MIT/OCW). These lecture notes are more here for reference, but it is always good to get different perspectives on new material. As you take CS50 or another C-based course, it can be really helpful to have a detailed written version of topics in C and C++, and these lectures notes from MIT can be really helpful.
  4. The C Programming Language by Brian Kernighan and Dennis Ritchie. This is the proverbial “bible” of C, written by the two creators of the language. It is definitely not the main resource you should use in learning C, but it is an incredibly valuable resource throughout your journey.The exercises are fantastic and will really help solidify your understanding of basic C. You can’t just read the book though – you must use it as an excuse to practice if you are going to get anything out of it.
  5. Learn Python 3 the Hard Way by Zed Shaw. This is a pretty controversial book, but I include it because some people absolutely adore it.

The reviews, in general, are pretty polarized about this book, and the author (Zed Shaw) is a straight shooter, who takes an unorthodox approach to teaching Python. He doesn’t shy away from the hard bits, but he is a very clear writer. Maybe you’ll love this book, maybe you’ll hate it. But it is worth checking out in case it works for you.

Final Thoughts

Learning to program is a huge undertaking, but it can change your life. It is especially cool how much you will be able to do even without mastering the subject. You won’t become proficient overnight. But within a few weeks, you will likely surprise yourself by how powerful you feel at the computer. That is a fantastic feeling.

Even if you don’t become a full-time developer, basic knowledge of programming is a huge asset on the job market. The sooner you add this tool to your arsenal, the faster you will begin achieving your career goals.

Comment below with thoughts and questions. And check out other posts on HJThoughts about writing, interview tips, income streams, and more!

Another thought on data and VPN’s

Data is the new oil. So if you give away data for free, you are being robbed of an important resource. Even worse is getting hacked. VPN’s provide an important layer of protection between you and adversaries who are looking to steal data. Whenever you connect to public Wi-Fi, use a VPN. We think NordVPN is a fantastic option, so check it out below.

Careers, coding, computers, English Majors, Entry Level, Job search, Lifelong learning, programming, skills, Uncategorized

Leave a Reply