Over the last few weeks, I have been thinking about programming languages, and their use-cases. Mainly I was trying to answer for myself, the question “What programming languages should I learn?” (this is where this article started from). Full disclaimer: I am very much in favor of acquiring a broad spectrum of skills.
How do I compare programming languages ?
The first issue I needed to solve, is to find the right scale to compare programming languages with. In order to learn the best programming language, I first need to decide what best actually means. I am fully aware that I have my biases when talking about programming languages. Mainly, I am very much in favor of languages I am most familiar with. This puts C/C++ and Java to the top of the list. I must mention that, even though I have grown quite proficient with PHP over the years, I am still not ready to say I like PHP.
Anyway, getting back to my purpose of comparing programming languages, I got back to the basics. Most of the programming languages are Turing Complete. This means that, in terms of what computational problems you can solve, there is not much difference between programming languages. Additionally, modern languages are also general purpose. Therefore, you can use these languages for most of your programming needs.
Use the right tool for the job
Given that most of the programming languages are pretty much the same, we have to find a different way of comparing them. Let’s try this: If we can’t find a language that is generally better than everything else, let’s shift the question to: “is there a programming language that is slightly better at a particular kind of task?” Let’s review the results (Please note that this list is by no means exhaustive):
I’m bundling C and C++ together here and I will be covering them both at the same time. They are a statically typed, compiled, general purpose, mid-level programming languages. You can use them for high performance, high availability applications. Some common examples include:
- Operating systems
- Compilers and interpreters for other languages
- Native applications
- Microcontroller programming
- Web Browsers
- Server applications
- Database access software
Java is also a mid-level, general purpose, compiled, statically typed, object-oriented, programming language. Rather than compiling straight to machine code, java is compiled to bytecode. You pass the bytecode to the Java Virtual Machine, and you turn that into machine code. Because of that, you can run compiled Java code on any device that has a JVM installed. Some common examples include:
- GUI applications
- Mobile applications – the Android ecosystem is Java-based
- Embedded systems
- Web and Application Servers
- Enterprise applications
Scala is also a general purpose, strongly-typed programming language that supports both object-oriented and functional programming. It runs on the JVM and it can be integrated with existing Java code. A lot of effort was put into making Scala a high performance programming language, particularly in a multi-core architecture. Scala is compatible with Java, therefore, you can carry everything I said for Java, over to Scala. The most common use case for Scala is build highly scalable backend services.
PHP is a server side, dynamically typed, scripting language. According to GitHub, PHP is the 4th most used programming language in 2018. PHP is generally used in the development of the web applications.
Another honorable mention on the web-development, server-side scripting languages scene is Ruby.
Python is also a scripting language. It’s a popular language, in part due to the relaxed syntax and the vast number of libraries that are part of the Python ecosystem. Some common use-cases for Python include:
- Data Science – machine learning, data analysis and visualization.
- Web development
- GUI programming
- High performance applications – since Python can call high performance, native, C/C++ code.
In conclusion, when it comes to programming languages, there is no silver bullet, no one-size fits all. Therefore, all programming languages have their strengths and weaknesses and, with enough effort, you can use any of the languages for any of the items.
The list that I compiled for you, should serve as a general guideline to help you decide on general direction. Some honorable mentions that I could not fit into this article are: Bash, PowerShell, Perl, Go, Swift, C# and .NET. What is your favorite programming language and what do you use it for?