Saturday, May 26, 2018

What makes programming language popular

Everybody knows that there is no "best" programming language, just as there is no best car or best kind of cheese. For many years, since I got my first computer, I have been looking for a language that would suit me best and satisfy all my needs. I have one or two favourites, which I use most frequently when creating utilities for my own, so I guess those are my personal best. But in general, programming languages are just tools. They may be better or worse suited for the job, but the language itself is not your aim. What really matters is what you can create with it. When you compare iOS to Android, do you compare Objective C to Java? I know quite a few programmers who feel angry when they hear such opinions, and who spend whole days polishing their code. But, as Jamie Zawinski said: "It’s great to rewrite your code and make it cleaner and by the third time it’ll actually be pretty. But that’s not the point — you’re not here to write code; you’re here to ship products."

Speaking of products. If you have ever wondered what makes a programming language popular, the answer is simple: money. There are many great essays about language popularity (like this one by Paul Graham), but they are true only in theory. In practice, programming languages are products, just like any other software. Let me give you an example.

A few weeks ago a developer published on his company's blog an article describing his team's negative experience with Kotlin. It was just a list of problems they encountered and reasons why they decided not to use the language for their project. Within hours the post reached over a hundred comments. A huge amount of them were posted by one of Kotlin developers, working for JetBrains, a company behind Kotlin. It's quite understandable he tried to defend it, but he didn't stop at providing his arguments. He commented on every post that wasn't positive about Kotlin, even if it wasn't negative about it. It didn't seem a problem for the company that one of its employees spends a whole day writing tons of elaborate comments. Soon, other Kotlin advocates appeared. One of them suggested that the atricle's author is a moron, and then provided a link to his blog, where he boasts about giving talks on Kotlin conferences. Guess who sponsors those conferences.

All modern programming languages, which are popular, have powerful patrons. Swift is backed by Apple, Golang by Google, and Rust by Mozilla. JetBrains didn't create Kotlin just for fun, they admitted on their blog: "we expect Kotlin to drive the sales of IntelliJ IDEA". Social marketing is becoming main driving force for many companies, so they put a lot of effort and money in creating a positive picture of their products and reacting to anything that may damage it. New languages struggle to get attention, and it takes time before they gain wide adoption. Until this happens, they need an army of salesmen and supporters hoping to jump the train (and get a well paid job) when the language reaches its critical mass. So if you are thoughtless enough to criticize the product, you will instantly become a target of aggressive marketing counterstrikes.

About a month later, another post appeared on the same blog. This time another developer described his own way from C# to Java. This time, the post was commented twice. Conclusion? Nobody fights for old languages, because nobody has to. Oracle estimates that Java runs on 3 billion devices - loosing that market, if possible, would take ages. C# is now the primary programming language for Windows, and Microsoft still owns about 90% of desktop market share. ANSI C has been used as a core of all modern operating systems and device drivers. It is also a primary programming language for micro-controllers, for the same reason it was initially developed: weak CPU and low memory (try to run software written in any modern language on a chip with 2kB RAM - and for your information, Forth is not a modern language). PHP is popular because of dirty cheap LAMP hosting, and you can have your neighbour's kid set up a website with Wordpress, or online store with osCommerce, for peanuts.

So, how do you make programming language popular? First, you need a decent design. It doesn't have to be great, it just needs to be solid enough, so you can convince other people that it's worth using. Even COBOL was a decent language for its time. Second, you have to be a good salesman and sell your idea to a company which will agree to support it with its money. For this to happen, your language must generate some kind of profit - it can either introduce some clever language constructs that reduce development time, or produce efficient executables which use less server resources. Kotlin's selling points are null pointer safety and reduced boilerplate code. Your selling point may be, for example, a reduced resource usage in the cloud, so you will pay lower bills for Amazon Web Services, Microsoft Azure or Google Cloud Platform. It will not hurt if you know people who make important decisions within your company.

When all this happens, you have a good chance to succeed. Strong marketing among engineers - conferences, tutorials, free tools - backed by company funds, will help making the language popular. An army of fanboys will prove to everyone who disagrees that they are just too stupid to understand how awesome it is.

Because nowadays programming language is a product. Remember about it next time you pick up a new shiny one.