The decision to learn to code is a big deal. You know there's a lot to learn, and you're excited and ready to get started on your journey.
There's just one problem.
How do you choose your first book or course when you're stuck at the very first question: what programming language should I learn as a beginner?
So, to answer this question, you first need to think about your goal. Why are you learning to code? What do you hope to achieve?
For most people, this is likely to be getting a job as a developer. But you could also want to work freelance, or maybe you have a project idea of your own that you want to learn how to build.
In this article, we'll explore several different possible goals, and identify the best language to learn for each of them:
Goal: get a job as a developer
This is the most common goal people have when they decide to learn to code.
But 'developer' is a broad term; there are hundreds of different specializations within tech that involve writing code. There's front end, back end, full stack, QA, DevOps or site reliability, security, mobile... the list goes on.
The most common areas for beginners to get into are the first three on that list, which fall under the general category of 'product' development. That's to say, your job is to write code that adds or contributes to features of a certain product.
Let's look at each of them.
Front-end developers work on the user interface or UI of a product; the part that users see and interact with. Their job is to collaborate with designers, and bring designs to life through code.
If you like coding, but also have an eye for design and enjoy thinking visually, front-end development could be a good fit for you.
Back-end developers do not work on the visual parts of an application, but instead work a layer beneath that, writing code that runs on servers, and interacts with databases.
There are many server-side languages, and which ones developers use will depend on the combination of technologies or 'tech stack' at their current workplace. Many developers have a preference, but often learn more than one language. Some examples are Python, Ruby, Java, Go, C# and PHP.
If you prefer wrangling data or non-visual problem solving, you might be well suited to back-end development.
As the name suggests, full-stack developers do a bit of both—they are able to work across 'the full stack'. In reality, most have at least a slight preference for one part of the stack, and the title can mean different things at different companies.
If you don't have a clear reason to pick either front-end or back-end development, or you don't feel you have enough information to decide yet, learning a bit of everything is a great place to start. You can always decide to specialize more in the future.
Goal: work for a particular company
Some people learn to code with the dream of someday becoming a developer for their favorite company. Maybe you really like the product, or have just always been a fan of what they stand for.
If this is the case for you, then naturally it makes sense to research what tech stack that particular company is using, and pick a language from it to learn.
A word of caution here though: you should always have a backup plan in case things don't work out with your first choice of company.
At some of the bigger companies (Google and Facebook, for example), you can find proprietary languages which are not really used anywhere else. Learning one of these would severely limit your options, and therefore probably not be a good idea.
The good news is that no company uses only one language, so you should be able to find one that is also in use at other places.
Best first language: a language from your ideal company's stack (but not one that is only used there)
Goal: become a freelance developer
Freelancing is a great way to put coding skills to use, while also enjoying the benefits of working for yourself (like getting to pick which projects you work on, and setting your own schedule).
The kind of work you can pick up on a freelance basis is pretty broad, but for the purposes of this article, I'll assume you mean building websites for small clients that you then hand over to them to manage when you're done with the project.
A very common platform for this kind of work is WordPress. WordPress development is now so popular that there are actually tools designed to let people build sites without even knowing how to code. But if you ever want to develop themes, plugins, or modify the default behavior of WordPress, you'll need to learn at least the basics of PHP, along with HTML and CSS.
Best first language: PHP
Goal: build a mobile app
Whether you have an app idea of your own, or would like to get hired by someone else, mobile development continues to be an in-demand and lucrative skill to have.
It's less common than the various types of web development that we've already discussed, but that can work in your favor, depending on what you want to do with it.
Mobile platforms are all built on different technologies, so you generally have to learn the language of whichever platform you want to build your app for: Swift or Objective-C for iOS (Apple), and Java for Android (Google).
Unless you have a particular desire to build an Android app, I would recommend starting out with Swift, as it was specifically designed to be beginner friendly:
Swift can open doors to the world of coding. In fact, it was designed to be anyone’s first programming language, whether you’re still in school or exploring new career paths.
Best first language: Swift
There are of course many more languages, roles and areas within tech, but starting with a clear goal—and then structuring all your learning around achieving that goal—will keep you focused, and mean you're more likely to stick with it.