Skip to main content

Facebook Unveils Hack, A New Programming Language For Bug-Free Coding

Facebook engineers Bryan O’Sullivan, Julien Verlaguet, and Alok Menghrajani spent the last few years building a programming language unlike any other.
Working alongside a handful of others inside the social networking giant, they fashioned a language that lets programmers build complex websites and other software at great speed while still ensuring that their software code is precisely organized and relatively free of flaws — a combination that few of today’s languages even approach. In typical Facebook fashion, the new language is called Hack , and it already drives almost all of the company’s website — a site that serves more than 1.2 billion people across the globe.

What is Hack?

Hack is a programming language for HHVM that interoperates seamlessly with PHP. Hack reconciles the fast development cycle of PHP with the discipline provided by static typing, while adding many features commonly found in other modern programming languages.
Hack provides instantaneous type checking via a local server that watches the filesystem. It typically runs in less than 200 milliseconds, making it easy to integrate into your development workflow without introducing a noticeable delay.

The New PHP

You can think of Hack as a new version of PHP. It too runs on the Hip Hop Virtual Machine, but it lets coders use both dynamic typing and static typing. This is what’s called gradual typing , and until now, it has mostly been an academic exercise. Facebook, O’Sullivan says, is the first to bring gradual typing to a “real, industrial strength” language.
What this means is that Facebook was able to gradually replace its existing PHP code with Hack — move from the old dynamically typed system to a statically typed arrangement. “It allows you to slide the dial yourself on the continuum between dynamic types and statics — so you can start out with dynamically typed code and then gradually add more statically typed code, benefiting from each little bit of work you do as you go along,” O’Sullivan says.
In doing so, he explains, Facebook built much more precise code — code with fewer flaws. Hack provides a kind of safety net for developers. What’s more, engineers can more easily understand code when they revisit it. Static typing acts a lot like documentation.
But the big trick is that Hack provides these benefits without slowing down the developer: Unlike other statically type languages, Hack can run without compiling. “You edit a file and you reload a webpage and you immediately get the feedback of: Here’s what the page looks like after I made that change. There is no delay,” O’Sullivan says. “You get both safety and speed.”
Nils Adermann, a software engineer and the co-founder of a company called Forumatic, has used the language, and he says he knows of nothing else quite like it. James Miller and Simon Welsh, engineers at a company called PocketRent, who have also used Hack, agree. The closest thing, they say, is Haskell, a statically typed language that provides a way of executing code relatively quickly. But Hack, they indicate, takes the idea much further.
Hack will be particularly attractive, Adermann says, to existing PHP shops. “Ironically,” he says, “its chief advantage is how little it differs from PHP.” Like Facebook, these shops can gradually move their operations from one language to the another. But Adermann also believes that some developers will adopt the language even if they’re not already using PHP. “While PHP is the most widely used language on the web, it’s unpopular in many places because of its inconsistencies,” he says. “Hack addresses these … and thereby makes the language more attractive to users of other languages.”
But the biggest endorsement for the new language is that Facebook already uses it to run its own site, the world’s most popular social network. It’s not every day that a new language debuts with such an impressive track record. Some, however, question whether Hack should really be called a new programming language. There’s a fine line here between an update to PHP and a replacement for PHP. Where does Facebook draw that line? “That,” Sullivan says, “is a good question to discuss late at night over whiskeys.”

Comments

Popular posts from this blog

10 URLs to Find Out What Google Knows About You

Google is much more than just a search giant. It is also home to many of your favorite products: Gmail, YouTube, and Chrome, just to name a few. Apart from that, it also offers many products to help you  keep track of your data . Most of these are  hidden deep  inside the My Account dashboard, which many users don’t really know of. These hidden tools  may reveal interesting details  about your usage of Google’s many services. We’ve compiled a list of important Google URLs of some  hidden tools  that carry information of what you did with Google, mostly from the searches that you have made on their many products, the voice searches and typed out Google searches that you have made. Are you ready to  find out what how Google knows about you ? 1.  Google Dashboard Google Dashboard offers  transparency and control over the personal data stored with your Google Account. You can  view  and  manage the data gener...

Nine government sites hit by cyber attacks: NIC

The National Informatics Center (NIC) has revealed that as many as nine government websites were defaced by recent cyber attacks. The center further said that the servers, which hosts these government sites, suffer a number of hacking attempts on a daily basis. The websites www.kumbh2010haridwar.gov.in, www.ueppcb.uk.gov.in, www.gov.ua.nic.in/ujn, www.cdodoon.gov.in, www.arunachal.nic.in,www.bee-india.nic.in, www.civilsupplieskerala.gov.in, www.mpcb.gov.in and www.informatics.nic.in were  defaced , prompting authorities to  ramp up  the cyber security safeguards. In an RTI reply, the NIC, which reports to the Ministry of Communications and Information Technology, said that it was impossible for the body to accurately quantify these attacks but they are usually blocked by security controls put in place. The Ministry was asked to provide details of hacking attempts made on the governments websites in the last ten years (2001-11) along with url names of the portal...

Solar car hits U.S. in round-the-world jaunt

Last October, the SolarWorld GT solar-powered car set out from Darwin, Australia on a drive around the world. It has since driven 3,001 kilometers (1,865 miles) across Australia, logged 1,947 km (1,210 miles) crossing New Zealand and been shipped across the Pacific Ocean. This Friday, it will embark on the U.S. leg of its journey, as it sets out across America from the University of California, Santa Barbara.   The SolarWorld GT is the result of a collaboration between solar panel manufacturer SolarWorld, and Bochum University of Applied Sciences in Germany. The four-wheeled, two-door, two-seat car gathers solar energy through photovoltaic panels built into its roof, with its solar generator offering a peak performance of 823 watts. Custom hub motors are located in both of the front wheels. The vehicle manages an average speed of 50 km/h (31 mph), with a claimed top speed of 100 km/h (62 mph). In order to demonstrate that solar powered cars needn't be a radical...