I see this question asked almost every day, and if I’m the one answering, I almost always say the same thing. Let’s explore choosing a first programming language for a beginner to learn. We’ll talk about what to learn, what to look for, and why.
Choose the Right Tool for the Job
One frustrating answer I hear a lot is “Choose the right tool for the job”. C++ isn’t a good choice for web apps, but may be great for building an operating system or a game. Rust is good for systems programming, but might not be the best for mobile apps. The problem is that there’s a LOT of overlap. There’s dozens of options for each type of project you could work on.
So one factor in choosing a language is making sure that the language you pick will work for the type of project you want to build: Read more about Choosing the Right Language.
When it comes to choosing a first programming language, you want to look at a couple different factors:
1. # of Jobs/Work in your area
2. # of total programmers and tutorials available
3. Flexibility of the Language
4. Developing your skills
The language you pick is not nearly as important as how you learn. Your focus should be on building your portfolio. Start with simple projects, and build stuff. Most languages are similar, and once you learn one, the second and third languages come much quicker.
# of Jobs/Work in your area
SQL is the language of the “Relational Database”. Most websites that have data like user profiles, likes, comments, todo lists, blogs… all need to store the data somewhere. Usually that’s a database like MySQL or Postgres. In order to interact with the database and get your information out of it you need the language SQL.
Because Relational Databases are so common, and almost every website, mobile app, etc… has a database and data, SQL is naturally extremely popular.
It’s true that there’s quite a few other databases available like CouchDB, Mongo, Redis, etc… but a lot of times they’ll work alongside a relational database, and SQL has a HUGE market share and is not going anywhere anytime soon. Again, look at any job board and search for SQL.
It’s split pretty evenly in a lot of locations between back end languages, so it’s not always a bad idea to just pick something you’re interested in. That said, PHP has a specific advantage in that it’s used by a LOT of websites. About 80% of the websites on the web where the server is known uses PHP. 80%!!! That means a nearly endless supply of jobs. Especially for Freelancers who like helping small businesses with their WordPress blog or small business website.
Unfortunately, it gets a little more confusing because a lot of websites that use PHP are low-traffic websites and personal blogs. Overall, PHP is one of the most popular backend languages and can supply you with a ton of work opportunity.
Learn to Code for Free!
Learning to Code isn't hard. All you need is a little guidance and you'll be well on your way to banging out apps like there's no tomorrow. We'll take you by the hand and show you step-by-step how to get started in programming.
# of Programmers and Tutorials Available
Flexibility of the Language
PHP is both popular AND flexible. Yes you could replace it with Python, Ruby, or some other backend language and still have a great or even better application, but PHP affords you one extra advantage that the others don’t. Many popular CMS platforms are built on PHP. WordPress, Drupal, and most others are built in PHP. So not only can you build your “startup” style product with PHP, you can also use it to work on WordPress and Drupal sites.
Because WordPress powers about 20% or so of the web, PHP is a very nice language to know. Especially if you want to become a freelancer and work for yourself. Technically you don’t have to use PHP to work on WordPress. They have an API that you can use to build plugins in any language, but PHP is probably ideal for most WordPress work.
SQL is also very flexible. Nearly every application has some sort of data to be stored. SQL may not be the best choice for every situation, but it’s still capable of handling a wide variety of problems.
Developing Your Skills
They are not ideal languages for teaching you best practices, and they will allow you to develop really bad habits as a programmer. I think everything else that is positive about the languages far outweigh any negative aspects, but it’s something to at least consider. And you can write good or bad code in any language.
If you want to develop good programming skills, you’ll need to pay extra attention to how you code. A much better language to learn on would probably be Python. I want to say Haskell or Rust, but those are probably not suited for beginners. They have a small user base, and are quite a bit more difficult to learn.
As a beginner you want a popular and flexible programming language. You want to be able to find work AND build a wide variety of applications. For these reasons, I recommend these as your first languages:
Second Place: PHP (because of WordPress and # of jobs)
Third Place: Python (Better for learning good habits. It’s also popular, and extremely flexible)
Honorable mentions: Haskell and Rust! Once you’ve built a couple applications and know your way around, you should definitely try building something with Haskell or Rust.