Is that the right question every new aspiring programmer asks? Or should ask. Well, I was the programmer that didn’t ask himself that question, and from where I stand now it was the first mistake of many I made throughout my career. I started programming on an old VAX minicomputer (in reality not so mini) through one of the many terminals in the university’s computer center. At that time C was the alpha and omega of all programming languages and the answer to the question above was obvious. But today, almost 30 years later, the answer might be quite different.
// C language example
#include <stdio.h>
int main()
{
printf("Hello World!");
return 0;
}
But have no fear, whatever you choose, you won’t make a mistake. It’s important to start learning as soon as possible.
I was fascinated with low-level programming and quickly learned x86 Assembler so I could write kernel modules once I was able to buy my first PC. Shortly after that, Java hit the market with a bold promise of application cross-system portability so I had to learn Java as well. It was the time of the Internet’s infancy but almost instantly most of the browsers came with support for Java Applets, and that was the first serious attempt to make web pages more interactive. However, computers were quite limited when it came to hardware resources like CPU and RAM so Java Applets proved to be ahead of their time. As you may know, Java code runs on a virtual machine which requires quite of resources. At that point any kind of virtualization was intensive and if you wanted two operating systems on the same hardware, the dual boot was a norm. Fortunately, those times are now gone and virtualization is everywhere.
// Java style Hello World
class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
Nowadays the hardware resources are quite abundant and relatively inexpensive which was one of the main boosts to many interpreted programming languages like Javascript, Python, and PHP. Strictly speaking, Python is more of the compiled programming language but similarly to Java requires a kind of virtual machine which runs its bytecode.
To put this into context, the most general classification of programming languages is on compiled and interpreted languages.
Compiled code is turned into a machine code (by the process called compilation) which means its code is better optimized to a particular CPU which in turn usually means it is also faster. The classic representatives of this group are C and C++. The main downside of compiled languages is their portability or the absence of it, which also means the code needs to be rewritten (more or less) for each platform or CPU.
On the other hand, interpreted languages are operating on a virtual machine which means they are portable across different operating systems and/or CPU instruction sets. Usually, the only requirement is to set up a virtual machine for a particular OS and you can run the same code without any adjustments. A virtual machine is dynamically interpreting language code into a machine code for each particular underlying hardware. Obviously, there is a downside because this additional step takes more time so interpreted languages are slower. However, there are many attempts to speed up this process of code transition to machine code. One of them is known as bytecode compilation with Java and Python being the most known languages using this technique. But in a way, these are still using a virtual machine as a middleware so inevitably slower than compiled languages. At least if you know what you’re doing.
For example, if you are programming an operating system you will probably use compiled languages like C or C++. Also, many game engines were written with compiled languages. On the other side, if you’re a web developer you will probably use interpreted languages like Javascript or PHP. If your work is somewhere in between these extremes (for example some kind of business solution like data processing or machine learning) you’ll probably use Java, Python, or C#.
However, as hardware is becoming more and more inexpensive, the borders between the use of particular programming languages are also turning more and more blurry. And that is something you should keep in mind when trying to decide which programming language you should learn first. If the language is so widespread across the industry this means it will be easier for you to get your first job as a programmer. Javascript is the most obvious example of such a programming language.
But it’s not that easy. Still, if you are interested in a specific niche like data processing, machine learning, and artificial intelligence, go for it. In that case, Python should be your obvious choice. Of course, it is possible to do these tasks in Javascript as well, but supporting libraries and tools are scarce. And of course – the community. If the community behind some technology is strong for a specific use, that means you’ll be able to ask questions, get answers, and solve problems faster and with less effort.
# Python style Hello world!
print('Hello world!')
Java (and its improved incarnation Kotlin) is also traditionally in strong demand. Many business solutions are already written in Java and more of them will be in the future. Java has good cross-platform references, many libraries, a strong supportive community, and an impressive track record of more than 25 years in the market. Last but not least Java is the main technology behind the Android operating system which dominates the smart devices market.
If you are targeting the Microsoft ecosystem then you should probably look into .NET programming languages such as C#. However, it’s not an exclusive requirement because Microsoft supports a wide variety of programming languages such as Javascript and traditionally C and C++.
In comparison, Apple is more strict and conservative regarding their applications ecosystem. Applications for Apple’s devices are developed in Objective C and more recently in the Swift programming language. These languages are not of much use anywhere else. But, if you’re targeting Apple you won’t have other choices. To be honest there are cross-platform technologies (React Native, Cordova) that enable, for example, programming applications in Javascript but to a limited extent.
// Swift style Hello World!
import Swift
print("Hello, World!")
And finally, let’s not forget PHP which is one of the easiest languages to learn for beginners. There are vast free learning resources on PHP around the internet. With recent versions (v8+) PHP joined the team of JIT-compiled languages with a promise of increased speed that many programmers refer to as its major sticking point. PHP is almost exclusively used for server-side web development but I made many server administration scripts, parsers, and what not with it.
<?
// PHP style Hello World!
echo "Hello World!";
?>
This leads to the conclusion that it is not that important which programming language you should choose as a beginner. Of course, if you target particular technology or ecosystem some choices are more obvious than others. It depends on your intrinsic motivation and knowledge background. If you are highly motivated and able to discipline yourself for a year or two there is no technology you won’t be able to learn. If you are doubting your discipline start with something easier such as PHP. If you want the widest reach, the programming language that you will be able to use in almost any ecosystem, choose Javascript.
// Javascript Hello World!
alert('Hello World!');