Facebook seeks help with Hack

Summary:Facebook strives for robust open source communities at its first Hack programming language developer day.

When code bases get large, developer momentum slows and development becomes less safe. That was the challenge confronting Jay Parikh, VP of Engineering at Facebook, and his coders.

The response has been to write a new programming language, Hack, which held its first developer day last week after being released to open source development in March.

Parikh
Jay Parikh

Facebook has tried to change and be more open about its “technology at scale”, Parikh told delegates at the inaugural event.

“The stuff that we are doing to make Facebook what is today is very important to us,” he said. And that includes a new approach to open source.

Facebook wants more robust communities around its open source projects and for them to be “better in synch both internally and externally”.

“We are focused on key parts of the stack, going deep versus just ‘hucking things over the wall’ which you may have thought we did a few years ago,” he said.

Parikh said that new approach wasn’t just about software, but also about hardware and datacentre design through the Open Compute Project (OCP). Facebook, he said, was now 100% OCP.

“What we talk about in the community is what runs Facebook today.”

At the developer day the focus is on the benefits of what Parikh called “developer infrastructure”.

Over years, PHP has been an essential part of Facebook’s stack, he said. It delivered a tremendous advantage in moving fast, allowing the community to conceive of ideas and features and get them into the hands of developers quickly.

However, when code bases get large, momentum slows.

“At some point that becomes a losing battle – you get to be at a scale where your velocity, your changes, the number of engineers … you can’t keep up with this churn. You are always lagging the vulnerabilities that may be getting exposed in the code.”

Around 2009 and 2010, Facebook began working on abstractions of PHP to make it faster and more scalable.

Products of that effort were the Hip Hop Compiler and Hip Hop Virtual Machine (HHVM), both of which helped maintain developer momentum.

Alongside that grew an effort inside Facebook’s site integrity team, led by engineers Julien Verlaguet and Alok Menghrajani, that would become Hack. That team had seen developers were unintentionally harming users and began working on tools to avoid this.

“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,” the company said when releasing the code to open source.

When the HHVM and Hack teams began working together, investment in the Hack effort grew. Parikh pointed out that all this happened organically, with no management decrees.

The effort started small, allowing two staff to “go off and be bold and do something that was going to be disruptive” to a global engineering team of 2000. They built something that he said was “hands down better”.

Adoption was similarly organic: “Engineers over time wanted to be in this world and not the old world.”

Over the last year, Facebook said, it has migrated nearly its entire PHP codebase to Hack.

“There is a lot of investment we put into developer infrastructure and we think has positive ROI for us. It is a core competency we believe in, and all engineers care about,” Parikh said.

Kicking off the Hack community effort, Parikh said whether community members were from small or large companies or working with small or large code bases, they could start experimenting and “try before they buy”.

“It’s very, very early. We don’t want to do it alone. It’s had a terrific impact in Facebook, and we need everybody’s help,” he said.

According to one delegate at the event, Simon Wilson of New Zealand SaaS developer PocketRent, sessions focused around new features and directions to take HHVM and Hack to provide a better language to develop with and a faster platform to develop on.

Wilson said about 150 were registered for the event and around 1500 more followed the live stream.

“The Hack community is fairly new, though there’s about 3000 following the HHVM/Hack Twitter accounts and 8,600 people following the HHVM GitHub repo.”

 In addition, he said, a couple of dozen were active in the #hhvm IRC channel.

PocketRent bagan using Hack around October last year, Wilson said.

 “It’s a bit hard to track down an actual date as we were using Hack features, though not the type system, before we even knew Hack existed,” he said.

 PocketRent’s forthcoming Pro edition utilises the same underlying systems as Facebook to maximise the user experience through performance increases.

 Wilson said benefits of Hack include being able to write type-safe code; being able to run IO-bound commands in parallel; collection classes that enforce set/vector/map semantics including immutability if required; trailing commas on function calls; and at least compile-time generics.

One drawback, he said, is that a Linux development environment is currently required.

“While there is work being done on both OSX and Windows builds, actually developing on HHVM, rather than just using it, will probably require a Linux dev environment for some time,” he said.

PocketRent’s main contribution to the effort has been converting the bundled extensions from the old, rigid IDL format over to the new HNI format, Wilson said.

“This format is much nicer to write extensions in and much more powerful as well as faster at both compile and run times.”

Topics: Software Development, New Zealand, Social Enterprise, Web development

About

Rob O'Neill is a writer for CBS Interactive based in Auckland, New Zealand covering business and enterprise technology for ZDNet. He has previously worked for IDG, The Sydney Morning Herald and Melbourne's The Age as well as various business titles, most recently editing the Business Sunday section of New Zealand's weekly national news... Full Bio

Contact Disclosure

Kick off your day with ZDNet's daily email newsletter. It's the freshest tech news and opinion, served hot. Get it.

Related Stories

The best of ZDNet, delivered

You have been successfully signed up. To sign up for more newsletters or to manage your account, visit the Newsletter Subscription Center.
Subscription failed.