The Best Programming Languages for Each Situation, Part 2
The Best Programming Languages for Each Situation, Part 2
In this post, we take a look at some of the best programming languages for each situation. Do you agree with this list? Join the conversation in the comments!
Join the DZone community and get the full member experience.Join For Free
Discover how TDM Is Essential To Achieving Quality At Speed For Agile, DevOps, And Continuous Delivery. Brought to you in partnership with CA Technologies.
The Best Programming Languages For Some Specific Contexts
While there is innovation, there is also a proper way of doing things and there must be a good reason to change. By industry-minded academia, we mean academia that is linked directly with real products and businesses. For instance, when we talked about parsing in Java we found out that many of the best tools came directly from academia. Indeed, research in all fields of academia may end up in real products, but usually, the path is more circuitous.
It could be argued that C# is a slightly better language than Java and the CLI is more flexible than the JVM. But Java is a good language and the JVM is a good platform. More importantly, everybody else uses it, so you should do that too. In other words, Java is good enough and it is very popular which is especially relevant in the enterprise world. Java is also taught in many computer science courses, but the enterprise presence is the reason it is used in industry-minded academia.
In the enterprise world, changing a platform does not just mean changing the codebase, but finding a whole new set of experts and solutions for all the technical, regulatory, and business problems. It is frequently not worth the effort. And for Java, there are many libraries and products already available which are non-existent for everything else. There are even special Java platforms for the enterprise that add new features specifically for that world.
If you are in a Java company, the only way to get partially out of Java might be Kotlin. Kotlin is a language designed to be safer and more productive than Java while being easy to use and 100% compatible with Java. It is developed by the famous software development company JetBrains. Recently it became the second language (after Java) to be supported by Android. It is also used by Corda, a distributed ledger developed by a consortium of well-known banks.
C++ was born as an improvement of C and it largely succeeded, at least in the eyes of the public. Linus Torvalds might not like it, but most people do. If your company needs a language with great performance and closeness to the hardware, it is a great choice. Although compatibility with C is still important, it is not easily obtained now. If nothing else because both languages have kept evolving.
This long history has given similar advantages to Java for the enterprise, namely that there is a lot of code already written in it. It has also great performance. One reason is that the language is lower level than Java and most languages used by the average programmer. Another reason is that some of the best programmers in the world have dedicated their life to optimize its compilers. They have not just worked on the code for the compiler themselves, but they have studied and developed many techniques to improve them.
The history has also given some disadvantages: there are some many features that there is not really a standard way of using C++. You will probably have to enforce your way of using it, to avoid many maintenance problems down the line.
A good example of what we mean by theoretical academia is artificial intelligence. And in fact, Python is very popular in several areas of artificial intelligence: from machine learning, with libraries like scikit-learn and TensorFlow, to natural language processing, with NLTK. Python also has great support for scientific computing, with SciPy, and a whole lot of mathematical needs, with NumPy.
The Bad Part
Unfortunately, there are downsides to the use of Python: many practical aspects are not taken care of. For one, being an interpreted language, its performance is not great compared to C++, although it is not terrible either. This is one of the factors that has lead to the creation of several different implementations. There are also implementations made to support JVM or .NET or even make Python run on microcontrollers.
Another problem is that there is not yet a standard and easy way to deploy Python applications, which means that it is surprisingly complex.
The migration to version 3, released in 2008, is problematic and still ongoing. Version 3 is incompatible with the previous one and this has resulted in the longest migration time in recent memory.
Julia is a language that is made to address the needs of high-performance scientific computing, although it can also be used for more mundane web development. In very short terms: it is a higher performing and less popular version of Python. Indeed, it also has other technical advantages, like good support for concurrency and parallelism and the ability to call directly C, Fortran, and Python code. Given the respective communities and intended usage, it is often used together with Python.
Many Other Small Languages
There are many other small languages that are used in some part of academia or industry when complex mathematics is needed. One such language is R, a programming language that is widely used in statistics and data analysis. R has some useful features for such sectors, like its own documentation format and the fact that many standard functions are written in R itself, thus they are easy to analyze for their users. But the best advantage is the great availability of libraries and expertise for statistics and data analysis.
MATLAB is both a language and a computing environment. Which means that it can be readily and easily used by people that are not programmers by trade. This category includes most scientists. It is greatly used for technical computing in industry and academia. Being a proprietary software, it literally has a price tag. A famous competitor of MATLAB is Wolfram Mathematica, which is behind the notable Wolfram Alpha, a computational knowledge engine.
Both R and MATLAB are technically programming languages, but for the most part, they are not used as such or by programmers. They are used by scientistist and industry experts for research and development.
Concurrency and Reliable Software
The fundamental issues related to concurrency affect any software. For example, how to coordinate the access to shared resources is a problem that could affect any program. In practical terms, though, most developers tend to ignore it. This is because the basic solutions provided by most programming languages are good enough. Where it could really start affecting them, like web development and access to databases, very smart people have done a lot of work for them.
When you start to have same real strong requirements in terms of concurrency, you might adopt a functional programming language.
However, if your business depends on it, you want something more. You want a language that is explicitly geared to develop highly reliable concurrent applications.
Any sufficiently complicated concurrent program in another language contains an ad hoc informally-specified bug-ridden slow implementation of half of Erlang.
– Robert Virding, one of the creators of Erlang
When you absolutely need to develop distributed, fault-tolerant, reliable, soft real-time, concurrent applications, you choose Erlang. It is an open-source language developed by Ericsson, a telecommunications company, for just such a need. The language itself obviously has proper technical features, like being a functional programming language and implementing an Actor model.
However, the real advantage of Erlang it is that the whole ecosystem is developed with that objective in mind. For instance, it has some interesting features relative to the supervision of the processes and their organization. In fact, Erlang it is not just a language, but a runtime system with some ready-to-use components like a distributed database. It has tools to check the quality of the code or the execution of the program. The whole system is called Open Telecom Platform (OTP).
In short, Erlang is a battle-tested language and platform to create reliable and concurrent applications.
Erlang has been developed for the enterprise which means that it might be technically flawless, but not that pretty or very productive. To address this, José Valim created Elixir, a language built on top of the Erlang platform. For instance, Elixir added support for extensibility. You could think of Elixir as Erlang for people that are used to Ruby or Python.
It is gaining popularity and is used by companies like Pinterest and Moz, but it has yet to garner a large number of users.
Another company that has a need to develop concurrent applications is Google. Because of that, it is not surprising that people that work there created Go. It started as an experiment by some engineers, to develop a language that improved on C++ and Java. More than an evolution, it is a re-imagination of these languages, with some added benefits.
It was designed to be scalable to large systems and usable without an IDE, but also productive and especially good at networking and concurrency. Other than a well-thought out design, it has some specific features for concurrency like a type of light-weight processes called goroutines.
All its authors expressed a dislike for the complexity of C++. So, in some way, it is a language designed to persuade C people to enter the new century.
While being developed at Google, it would be incorrect to say that is backed by Google in the same way Microsoft backed C#. People working at Google have developed other languages, too. So it is more a language that many people like, including some people that work at Google. In fact, it is also used by Docker and Dropbox.
C++ is also widely used for system programming. It has the advantage of being better at supporting large applications, for instance with object-oriented programming. But some people find this and other additions simply unnecessary for system programming.
Rust is a new language sponsored by Mozilla for system programming. It is open-source and thus open to the contributions of the community. But the design of the language evolved with the development of Servo, an experimental layout engine for a browser. It is loved by many of its users, and in fact is the most loved programming language according to a survey of developers conducted by StackOverlow.
Rust is designed to also have great support for concurrency, memory safety, and large scale applications. For instance, you cannot have null or dangling pointers, which can cause memory-related bugs in C or C++. It has classes and a performance comparable to C++.
It is much less popular than C or C++ and it has not been used in widespread applications. Mozilla plans to eventually use it for Firefox (although not directly with Servo). At the moment, the most important software that uses it is probably Tor, an anonymity network for which security is literally the raison d’etre.
Game development might seem like the most orthogonal thing to system programming since you really do not want software that plays games. Nonetheless, there is a similar need for performance. This is useful for some demanding games, but it is mandatory for building a game engine, a software that will be used to simplify the development of games.
Game development also has a diametrical need: productivity. This is a requested feature for many businesses, but it is a life-or-death reality in game development. No other software industry is so dependent on a good launch for its revenue. A game developer could simply fail before even launching the game.
The combinations of these requirements leads to an industry that is heavily reliant on specific libraries, game engines, SDKs, and tools.
The most used programming language for professional game development is C++, which marries good productivity with performance. It has also the most experienced developers. Some software may be written in C, but most developers prefer using C++. Notable examples of software made for C++ are DirectX technologies and the Unreal Engine.
If you do not need optimal performance or prefer easier development and cross-platform support, C# is a good choice. It is really a matter of libraries and SDK. Initially, Microsoft created XNA to make game development more accessible on Windows and Xbox but was later supplanted by the cross-platform MonoGame. It is also the preferred language to use with the widespread game engine Unity
Published at DZone with permission of Gabriele Tomassetti , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.