React, etc. Tech Stack

React, Flux, GraphQL, Hack, HHVM...? All of this and more!

PHP is Java, Hack is Scala

Java Virtual Machine as a platform seems to have gone through a renaissance, not exactly the same as PHP, but similar. Somehow languages ranging from Scala to Clojure to Ruby are raising the JVM fever. And this all makes sense.

Over the years there has been tremendous investment to JVM as a platform. The original JVM language, Java, might seem stale to some - but the shared runtime allows inheriting this heritage with new syntax and paradigms.

Enough linkbating, PHP is not Java and Hack is not Scala. But there are parallels as there is something similar to the JVM world is happening in the LAMP domain with Hack and HHVM.

Some developers feel that PHP is stale, when in fact PHP has improved a lot lately. Just like with Java people are more likely developing older and larger applications with PHP than JavaScript or some other alternative language.

And while it might seem great for developers to switch from PHP or Java - in large projects it's virtually impossible. This is what happened to Facebook with PHP. Code is their only business and the codebase is humongous. But with their sheer size and resources they've been able to create a viable alternative runtime for PHP.

Many think it's a faceoff between PHP7 and HHVM, but it's not. Facebook has already moved forward with their own PHP derivative called Hack. Not only is hack immediately familiar to PHP developers, it lacks the baggage and is not held back because of old PHP applications like WordPress.

JavaScript and Node are a likely and very popular alternative to starting new web projects. They offer a whole clean slate, but that might be even a bit too clean. PHP has thousands of robust and battle tested applications to work with. So just like with Java and Scala, you might want to mix and match languages on the same running platform.

With HHVM you can, infact run both PHP and Hack with the same exact same infrastructure - no added investment of making sure your Node processes are running. HHVM is JVM. And it could be the most practical greenfield for a lot of developers out there.

Add the fact that Facebook is investing in Nuclide, an excellent IDE for Hack (written in JavaScript, none the less) and developing in Hack seems like a viable option for some cases - especially when you want to natively bridge between back and front ends. As for worries of Facebook "owning" Hack - it's Open Source and available on GitHub.

This is close to what Apple is doing with open sourcing Swift and Microsoft with open sourcing .NET. Controlling a proprietary development language offers very little competitive advantage in the time and age we live today.

So in the future, as a PHP developer, I recommend to consider the advantages and disadvantages that Hack might hold over, say JavaScript. It's easy to give it a go with the official Hack tutorial.

Written by Jorgé on Thursday July 23, 2015

Permalink - Tags: hhvm, php, hack, scala, java, javascript

« PHP 7 and HHVM are not competitors - Hack and JavaScript are - React developer toolbar for Firefox and Chrome »