How do you choose a programming language? When I tell people that I am proficient in more than 20 programming languages, they are sometimes shocked. Of course, I have languages I use more often than others. The choice of programming language has little to do with taste, at least when we choose a programming language. Some languages are just better for certain problems than other languages. So what kind of programming problems am I talking about?
It differs quite a lot if you are making an operating system, a hardware driver, an app for a mobile phone, a Linux, Mac OS or Windows desktop app, a web application or programming iOT devices. There are a lot of tastes and a lot of choices to make. So let's divide it up a bit.
Compiled, Interpreted, and Byte-Code
Before we can look at the different technology stack, we have to speak about the more general concepts. We have compiled languages, meaning that the source code is compiled by a compiler into machine code, which runs directly on the operating system, or hardware. Compiled languages are fast on runtime, but often more complex to develop. The main disadvantage of compiled languages, is that you have to recompile for each platform, so you need to maintain multiple code bases.
Interpreted languages are slow on runtime, and the source code and the code that you run are the same. Interpreted languages are platform-independent and run everywhere, at least if an interpreter is installed. For most interpreted languages, this is a browser. Think about languages like JavaScript and PHP.
Byte-Code languages are languages that are compiled into byte code and then run by an interpreter. They have the advantaged of compiled and interpreted languages. Are a bit slower on runtime than compiled, but run on each platform. Most Iconic languages in this category are Java and C#. Also Python is a byte code language, but not exactly like the others.
Close to the hardware
Programming for iOT devices, robots or direct PC hardware like operating systems and drivers requires a special kind of languages, mostly though not exclusively compiled languages like C, C++ and Rust. There are byte-code languages, like Python and Java that have virtual machines for certain pieces of hardware, so you can directly program on them. The true compiled languages are faster on run time, but more time-consuming and often more complex to use than the byte-code languages. As you can see, you can use a variety of compiled languages. It's important to know which other languages are used in the stack where you want to develop in. At this moment, Rust is getting much traction because it's memory save, meaning that security incidents are less likely to happen.
Desktop applications
Development for the desktop is mostly done in compiled or byte-code languages. The choice of the language is, of course, influenced by the used software stack and architecture, but also by the operating systems you have to develop for. Developing for Linux would lead to a different choice than developing for Mac OS.
Web applications
Developing for the web means you have to develop client-sided or server-sided software [or a mix between them, Ajax we are talking about you here]. Client-sided code runs on the machine of the user, think about languages like JavaScript. Server-sided code runs on the server, and the server basically renders a webpage, which is sent to the client.
Smartphone applications
The choice of programming language for the smartphone is really dependent on the operating system. Both Google controls the stack for Android, only allowing Kotlin (previous Java) and Apple with Swift and Objective C for iOS. The real choice you get with Ubuntu-Touch, which supports many programming languages to develop apps in, like C, C++, Python, Javascript, Go and Rust.
What about Green?
Currently, IT is responsible for about 7% of all CO2 emissions worldwide. If we continue on this path, estimations are that in 2030 IT will be responsible for 13% of the worldwide CO2 impact. From scientific research, it is known that different programming languages have more or less impact on the environment. Compiled languages score better than interpreted languages. This research does not take into account that developers are breathing living individuals which drive cars, eat and just live. The more time a developer takes to build the software should also be taken into account, which is not yet done by any research. Developing a program in the more polluting language Python is much quicker than developing in the less polluting language Rust.
Our choices
In our education, we chose Python, C, C++ and Rust, because these languages are frequently used in the many open source projects from our partners. Personally, I program a lot in Python, Java, and I am starting in Rust.
So, as you have learned from this article, the choice of programming language is not arbitrary. The fact that a company develops all their software in Java, because that's the case for the last 25 years, doesn't mean it's the best choice. It's just the choice where they are used to.