The best programming language to learn

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

The best programming language to learn
Metamorworks / Getty Images
Table of Contents
Show More

Everyone is learning to write software these days. That means 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 and smartphones. 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 about 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 Pets.com and MySpace. 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.

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?

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. 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.

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, a tool that turns the code into Java bytecode. Rhino is still a popular way to run JavaScript on top of the Java Virtual Machine when the V8 engine isn’t compatible.

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.

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.

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.

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. The three languages do not need to be islands, isolated from each other.

This story, "The best programming language to learn" was originally published by InfoWorld.

ITWorld DealPost: The best in tech deals and discounts.
  
Shop Tech Products at Amazon