Back in the early days of the social-networking giant known as Facebook, it was coded in PHP by Mark Zuckerberg and his (then) small team. Of course as the website grew into the unstoppable force it is today, PHP became difficult to manage…
Facebook’s open-source language, Hack, was born out of a necessity – and combines elements of static-type programming languages such as C or C++ with dynamic-type languages like PHP.
Most of PHP is already usable in Hack but requires Facebook’s HHVM (Hip Hop Virtual Machine) which is designed to execute programs written in both languages. The top 20 open source frameworks on Github run on HHVM.
“Hack has deep roots in PHP. In fact, most PHP files are already valid Hack files.” Facebook said, “We have also added many new features that we believe will help make developers more productive.”
The company’s engineers explained that one of the main issues with PHP is coding errors are not necessarily detected until the script had gone live – which can be too late. By combining elements of both static and dynamic languages; programmers can retain all the speed they’d have with a dynamic language (like PHP or Ruby), whilst also catching mistakes before runtime.
“Traditionally, dynamically typed languages allow for rapid development, but sacrifice the ability to catch errors early and introspect code quickly, particularly on larger codebases.” Facebook posted on its engineering blog.
Essentially Facebook has taken PHP; streamlined it, made it better, and made it the official language used internally to run their site used by 1.2 billion users. It’s like PHP+, and now the language has been made open-source and available for anyone to begin tinkering with…
And being open-source, any engineer can help improve it if s/he so wishes. Beta code is now available at Hacklang.org and you can also get Hack programming language tutorials to learn this new language.
“HHVM is now a runtime that supports both PHP and Hack, so you can start to take advantage of Hack’s new features incrementally.”
What do you think about Facebook’s Hack programming language?