The Web has spoken. The three absolute worst, major programming languages are PHP, JavaScript, and C++ (in that order). Are they the worst by virtue of being immensely popular? Of course not. Languages such as Java, C#, Python, Ruby, and C are just fine. Look, no programming language is perfect; they all have issues. But these three are bad on an epic scale. Let’s look at them in turn.

Before we continue, we should clarify what we mean by “worst.” We’re looking at the qualities that centre on language design, in particular, on language syntax and its consistency, correctness, and complexity. We are not concerned with language performance because, despite the fact that some languages (eg, dynamic, interpreted) are slower than others (eg, static, compiled), for today’s hardware and most applications, performance simply does not matter. Just look at the broad use of PHP, Python, Ruby, and Perl.

We’re also not concerned with tooling and ecosystem because the most popular programming languages are very mature and well-supported.

What we are concerned with is how easy it is for a human developer to use the language, to write the language, to read the language, to understand what he/she is reading. In other words, we are concerned with cognitive load. A programming language is good or bad, depending on whether it makes the programmer’s job less difficult and more pleasant. This is why languages like Python and Ruby are so popular. And why Go is rocketing to prominence.

In this article about language adoption, the author writes:

…the single factor that most strongly correlates with both preferring and actually using a language is good libraries, particularly open source libraries. One interesting result was that simplicity was the least ranked of the factors respondents deemed important, identified by about 25% of respondents, compared to 60% for libraries. Safety/correctness was deemed important by nearly 40% of respondents. So if we take this result at face value, programmers are willing to deal with a complicated language in order to get other benefits, like correctness. On the other hand, there are mixed messages here. For example, development speed was important to 40% of respondents, and we would think that simplicity would help that. Perhaps the definition of the word “simplicity” is key. In general, developers claim to enjoy languages they believe are expressive, and produce elegant code.

I am profoundly saddened by the last two points. In my opinion, language (syntax) simplicity is vitally important. It lessens the cognitive burden and makes programming less stressful and more enjoyable. After all, programming is a human activity. Shouldn’t it be made as pleasant as possible?

“Expressive” languages are typically more complicated because language designers choose to pile on feature after feature, rather than choosing a minimal set of powerful and orthogonal features. I prefer Smalltalk and Go because they adhere to the latter philosophy. You can write very elegant code in these languages.

Also, we need to understand that, historically, the reason for many of these languages’ popularity is the timing of their arrival. PHP was one of the first server-side languages available for web development. Likewise, JavaScript was the first client-side language. C, which naturally evolved into C++, became the de facto standard, high-performance language with direct access to the hardware. Being first meant that over time, a vast ecosystem could grow around the language. Being first meant that JavaScript could establish its ubiquity in the browser universe; it was conveniently available to everyone. The languages’ inherent qualities had very little to do with it. People were thankful just to have a language that worked, awful or not.

And it is their ecosystems that continue to support their popularity today making it nearly impossible to unseat the incumbent languages. Otherwise, no one in their right mind would use the Demons Three.

PHP

Nicely summarized here. And here. And here. And here.

Someone once said that PHP was language design by random number generator. It sure seems like it.

PHP is the “duct tape” language. It’s useful for quick and dirty solutions, but for any kind of serious programming, it should be avoided.

There’s no question that a lot of great websites have been built atop of PHP, thanks to the huge ecosystem of frameworks. But PHP is not the only language to have a great ecosystem. Much better languages also have great ecosystems. I’m thinking Java or C# or Python or Ruby. Or the fantastic upstart, Go. Why choose PHP? Seriously.

JavaScript

Nicely summarized here. And here. And here. And here.

Douglas Crockford says that if you stick to the “Good Parts” of JavaScript, you can write wonderful software. What other programming language requires such a cautionary??? Even Crockford says that JavaScript has more than its fair share of the bad.

Nevertheless, JavaScript is the lingua franca of the web. It isn’t going away…ever. But we can use JavaScript as the “assembly language” of the web to which other languages can “transpile” (eg, Amber, ClojureScript, Dart, Elm, Haxe). This is the only sane approach.

C++

Nicely summarized here.

As a veteran C programmer, I have a begrudging respect for C++. But I have to admit, this language is very, very complicated and messy. It scares me, even. Which is why I prefer Python, Go, and Smalltalk. Makes life so much easier. Less stress; more joy. Who doesn’t want that?

There is no conceivable reason to make a language so complicated. Over the years, committees have been tweaking the language, making “improvements” without breaking backward compatibility. The language just grew and grew and grew. Pure madness. At some point, they should’ve just stopped.

C++ is a monument to complexity. Learning it is costly, and mastering it is nearly impossible. It’s psychological torture. And that’s what Hell is all about.