The best programming language to learn now

Python is clearly the best choice, unless a better choice is Java or JavaScript. Let’s compare.

The best programming language to learn now
Metamorworks / Getty Images

The best way to understand computers and bend them to our will is to learn to speak their language so they will understand our commands. The people who love fantasy novels sometimes imagine that they’re learning magical spells and incantations. The practically minded use more grounded language to represent the logical structure of numbers and data. In any case, it’s all about understanding which sequence of keystrokes and mouse clicks will make the computer jump through metaphorical hoops and execute virtual dances.

Every school, MOOC, and training site needs to embrace a first language for the young Padawans. Some places, like fusty Harvard, still cling to the 70’s era C, but many schools are oscillating between JavaScript, Python, and Java. One is buried in every browser, one is the clean choice of the social sciences, and one is the type-rich preference of more mathematically-minded folks.

Is one the best choice? Is one clearly better than the others? Or are they all equally likely to send a substantial number of students screaming into their pillows at night? Let’s examine the best reasons to learn Java, Python, or JavaScript.

Java is classic

The Advanced Placement test chose Java long ago when Java was young and exploding. Perhaps Java never reached the apex of its initial trajectory, when everyone seemed to assume it would be completely dominant, but it remains the backbone of many websites, smartphones, televisions, and small devices.

Choosing a language with a strong following allows the student to jump on a bandwagon already fully stocked with sophisticated development tools. Moreover, there are bazillions of lines of open source code that the student can study, revise, and extend for their own work. They’re joining a big movement and it’s easy for them to fit in.

Python is new

In fact Python is not so new—the project began more than 30 years ago—but it feels new because its success has come slowly. Only recently has Python broken out and found widespread adoption with casual programmers. The novelty means that the schools that are embracing Python are creating new lesson plans, writing new exams, and developing new decks of slides. They’re not digging out some dusty old questions from the 1990s with references to and MySpace.

The newest AP course, called Computer Science Principles, lets the teacher choose the computer language and many are choosing Python because of its freshness. The newness may be skin deep, but all languages are just some clever syntax that hides the if-then-else decision structure of assembly code.

All of this success is building a positive feedback loop. The November 2020 edition of the Tiobe index marked the first time that Python climbed into the number-two slot (behind C), recognizing how the language was growing more popular than Java.

JavaScript is everywhere

It’s in the browser and the browser is the foundation for your desktop, your phone, and all of those kiosks you see everywhere. In the last decade, JavaScript has taken over the front lines of the web servers as Node.js web apps became the most popular way for developers to write “isomorphic code” that can run on both the clients and the server farms. JavaScript is practically the same age as Java and yet it took years for server-side folks to discover its power. It’s new and old at the same time.

Java is typed

You may not like spending the time to specify the type of each variable, but it doesn’t take that much time to click three keys to add “int” to your code. When you do that, you gain all of the power that comes from letting the compiler double-check your code immediately and find the stupid mistakes before it’s deployed. Type-checked languages force us to think more rigorously about the logic in our code, and that’s an essential lesson for new programmers. Java’s type structure reduces bugs and builds better code.

Python isn’t typed

The typed-language lovers are smart and they write good code, but if you think your code is good enough to run smoothly without the extra information about the data types for each variable, well, Python is ready for you. The computer can figure out the type of the data when you store it in a variable. Why make extra work for yourself?

Note that this freewheeling approach may be changing, albeit slowly. The Python documentation announces that the Python runtime does not enforce function and variable type annotations but they can still be used. Perhaps in time adding types will become the dominant way to program in the language, but for now it’s all your choice.

JavaScript is both

JavaScript itself is untyped but lately some of the high-profile members of the JavaScript world have been switching over to TypeScript, a superset of the original language that gives you the ability to set the types when you want. And if you don’t want to, well, regular JavaScript will run fine too. It’s a relaxed version of type checking.

Java rules devices

The most popular cell phone platform in the world is Android, a huge stack of code built on top of Java. But that’s just the most visible platform. Set-top boxes, new Chromebooks, and even some desktops run Android apps just like the smartphones. A close cousin of Java, C#, dominates the Windows world. C# is not exactly the same as Java but it’s very close. If you’re going to be writing an application for a fixed piece of hardware, there’s a good chance Java is the best choice.

Python rules data science

If you’re writing software to work with data, there’s a good chance you’ll want to use Python. The simple syntax has hooked many scientists, and the language has found a strong following in the labs around the country. Now that data science is taking hold in all layers of the business world, Python is following.

One of the best inventions for creating and sharing interactive documents, the Jupyter Notebook, began with the Python community before embracing other languages. It’s one of the best ways to mix together software, data, and the text that explains what’s happening. Readers can absorb the words and then push buttons to run the software on the data.

JavaScript rules the web

The other platforms may be nice, but the web browser continues to be the one portal that almost everyone uses to connect with the world. It’s usually the most-used software on the desktop, the smartphone, and the tablet. JavaScript started as the boss of this local client and its influence expanded to total domination as the growth of Node.js made it easier for developers to run the same code on the client and the server.

There are also dozens of good JavaScript frameworks (Angular, React, Vue, etc.) that offer a foundation for building your web app and some are clever enough to move your code between the client and the server as needed. 

Even in the worlds dominated by other languages, JavaScript works its way into the stack. Many smartphone developers are skipping over Java and Swift to create their cross-platform apps in JavaScript. After all, JavaScript determines what happens in the browser’s rectangle and that pretty much guarantees that it will make the decision for what happens to most clicks and keystrokes everywhere.

Java runs everything

If you write Python code, there’s a good chance it will end up running in Jython, an implementation of the language written in Java to take advantage of the omnipresence of the Java Virtual Machine. If you need to run JavaScript, you can also feed it to Rhino and Nashorn, two tools that turn JavaScript into Java bytecode.

These two languages aren’t the only ones that rely upon the rock-solid performance of the JVM. Many functional programming languages like Scala, Clojure, and Kotlin also rely on the same foundations. This helps everyone by making it simpler to link these JVM-based languages together if you want to use them in the same project.

Python runs everywhere

Python isn’t the first choice or even the last choice for people writing emulators for other languages. Still, it’s easy to find Python on many computers. The language’s creators have always distributed the code as open source and the packages are pretty much everywhere. Indeed, you’ll find Python included in MacOS and most full-featured distributions of Linux. And while it’s not included in Windows, it’s a breeze to install—just do it the smart way.

JavaScript runs in the browser

It’s hard to believe that the toy language built to create alert boxes in the browser is now the foundation for many languages. Developers want to reach users and if users are living in the browser, well, finding a way for your code to run in JavaScript is the fastest way to reach everyone.

It’s not just JavaScript cousins like CoffeeScript and LiveScript that transpile to JavaScript. Even languages like Lisp, OCaml, and Pascal can be converted to JavaScript and run in the browser. Python is popular in the browser in projects like the Jupyter notebooks and even Java can be translated to JavaScript using tools like the Google Web Toolkit.

Java has strong IDEs

Eclipse, NetBeans, and IntelliJ are some of the best integrated development environments around. They were created by the Java community and nurtured over the years to create one of the most supportive environments for writing code. The code completion and code generation algorithms may not write all of your software, but they can type out a significant amount. All of this hand-holding really helps new developers get the syntax correct. 

These IDEs were so popular that developers from other languages found a way to run their code inside them. If you become a professional Java programmer, you will almost certainly be using one of them. In the meantime, if you want a simpler and friendlier Java programming experience, try BlueJ or Greenfoot. These “beginner IDEs” were designed specifically for learning Java.

Python has the cloud

The Python language found its first home in the world of Unix and so it’s no surprise that the clouds filled with Linux boxes are natural places to find plenty of Python code. Some of the latest tools like Jupyter bundle together code, data, and explanation so people can share their insights with others as research papers that come alive. Jupyter notebooks are not static documents, but interactive tools for exploring.

Others are building sophisticated tools around the language to enhance research. PyTorch, for instance, is a deep learning toolkit filled with code, data, and the algorithms for analysis. Environments like this will dominate the future of data science.

There are also several good hosts for notebooks that add extra features for sharing data and handling big, intensive computational data analysis jobs. Google, for instance, runs the Colaboratory, which will store your data and offer some free access to GPUs for faster computation. The Saturn Cloud touts performance that may be 100 times faster than your desktop.

JavaScript has JSFiddle

Each browser comes with more than enough power to act as an IDE. JSFiddle is only the most prominent of more than a dozen websites that let you share JavaScript code with other developers. The webpages, though, aren’t static because you can fiddle with the code and watch it run in the same webpage. Tools like this make it simple to experiment with all of the syntactic fun of JavaScript.

Learn any — or all three

The programming world loves to cross-pollinate. While it can be confusing to bounce between different languages and keep the syntax straight, it is possible to use all three languages in projects without getting too bogged down. Java or JavaScript projects that analyze data can link in data science libraries written in Python. Or Python projects can invoke Java or JavaScript code.

Smart developers have also created tools to automatically translate, link, and integrate the different languages with each other. Do you want to run Python code in your browser? There are several different options now and probably more coming. Java has a ScriptEngine class that will evaluate JavaScript. There are hundreds of different languages that will run as JavaScript through translation or emulation.

In short, the three languages do not need to be islands, isolated from each other. You don’t need to pick just one in the long run. But start with one at first.

Read more about software development:

Copyright © 2020 IDG Communications, Inc.