The Best Programming Languages for Each Situation, Part 3
The Best Programming Languages for Each Situation, Part 3
We take a look at what, according to the author, is the best programming language 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
You've been hearing a lot about agile software development, get started with the eBook: Agile Product Development from 321 Gang.
Rapid and Productive Web Development
Angular (not to be confused with AngularJS).
PHP was designed as a set of tools to simplify and speed up server-side web development. You could accuse PHP of being a badly-designed language. But you would be wrong: it was not designed at all, it was not even intended to be a language.
Here's a quote from Rasmus Leedorf on the creation of PHP:
On the other hand, this is a testament to the power of the philosophy of just getting things done. Because PHP did work, not beautifully or securely, but it did work where nothing else could. Indeed, until a few years ago, it was the only easy way of doing server-side web development. It is easy to deploy and it has a huge range of libraries for all your web development needs. For these reasons, even today, CMSs are a PHP stronghold.
Nowadays the field is full of competitors. PHP is still the most widely used server-side language, but it is not the only option anymore. Also, the language has improved a lot and PHP 7 is a real (i.e. designed) language. There are many good web development frameworks, like Laravel and Phalcon, that encourage robust, secure, and well-thought out development.
At the same time, PHP still suffers from its beginnings. You can create good PHP code, but fewer of its users do that. The reason is that PHP still attracts many users that just want programming to be easy. So you have to pay attention in order to find the good PHP developers.
There are occasions when you have to build something, but you do not know what, exactly, the final product will look like.
Or you have to build many things, but you are required to pick one technology. It could happen while working with, or for, small businesses. It may be useful for working as a freelance developer.
It can also happen when you are not sure how your product will develop because you cannot anticipate the market. You might start building a desktop application, but your clients demand certain functionalities to be accessible by multiple users, so you add a web application, etc.
When you have unstable and different requirements you need a language that is adaptable to all situations. Not just in the theoretical sense of being a general purpose programming language, but something that has been used to build all sorts of things. There are tools that can help you in everything. C# is the best language in such cases.
It was not meant to be a revolutionary language, but rather a better version of Java and C++. Since all three languages kept evolving we could argue forever on whether or not it has succeeded in this mission. Technically C# supports particular features that no other language has, like LINQ, that adds support for querying data easily.
A few examples of the real usage of C# for desktop software (Windows), games (MonoGame, Unity), web development (ASP.NET Core), mobile (Xamarin) and even embedded systems (.NET Micro Framework). Some of this software (e.g. .NET Micro Framework, Unity) is written in C/C++, but it is meant to support the use of C#.
An important difference is that, while Java was always designed with portability in mind, C# was designed by Microsoft for its platforms. This has been both an advantage and a disadvantage. The disadvantage is that it was mostly used on Microsoft platforms and according to its needs. The advantage is that it was created and used for everything from desktop software to web development.
This has certainly changed, both in the sense that now .NET Core is designed and actively supported to be cross-platform. Also, Microsoft does not use C# for everything anymore. On the other hand, Microsoft keeps developing what many consider the best IDE of all: Visual Studio.
The CLI standard is independent of C#, while a Java Virtual Machine (JVM) is very much tied to support Java. This means that an implementation of CLI, like the .NET Framework or Mono, can support many other languages as first citizens, like Visual Basic, .NET and F#. While this is not an advantage of C# per se it comes with choosing the language. This is useful because you can keep maintaining one platform and infrastructure, but you can keep C# with another language that is better suited for a specific subsystem.
Two Interesting Languages
There are two languages that we would like to talk about. They are interesting to show what could make a language useful and popular to a diverse community. They were both created in academia and are great languages on technical grounds.
Prolog is a general-purpose logic programming language used for artificial intelligence and computational linguistics. It is still quite popular in that field, but it never really left academia. This is due to its very design. Logic programming is a programming paradigm based on formal logic. So you state some fact, or truth, about an element and then the program itself finds the solution. You say things like:
- A is true.
- B is false only if A is true and C is a cat.
- C is a dog.
Then you ask the program to tell you what is B.
This is neat, but nobody really found a way to make it work. There are really no artificial intelligence programs useful in real-life with this logical approach. Most contemporary development in artificial intelligence relies on machine learning or similar non-logic approaches.
Another problem is technical. Prolog is a fifth-generation programming language. In this context, generation does not denote a chronological feature, but a programming language in which the developer states the constraints of the problem and the language itself will find a strategy to solve it. In the case of Prolog, the constraints are logical statements.
Well, it turns out that to design a general and efficient algorithm to automatically find a solution is really hard. So the resulting programs are not efficient. This makes it impossible to write large scale applications with them.
There are newer languages that attempt to improve on Prolog and make it usable in the real-world, like Mercury, but they are not in widespread use.
Haskell was designed to be the C of functional programming languages: the definitive purely functional programming language. It largely succeeded, but for some time it remained confined to academia and the kind of industry that requires heavy use of advanced mathematics, like finance. Notice that this does not necessarily mean numerical computing.
The functional programming paradigm relies on having programming functions that behave as mathematical functions. This allows the creation of a function that does not modify outside data or have observable interactions with the outside context. Observable interaction refers to things like writing data to a file or raising an exception. Technically this means that a function has no side-effects. This also makes it possible to have functions as first-class citizens. Functions are like any other type and, for example, you can use them as an argument of other functions.
Expert programmers have noticed, or probably already know, that these are desirable features for avoiding many problems created by concurrency. And the rising popularity of the internet has increased the need to deal with such problems. So Haskell has increased its popularity. Facebook and Microsoft use it and there are even web frameworks for this language. On the other hand, it is not specifically designed for concurrency or any industry use, so it is less pragmatic than Erlang or Go.
What Does All This Mean
By the standard of academia, Prolog and Haskell are both successful languages. Haskell is a usable and popular functional programming language and Prolog in a sense proved that logic programming does not work in practice and it is not easy to use it to solve real problems. That counts as a success because even a negative answer to an important question is worth the effort.
Of course, by the standard of the real world, Prolog is not that successful, despite still being the most popular logic programming language. We personally think that Prolog is one of the most interesting languages ever created, but even we could not find a place for it in production code.
This does not just mean that technical features are not enough. That is true, but Prolog and Haskell did have a community and specific uses in mind, in addition to technical features.
It serves to illustrate a strange fact: developers are literally creating the edge of technology, but they benefit from being late adopters. You cannot predict which languages will be successful, nor why. You might spend a lot of time learning and developing with a language, but your community may choose another one. Sometimes the best programming language simply changes. So we cannot guarantee that these will be the best languages forever, only that right now many smart people think they are.
Even the real world success of Haskell might be temporary, because, if history teaches us anything, a language like F# could easily take its place.
Being a purely functional programming language restricts the appeal of Haskell and it makes difficult to understand for the average programmer. It may be easier to adopt a language like F#, that is primarily functional, but also supports traditional programming paradigms. F# can run on any platform that implements the CLI-standard, like C#. This also allows it to interact with other languages that run on the same platform and reuse their codebase.
Good Languages That We Could Not Fit Anywhere
There are obviously many other programming languages that we could not fit in this analysis. One of the reasons is our approach: some languages are not that popular, some have not won over a specific community. Sometimes there was simply a better alternative. These reasons lead to the exclusion of languages like Ruby, Perl, Object Pascal, and Visual Basic.NET.
There also languages used in very specific niches, for example:
- ADA for the US military and related industries.
- Fortran for numerical computing, especially with supercomputers.
- COBOL for finance and related industries.
We did not mention them because these are very specific, so if you need to work with them you probably already know them.
Talking about the best programming language is risky. It is easy to anger somebody and hard to say something useful to a large audience. That is why we tried to clearly explain our rationale and provide pragmatic information. We talked about technical features when necessary, but we mostly reported on the community and the best use each language has.
We also tried to make the information accessible to programmers that have no familiarity with a certain field and to non-programmers. So that, if you are working for a small business or thinking about starting one, this might help you in making a decision considering both technical and business aspects.
Published at DZone with permission of Gabriele Tomassetti , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.