In case you haven’t noticed, the role of technology has changed quite a bit in the last 20 years or so. Slowly but surely, computers have permeated nearly every part of our lives, from what we buy, to how we get from place to place, to how we work, to where we eat after we clock out for the day.
For this reason and many others, coding is one of the most valuable skills you can build. Whether you want to advance your career, build software or games for your friends, or just understand the tech space better than before, learning the language of computers can be a major asset to your professional and personal development.
However, it can also be very intimidating. Before even writing my first program, I thought that computer programmers were an elite group of experts with talent beyond anything I could possess. From conversations I’ve had with aspiring programmers, this seems to be a common mindset — coding is a practice reserved for only the most prodigious tech whiz.
I want to make it clear up front that this isn’t true. With time, dedication, and internet access, anyone can learn to code. If you’re reading this, that includes you.
Depending on what you want to learn and how deep you want to go, you could spend a few months to the rest of your life learning, but everyone starts with the basics. That’s why, in this guide, we’ll unpack everything you need to know to get started writing code, including:
- Why you should learn to code
- What language to start with
- How to start coding
- Some valuable tips for anyone starting out
Why Learn to Code?
Before diving into your first lesson, first consider why you want to code in the first place. This will help you determine which language you decide to learn first, what sorts of projects you want to complete, and ultimately what you want to make of your skills. Here are some well-known benefits:
You’ll build professional skills.
Let’s get the most obvious out of the way: Knowledge of computer programming is a valuable employment asset. As technology continues to weave into our daily lives, coding skills will become more desired among candidates — according to job board Indeed.com, several of the most in-demand skills fall under computing.
If you’re not pursuing a strictly technical role, coding experience is a good asset nonetheless — it shows technical know-how and an ability to grasp abstract concepts and solve complex problems.
Finally, coding knowledge enables you to take up freelance work and perhaps pursue a full-time freelance career. With this path, you’ll have much more control of your career and the projects you accept.
You can create things.
One of the coolest benefits of learning how to code is the ability to bring your ideas to life. Have a concept for a website, app, or computer game? Now, you can build it exactly how you want, then share it with the world.
Whether you want to monetize your project, post it on an open-source platform like GitHub, or just make things as a hobby, you’ll have the knowledge and the tools to do so. It’s gratifying to know you can build programs that, until now, you’ve never fully understood. Plus, projects are essential to the learning and job-seeking process, as we’ll soon see.
You’ll better understand the world around you.
Like I said, technology is spreading and evolving year over year. Learning even just the basics of computer programming will help you understand the components of the growing digital landscape, including that thing you probably use every day called the internet. You’ll gain an entirely new perspective on the technologies in your life and an appreciation for how it all comes together.
It’s cheesy but true — for many, learning to code is an incredibly rewarding and enjoyable experience. After you have the basics down and start on your own original projects, the process will feel less like learning and more like leisure. After all, if you’re not enjoying it, why pursue it as a career?
What Languages Should You Learn?
Coding requires knowledge of at least one coding language, a set of syntax and rules that computers can understand. There are hundreds of coding languages, each one unique in its purpose and what it can do. But, some languages are easier to learn than others — these are best to start with since they’re the fastest way to learn the fundamentals of programming.
Below are some languages widely considered suitable for beginner coders. I recommend getting comfortable with just one language that aligns with your goals, then explore others if you feel inclined. Don’t worry about choosing the wrong one, though. These languages share underlying concepts, so you can start with one and switch to another if you need.
HTML & CSS
Hypertext Markup Language, or HTML, is the foundation of the internet — it’s used to set the content of web pages. When you load a web page, typically what you see is an HTML document rendered by your browser.
If you’re unsure whether coding is your thing, HTML is the easiest language to sample. This is because HTML isn’t technically a programming language — it doesn’t execute scripts and you can’t build functional programs with it. Still, HTML is everywhere online, so if you want to understand the internet, you’ll first need to understand HTML.
You might be less familiar with HTML’s sibling language, CSS. HTML handles what content appears on a web page, but doesn’t affect how that content appears. This is where Cascading Style Sheets, or CSS, comes in. The CSS language handles the styling of HTML — it sets features like colors, sizing, fonts, and even entire page layouts.
CSS is also not a programming language. It is a set of rules applied to HTML. HTML and CSS are almost always used together, so I recommended learning both. Otherwise, your web pages will look rather plain.
HTML and CSS are easy to learn largely because they don’t require you to think through the computational logic of programming languages. Learning HTML and CSS can also feel less abstract than other languages since you see the results of your code quickly — simply create a .html file and open it in your browser. Or, open an existing website and use your inspect tool to peek at the underlying code. This makes it possible to learn two languages you use every day, in a day.
But, if you want your web pages to do things, you’ll need...
Python is a very popular programming language for beginners because of its user-friendly syntax and versatility. Much of Python code reads like English, which helps beginners better quickly grasp fundamental concepts like functions.
Python also has many code libraries, groups of pre-built functions that you can plug into your code instead of writing them out yourself. With Python, you can build many different types of programs, and many introductory courses base their projects in this language.
C is another popular choice for introductory courses. It’s wordier than Python and often requires beginners to write more code to achieve the same things. This is more work, but useful for understanding abstract concepts. With C, you’ll learn skills that can be easily applied to other, more succinct languages.
C++ is a successor to C. C++ syntax is similar to C with the addition of objects, a powerful variable type that makes programming sophisticated applications easier. I recommend beginning with C, though, since there are fewer concepts to learn, all of which can be mapped to C++.
Java is popularly implemented in android mobile applications, and is another great base language with principles that can be intuitively applied to learning other languages.
How to Start Coding
- Take online courses.
- Watch video tutorials.
- Read books and ebooks.
- Complete coding projects.
- Find a mentor and a community.
- Consider enrolling in a coding bootcamp.
Thanks to the internet, there’s never been a better time to learn to code. Unfortunately, the sheer volume of options can stall some new coders before they even begin. In this section, we’ll cover some of the best ways to start learning, as well as recommended resources within each category.
1. Take online courses.
Learning to code no longer requires a classroom setting. Today, there are thousands of online programming courses that cover everything from basic HTML to data structures to complex algorithms.
Your first course should introduce the basics of a language and contain interactive modules and assignments to guide your learning. Courses provide structure to learning, which is essential as concepts in computer science build off each other. An organized course keeps everything digestible and ensures you’re learning things in the correct order.
Popular free course providers include freeCodeCamp, W3Schools, and Harvard’s acclaimed Introduction to Computer Science course, available on edX and the CS50 YouTube channel. These options are great for determining early on whether you’re ready to invest the time to learn a particular language.
There are also plenty of paid courses available for a fraction of what in-person classes will cost you. Codecademy, Coursera, and Udacity cover a wide range of beginner, intermediate, and advanced CS topics. Some paid services even offer some free courses or trials if you want to get a feel for their teaching approach before payments.
2. Watch video tutorials.
You’ve probably watched a YouTube tutorial or two — why not do the same for coding?
While online courses are your best bet for hands-on experience, online videos can supplement your learning and occupy your curiosity. My personal favorites include Crash Course Computer Science and Tom Scott’s The Basics, both of which cover broader topics in computing.
I also recommend the aforementioned Harvard CS50 course, and there’s no shortage of other computer science lectures on YouTube.
3. Read books and ebooks.
Prefer an old-school approach? Pick up a book on your beginner language of choice. Books will introduce you to fundamental concepts and inform your coding. Here are some established texts for each recommended beginner language:
- HTML/CSS: The Beginner's Guide to HTML and CSS for Marketers
- Python: Python Crash Course
- C: C Programming Absolute Beginner's Guide
- C++: C++ Primer
- Java: Effective Java
4. Complete coding projects.
Programming is learned by doing — there’s no way around it. You can read up on all the concepts and syntax necessary to write functional code. But, unless you put what you learn into practice, the ideas won’t fully materialize in your mind. That’s where projects come in.
A project is any program (or website) built with your language of choice. When starting out, keep projects short-term. If you’re taking a course, you may be assigned projects designed to solidify a concept. There are also loads of beginner programming projects you can attempt on your own. Some classic projects include:
- A time converter, in which the user submits a number of seconds and your program gives the equivalent in hours, minutes, days, etc.
- A random number generator, which produces a random number between two values specified by the user.
- A calculator, in which the user specifies their inputs and mathematical operation, and your program gives an output.
- An address book, in which users can submit contact names, then search for contacts stored in your program.
- An alphabetizer, in which the user provides a list of words, and your program sorts them in alphabetical order.
- A hangman game, in which the user tries to guess a hidden word by inputting letters, and your game provides feedback for correct or incorrect guesses. When the user guesses all of the letters to your word, they win.
A quick Google search will reveal even more mini-challenges that require you to apply your skills to real-world problems.
On top of practicing concepts, projects provide two more benefits to your learning. First, they’ll keep you motivated. Projects help solidify the “why” behind your coding and set clear, tangible benchmarks for your progress. Each completed project means one more skill under your belt. As I was learning, this was very encouraging.
Second, coding projects, especially long-term ones, provide something to show for your work. It’s one thing to put “Python” on your resume — it’s another to show you built an entire website or application from scratch. Projects are a must for entry-level programming jobs, as they prove competency in a given language.
When embarking on longer-term projects, think of things you’re willing to invest time into. Whether it’s a personal website, a mobile application, or a desktop tool, you’ll encounter an unprecedented amount of speed bumps along the way. Choosing a project you truly enjoy and care about ensures you follow through.
Another great way to find projects is by freelancing. You don’t need to be an expert programmer to build a useful tool for someone. Reach out to a friend, family member, or local business in need of a tool or website that you can make for free — it’s a win-win.
5. Find a mentor and a community.
The resources I’ve listed so far are all valuable, but they all come with a downside: They’re largely solo efforts. Having a friend or an online community to provide further guidance can be invaluable to your learning.
First, I recommend finding a mentor. As you progress, you’ll probably encounter issues that, no matter how hard you try, you just can’t crack. This is where mentors can help. A mentor doesn’t need to be an actual teacher — they can be anyone knowledgeable in your language, who can explain difficult concepts and point you to solutions. Plus, an experienced mentor can help you follow coding practices not covered in tutorials and offer advice for navigating a career in tech.
In addition to a mentor, you may want to get involved in a community. Look for online groups, networking events and meetups in your area, and hackathons where you can make connections with experienced programmers.
Online developer communities are also a rich resource for beginners. Be sure to check out:
- Stack Overflow, a forum site for programming questions and discussion.
- GitHub, a code repository for open-source projects with an active developer community.
- Women Who Code, a nonprofit that organizes events, communities, and job postings for women pursuing careers in technology.
- r/learnprogramming, a subreddit (i.e. a microsite on Reddit.com) for beginner coders.
6. Consider enrolling in a coding bootcamp.
A coding bootcamp is a short-term training program that packs a comprehensive coding curriculum into a period of several months. These programs are designed to be fast-paced, immersive, and a launchpad for a development career.
Coding bootcamps are intensive and expensive — not the kind of thing to dive into without any coding experience. These programs are aimed at beginners who are set on a career in development and are ready to commit time, energy, and money to quickly acquire the necessary skills.
While grads tend to find employment in the tech industry, understand that this isn’t a guaranteed outcome and that you’ll be setting aside a decent chunk of your year and savings for such a pursuit. Still, it’s difficult to top an in-person learning environment surrounded by peers and teachers as motivated as you are.
Some Tips for Beginners
Clearly, there are many ways to approach the practice of coding, and some methods and languages will work better for you than others. No matter what or how you learn, however, remember these tips:
At the top of this post, I said that anyone can learn to code. That doesn’t mean it’s easy. Coding requires you to approach problems in ways you haven’t before. Certain topics may seem completely nonsensical to you, yet central to the language you’re learning. Problems that might seem easy at first will end up being far more complex to implement than you expected — you’ll spend hours hacking away at an assignment to no avail.
And we can’t forget debugging – you’ll quickly learn that computers are very nit-picky, and will only do exactly what you tell them. Tiny typos like a missing semicolon or incorrect operator will break your entire program, and it’s on you to track down the culprit.
All of this can be uncomfortable and discouraging, and that’s okay. Do yourself a favor and progress slowly and steadily, giving yourself time to let everything soak in. Even the best programmers were once where you are, and everyone has to learn the same things to start. Go easy on yourself, stick to the goals you’ve set, take breaks, and you’ll be fine.
Know your tools.
You’re going to be spending a lot of time staring at your screen, so be sure to reserve time for getting comfortable with your coding tools.
All beginner languages require a text editor, software you use to write your code. Text editors include features to make coding easier like color coding, auto-complete, find-and-replace, and dark mode. Notepad++, Sublime Text, and Emacs are popular text editors for beginners.
You should also learn how to navigate the console, the text-based interface for your operating system. The console lets you find files and execute commands on them more quickly than the standard graphical user interface (GUI). Familiarize yourself with how to use it, including the basic UNIX commands, since you’ll be doing things that aren’t possible in the GUI.
Get comfortable with the fundamentals.
As with any topic, the early days of learning a programming language are all about the essentials. You might start by learning binary, data types, and how to print to the console. From there, you’ll explore topics like variables, functions, conditional logic, arrays, and objects.
It’s essential that you fully grasp each of these concepts before advancing, as everything you learn in computer science builds on topics that come before. If something doesn’t make sense, review it until it does — don’t assume it will make sense in the context of future lessons.
If you’re learning from a tutorial, be sure you understand what each activity is meant to teach you. Complete all exercises in order to experience first-hand how each topic applies to coding. And, as mentioned, be patient — you can’t embark on an ambitious project until you grasp the fundamentals.
Write clean code from the start.
Here’s one thing an online course may not teach you: On top of learning how to write your code, you should also practice writing it well.
What does this mean? For any given computation, there will be more than one way to program it. You should always strive to write it in the most concise and readable way that you can. Developers usually work in teams, so others will be reading your code often. If it’s hard to decipher, fellow developers won’t look forward to working with you.
Even if you decide to freelance, writing clean code ensures you’ll understand your own code. It’s better to build the habit of clean coding now, as it will save you hours trying to decipher your work after you haven’t looked at it in months.
You might be wondering why clean code is so important to learn at this point. You’re a beginner, so shouldn’t writing functional programs be the main goal? Well, yes. However, this is about establishing good habits early. If you put in the extra work now, you’ll save yourself (and others) some sanity down the road.
A good way to achieve this is by keeping your lines and your functions short. I recommend limiting each line of code to 80 characters max and each function to no more than 15 lines. While limiting at first, these rules will train you to favor efficient code over the first idea that occurs to you.
Also, get in the routine of commenting. Comments are segments of code that aren’t processed by the computer, so you can write whatever you want inside them — programmers use comments to clarify the purpose of their code. Learn how comments work in your language and, at the very least, leave comments at the top of your functions explaining the job of each one.
Google is your friend.
There’s no shame in Googling the solutions to problems. In fact, professional developers do it all the time. If you’re struggling, someone’s probably been in the same situation and dropped a question to a forum. You’d be surprised at how specific your queries can be while still finding a solution.
Plus, it’s quite satisfying to close 20 tabs of Stack Exchange after finally fixing a stubborn bug.
Coding Is More Than Just the Code
To finish up, I want to share one more valuable piece of advice from my first computer science class.
From a beginner’s perspective, it may seem like learning to code means entails learning how to literally write code. This makes sense: When we imagine a computer programmer, we see someone writing out code on a computer — it’s called “coding” after all.
Once you begin, though, you’ll learn that this isn’t the whole story. In reality, you’ll spend significantly more time thinking about what to write before actually writing it. This is because coding is more about solving problems than knowing the syntax. Learning to code is learning to think like computers do, to deconstruct problems into their components, and to address them with the tools you’re given.
So, yes, you’ll learn to write some impressive code and eventually build amazing things. But first, you’ll develop the thinking skills to get you there. In my years of coding, this new approach to problem-solving has changed not only how I tackle technical challenges, but how I approach problems in general. I hope you’ll experience the same.
I wish you the best of luck in your journey. You got this!
Originally published Dec 30, 2020 7:00:00 AM, updated April 21 2022