I recently had a conversation with a co-worker about choosing a language in which to rewrite one of our existing projects. The conversation was brief but essentially went like this: “What language do you want to do this rewrite in?” My co-worker responded with: “Oh PHP of course, I can write an API better in PHP than any other language.” This was the same co-worker that when he started at the company, talked for a week straight about how excited he was to start writing PHP code again. He also bragged on his first 3 pull requests of how beautiful his PHP code was. Clearly PHP is his favorite language, but was that a good enough reason to rewrite the project in PHP? After all, C# is my favorite language, and the project was originally written in C#. How does one decide a language to use when the opposing arguments are, no we should use my favorite language?
There are plenty of blogs, publications, and Stackoverflow topics giving advice on how to choose a language so I won’t waste your time telling you the exact same thing. Instead let me try and convince you that there are occasions when “this is my favorite language” is the only reason you need to choose that language for your project. Clearly this doesn’t apply if you are writing an Android app and want to use Swift. Sorry it’s just not going to happen, at least not at this time if rumors are to be believed.
First, let me talk about the times it is not appropriate to use this reasoning to select a language. I’ve already alluded to it, but there are some situations in which your language is not a viable option. PHP, for example, is not an available language for Amazon Web Services Lambda service, and Android apps can’t be written in Swift. Additionally, you shouldn’t choose your favorite language if it is losing popularity. A significant part of our job as software engineers is to build long lasting, maintainable systems. Despite the many advantages of COBOL, languages such as Haskell, Scala, and Go share the same advantages and are growing in popularity while COBOL is decreasing. For a more flexible tool for comparing languages refer to the image below.
Ultimately, the reason I chose to side against C# in favor of PHP is something I call Available Willing Support. Simply put this means how much of your talent is willing and available to support the application. If a developer does not know C# syntax, then they are not available to support the application. If a developer doesn’t like Microsoft, C#, or DLL’s, which is quite common, then they are not willing to support the application. While the developer in question has to support the application because it’s their job, they are far more likely to write better code if they like the language. That alone means easier maintainability, implementation of best practices, and the possibility for collaboration.
In our office there are roughly 13 developers, out of which there are 5 with some degree of C# experience, and of those 5 I had the most. Alternatively, all 13 of us had PHP experience and of course all of them, other than me, preferred PHP to C#. I had a choice, I could strong arm the decision with sound reasoning about compiled languages being more efficient than interpreted languages and data processing applications needed to be efficient, or I could look to the future and realize at some point I am going to need help. Since I had just spent three weeks of development time on tasks that none of the other devs could help me with, I chose PHP.
When it comes to personal projects it is quite easy to win the language argument. This is my favorite language and this is my project so I’m going to use that language. Sound reasoning, but I encourage you to consider a new language for your next project. You are already skilled at your favorite language, and that is great, but you are much more valuable if you are able to solve problems in any language.