Most people’s journey toward learning to program starts with a single late-night Google search.
Usually it’s something like “Learn ______”
But how do they decide which language to search for?
“They always joke about Java on Silicon Valley. I guess I should learn that.”
“Haskell. So hot right now. Haskell.”
“That Go gopher is just so gosh-darn cute.”
And then there’s the rest of us. We’ll probably search for something like:
“Which programming language should I learn first?”
Few questions are so commonly asked that they get the full infographic treatment. But this is one of them:
Deciding on your first programming language can be a fun process — kind of like one of those “Which Quentin Tarantino character are you?” personality quizzes.
But before you run off to learn Ruby because you enjoyed playing with Play-Doh as a kid, let me remind you: the stakes are pretty high here.
It will take you hundreds of hours of practice to become even remotely competent with your first programming language.
So you should consider the following factors:
- the job market for the language
- the long term prospects for the language
- how easy the language is to learn
- what projects you can build while you’re learning (and share with friends so you can stay motivated)
Every year brings new programming languages, and with them, new academic papers. And new web comics.
Seriously. Check out this gem from last month:
When it comes to choosing a first programming language, there’s no shortage of options. To narrow it down a bit, here are the most common Google searches related to learning programming, over the past 12 years:
Java has had its ups and downs.
Python has gradually risen to become the most popular choice.
Before I talk about these programming languages, let me clarify:
- I’m not arguing that any one language is objectively better than any other
- I agree that developers should eventually learn more than one language
Let’s kick things off by exploring how programming is currently taught in school.
Computer Science 101
Universities have traditionally taught programming under the umbrella of computer science, which itself is often seen as an extension of mathematics, or tie-in to an electrical engineering degree.
Of course, as you may have heard by now:
“Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter.” — Eric S. Raymond
As of 2016, many universities still treat programming like it’s computer science, and computer science like it’s math.
As a result, many introductory programming courses focus on low-level-of-abstraction languages like C, or mathematically-focused languages like MATLAB.
Most of these leaderboards look virtually identical to how they were 10 years ago.
But change does happen. Even in academia.
In 2014, Python overtook Java as a the most popular language of instruction at top US Computer Science programs.
And yet another change is bound to… eventually… happen.
Because if you look at the languages actually used by the workforce, it paints a very different picture:
Factor #1: The job market
If you’re learning to program purely out of intellectual curiosity, feel free to skip this factor. But if you — like the vast majority of people learning to program — want to use this skill to get a job, this is an important consideration.
There are 2.7 Java developers competing for every open Java position. Competition for PHP and iOS jobs is similarly fierce.
Factor #2: The long term prospects
This type of inter-company cooperation is harder to find with Java. Oracle — who effectively owns Java through its acquisition of Sun Microsystems — often sues companies who try to expand upon it.
Factor #3: Difficulty to learn
Even though universities still teach languages like Java and C++ as first languages, they’re considerably harder to learn.
Factor #4: Projects you can build with it
And with each passing month, Atwood’s Law holds strong.
Java once promised to run everywhere, too. You may remember Java Applets. Oracle officially killed them off earlier this year.
Python suffers from much the same problems:
“How can I give this game I made to my friend? Even better, is there a way can I put this on my phone so I can show it to kids at school without them having to install it? Um.” — James Hague in Retiring Python as a Teaching Language
By contrast, here are some apps that members of our open source community built in their browsers on CodePen. You can click through and use these right in your browser:
Learn one language well. Then learn a second one.
If you keep jumping from language to language, you won’t get far.
In order to move beyond the basics, you need to learn your first language well. Then your second language will be much, much easier.
From there, you can branch out, and become a more well-rounded developer by learning lots of languages:
- C is a great way to learn how computers actually work in terms of memory management, and is useful in high-performance computing
- C++ is great for game development.
- Python is awesome for science and statistics.
- Java is important if you want to work at large tech companies.
OK, now I’m going to attempt the impossible — I’m going to try and anticipate objections from the comments section.
It is also nearly as fast as high-performance languages like C++, Java, and Go.
Here are the results of the most comprehensive recent cross-language benchmark:
exampleArray to be an array. I set its values, then check its length — meaning the number of elements it contains.
exampleArray = [1, 2] -> [1, 2] exampleArray.length -> 2
But then I accidentally assign it to be a string.
exampleArray = “text” -> “text” exampleArray.length -> 4
These kinds of errors happen all the time in dynamically typed languages. Most developers just put checks in place to prevent them, and write tests accordingly.
Objection #3: But I really want to make a mobile app
- In order for your mobile app to actually do anything interesting, it will probably need a proper back end, which you’ll want to build with a proper web development framework, like Node.js + Express.js.
Also, it’s worth pointing out that the mobile app development’s best days may very well be behind it.
For starters, as much as people use mobile apps, nearly half of all developer jobs are web development. Compare this with a mere 8% of jobs that involve mobile app development.
The grand vision of “there’s an app for that” has not come to pass. Instead, most smartphone owners have stopped downloading new apps.
Sure — they still use apps. Mostly Facebook, Google Maps, and handful of others. As such, much of the demand for mobile app developers is concentrated in a few large employers.
As of 2016, pretty much all development is web development. Everything touches that big platform that is “the web.” And the next wave of devices that you’ll talk to around your home, and cars that pick your kids up from school — they’ll all be piped together using the web, too.
You will undoubtedly hear people crack jokes at its expense.
“There are only two kinds of programming languages: those people always bitch about and those nobody uses.” — Bjarne Stroustrup
I only write about programming and technology. If you follow me on Twitter I won’t waste your time. ?