Best Programming Language for Web Development

Disclaimer: I’m not really going to mention any language as ‘best’. The title of this post is actually very misleading.

I started doing hard core web development barely a year ago, but a question I face on a daily basis is whether I’m using an optimal programming language and technology. When I started making websites (not web apps) around four years ago, I used to create them using simple HTML + CSS. Then as my clients needed things which were ‘dynamic’ and wanted to jump on the then popular boat of ‘CMS’, I switched to WordPress for delivering websites. WordPress became my one stop solution for all sorts of websites (although it is actually a blog software with lots of code/functionality which you will probably never need). Soon I started developing on WordPress (plugins) for further delivering to custom requirements. I almost always ended up using a dozen WordPress API methods throughout my code and usually had no any idea how they did what they did.

When I moved to the corporate scene of web development (in my current job), I started using PHP for building web applications. I started using (and still use) frameworks like CodeIgniter (for old projects) and Laravel (newer and cooler). PHP is the most dominantly used server side language right now, powering at least two third of the Internet (source). It is also the web language which gets the maximum hate. The Internet is filled with articles criticizing PHP and then articles trying to justify its usage.

Last semester I started going to hackathons, and pretty much everyone in every hackathon I went, told me how much PHP sucked when I used to tell them that I code in PHP. The common thing about those people was most of them had never actually even used PHP, but were fancied by other ‘cool’ languages. When everyone everywhere I met went totally berserk for PHP, while enchanting how cool Python is (which it actually is btw), I finally made my move to Python (Flask) for web development. It was very cool in syntax and all that (no ugly braces anymore, no more couple of $ signs in every single line), but I did feel that I wasn’t doing anything significantly different than what I could have done using Laravel + Composer/Packagist.

In my opinion, the biggest problem of PHP is the very low bar of entry. Most of the other languages require at least some sort of initial setting up/program compilation for producing even the Hello World but in PHP it’s as easy as writing <?= 'Hello World' ?> in any text file saved with a .php extension. Even almost all of the shared web servers online come with PHP only preinstalled. Because of this PHP becomes the choice of programming for every Joe pretending to be a web developer. What this usually results in is ugly PHP code mixed with HTML, plus five redundant functions doing the same thing and unsanitized SQL queries– all in the same page. This is the stuff which makes PHP bad; but the developers are responsible, not the language.

I’m not saying PHP is the best and greatest programming language. There are certainly more promising languages, like Python, Erlang and Haskell. I just believe PHP is not as bad as everyone claims it to be. There must be a reason why Facebook, Yahoo, Etsy and Mailchimp still use it (although Facebook doesn’t use the php which we use). If people try to follow good coding practices in PHP, it will certainly come out to be as good as other languages (if not greater).

All this being said and as I mentioned above, there are some languages which certainly seem to be very promising for web development. I actually love Python too a lot for writing server side code. Also Erlang too is pretty cool and defines efficiency. Whatsapp, the mobile phone app which was sold couple of days/weeks ago to Facebook had around half a billion users while having just thirty two employees and twenty support people. It is believed that the team was able to pull something like that off because of their strong software in place, which was made using Erlang. Then there is Haskell, which is known for delivering crazy fast websites. I guess if someone wants to know ‘Best Web Programming Language’ for him or herself, the only way to know it is by using each of them. As the quote goes “Never judge a book by its cover”, so is applicable to programming languages.

Further Reading