Which programming language should I learn first?
The answer to the most commonly asked question about learning to code
Which programming language should I learn first?
This is the most common question I’ve received since publishing What I Wish I Knew Before I Learned To Code. Most people assume there’s an obvious choice, but the answer is not always so clear.
Many computer science programs start with Python, perhaps because it has a simple syntax and robust documentation, making it a great language for a beginner. Hey, Python is great for all sorts of things, including data science, so why not learn it first? It’s a general-purpose language, after all.
The problem is that many people get it in their heads that they want to “learn how to code”, but they don’t stop to think about what they want to learn how to make.
Programming is not about picking a language, learning its syntax, and then figuring out what it can do later on.
If you want to be developer, and you’re not sure where to start, I strongly encourage you to begin with the end. The end result. What do you want to make?
If the answer is “a lot of money”, then go ahead and browse job listings and pick whatever language your preferred company is looking for. But good luck learning something without having a tangible goal in mind.
After all, it doesn’t matter how “easy” or “difficult” a particular language is to learn. You know what’s really difficult? Trying to push a language beyond its limitations to create something that can’t (or shouldn’t) be created with that language.
I’m not sure what I want to make, but I know that I enjoy the challenge of programming.
Fair enough — but at some point, you have to realize that you’re trying to learn something challenging out of context. It’s like trying to learn a foreign language but admitting that you don’t even know where it’s spoken and that you have no interest in ever speaking a word of it aloud. You can learn all the out-of-context grammar you want, but you’ll never be a linguist.
Begin with the end.
What are some of the things you can make?
- computer games
- mobile apps (iOS? Android?)
What are some of the things you can do?
- data science
- artificial intelligence
- machine learning
- cyber security
- technical writing
- database administration
This list is obviously not all-inclusive, but you get the point. What exactly do you want to do? Figure that out before you choose a programming language to start with. While some people say it doesn’t matter which one you choose as long as you learn it well, you’ll probably find that this is not the best advice — especially if you’ve already tried and failed.
On the other hand, if your dream is to land a software engineering position at a major tech company, you’ll probably be expected to learn new programming languages once you start working. Your understanding of algorithms and computer science principles might be more important than the language you choose to use at your coding interview.
Undoubtedly, it is easier to pick up new programming languages after you’ve learned one really well, but if you’re just starting out, it’s best to choose a language that aligns well with your short-term and long-term goals instead of choosing one at random, or choosing the one that you think will make you the most money.
What are some of the most popular programming languages? What are they most often used for?
HTML and CSS
If you want to do anything with front-end development, assume that HTML and CSS are a given. Whether you consider them programming languages or not (technically HTML is a markup language and CSS is a style sheet language), you need to learn these, and you should be able to learn them quickly. There’s a reason coding bootcamps breeze through HTML and CSS, sometimes making them part of pre-bootcamp coursework.
Simply put, HTML is used to put text, images, and other elements on a website. Headers, footers, line breaks, links, italicized text, and so on are created with HTML. The entire hierarchy of your page is done with HTML.
If you want to be a front-end developer, spend a week or two really learning HTML and CSS, and make a few websites from scratch before moving on. Learn Flexbox and Grid to make pages responsive (so that they adapt to different screen sizes), and see how far you can push CSS because it can really do a lot more than you might imagine. Play around with Bootstrap, which is an open-source front-end framework. Then, once you’ve gotten to this point, you’ll find that your programming journey has naturally led you to…
Python is a versatile, powerful, general-purpose language. You can use it for pretty much anything, from web development to games, which is why a lot of people choose it as a first language.
If you’re just curious about coding, you can start with Python. It’s easy to learn.
But if your dream is to get a job as a data scientist… you might as well stop reading right now because you can definitely start with Python.
Long story short, Python is a data scientist’s dream. Its packages and libraries make it easy to work with massive amounts of data. You can create visualizations with Matplotlib, you can analyze tabular data with Numpy and Pandas… and so on.
Python has robust documentation. If there’s something you need to look up, you’ll be able to find the answer quickly. This is an important consideration for anyone who is learning independently.
Ruby is a back-end language. “Ruby on Rails” is not a language. Ruby is the language, and Rails is the framework. Ruby became popular because of Rails.
Ruby is an awesome language with a gentle syntax. No semicolons at the end of each line! Most developers agree that it’s fun to use, but it’s pretty intolerant of errors. Just a heads up. If debugging is not your forté, you won’t have a good time starting with Ruby.
It’s a high-level language that can accomplish quite a bit with just a few lines of code. Ruby is becoming popular with startups, so you might have seen job postings for “Ruby on Rails developers”.
Ruby might be a good first language if you’re learning independently and if you aren’t a fan of Python. On the other hand, Ruby was designed to make programming as fun and pleasant as possible for experienced developers, so it’s not a language that coding academies or computer science programs teach first. If you’re hoping to learn in a face-to-face environment, you won’t have much luck finding an “Intro to Programming” class that focuses on Ruby.
SQL (some people pronounce it S-Q-L while others say “sequel”; we can save this argument for another day) is not really a “programming” language. You won’t be making entire apps with SQL. You’ll use it to communicate with or get information from databases.
If you want to work in data science, you’ll have to learn SQL or you won’t be obtaining any data. If you want to do anything at all that involves databases, you’ll have to learn SQL. But if you’ve never written a single line of code in your life, you probably shouldn’t start with SQL. Why? You can’t develop a stand-alone app with SQL (it’s not that kind of language), so you’ll pretty much be learning backwards.
If you want to be an iOS developer, it’s totally fine to start with Swift. Swift is a relatively new language, but it’s easy to learn (kids can do it) and it was literally made for developing iOS apps.
Not much else needs to be said here. There’s no reason that Swift can’t be your first language if your goal is to be an iOS developer.
If you want to build Android apps, Java is your language. You can use it for desktop applications, too. And some games. Java used to be one of the most commonly taught languages in computer science programs, but Python has surpassed it in recent years. Java is still quite popular, but Python and Ruby are arguably easier to learn. If you have your heart set on being an Android developer, start with Java — but if not, you might find that you get more versatility (and more bang for your buck, so to speak) by learning Python first instead.
If you want to be a game developer — particularly if you want to develop console or desktop games — you might have looked into Unity. If not, open this link in a new window and explore it as soon as you finish reading.
With Unity, you can build (and monetize) incredible games, even if you’re a beginner. You’ll probably use C#.
C# is a great language to learn first if your goal is to be a game developer. It doesn’t have to be difficult. Unity has some of the most robust documentation I’ve ever seen. They have tutorials like no other.
Another reason to learn C#: Microsoft. If you want to built Microsoft applications, C# is your language.
PHP is a scripting language, and it’s a bit underrated, considering the fact that 80% of the web is powered by PHP. It’s pretty well known for being the foundation of WordPress themes, so if you’re interested in creating custom themes, you’ll have to get comfortable with PHP.
You can do a lot with PHP. It just feels like a weird language to recommend as the first one because it probably won’t be enough to meet all of your programming needs. PHP has its limitations, but it is in fact very easy for a beginner to learn.
There are a lot of other languages out there, and this is not meant to be an all-encompassing list.
Every developer has a favorite language, and every developer will tell you to learn that language first.
But you are not every developer.
Let’s talk about impractical programming languages.
I’m not going to name any names, but if you stumbled upon a “cool language” and you have no idea what it’s used for, chances are that it’s not a good first language to learn.
This includes “legacy” languages. If literally nobody has used a particular language in decades, don’t make it your first programming language. It’s like trying to learn Aramaic as your first foreign language. You won’t find enough documentation to get past the “beginner” level, and people will roll their eyes at you if you try to use an ancient language during a coding interview. I’m just saying.
The best first language is the one that does what you need it to do.
Originally published on Medium.