How Facebook built an IDE to support engineers in a diversity of computer languages
by Derek Handova
When Mark Zuckerberg filed the Facebook IPO — initial public offering — in 2012 he conspicuously detailed the social network’s integrated development environment (IDE) or the Hacker Way of continuous user experience improvement. As such, Facebook ethos prominently displayed itself again at a closing session of the recent @Scale Conference in San Jose, Calif., where Facebook engineers and others detailed how the company’s culture of “hackability” allows any programmer anywhere in the organization to improve the source code in whatever computer language it’s written.
Accessible and malleable
Designed for accessibility and malleability, Atom enables a key command that runs inside an initialization script, which allows global find and replace. For example, a coder can change all the snake case variables to camel case variables with an Atom key command in two minutes, according to Ogle.
However if everyone else on your programming team has the same problem, you cannot help them, Ogle says. “Your init script isn’t going to cut it,” he says. “You can’t share your init script.” To make it shareable you can wrap the code up in an activate method, point a package JSON file at it and publish it to the package store and then everyone in the world can download your snake case converter, according to Ogle.
This allows programmers to write modules in C, C++ or other native languages that do not interrupt the main user interface process, according to Ogle. Coders can also build unusual interfaces that the core team at GitHub would never develop. Overall with Atom, developers only have to worry about their domain specific problems. Other concerns such at decoration text highlights, gutter UI, panels, panes and auto complete are taken care of by GitHub helpers and primitives available with Atom, according to Ogle.
“There is so much tooling out there all we have to do with Atom is write the glue code to connect it to your editor,” he says. Atom can be the glue between your tools in an IDE and the foundation of your custom environment, according to Ogle. IDE packages written on top of Atom include go-plus, ide-haskell, Particle-io and Facebook’s Nuclide.
Buddy, can you spare a Buck?
According to Ben Hamilton, software engineer at Facebook, the overriding philosophy of the social network is to enable any coder to be able to change any code anywhere in the source code. The company wants a foundation for coders to move between teams without having to learn every kind of code.
To support that philosophy, Facebook created Buck, the universal caching build system. Buck builds, tests and compiles native backend languages including React Native, Android, iOS, OS X, Native C and C++, Python, D, OCaml and Rust. Buck is a simple code graph that parses the files and builds compiled code. The most beautiful aspect of Buck is that it avoids merge conflicts in giant XML IDE files, according to Hamilton.
In addition, Buck only compiles just what has changed in the code and fetches the rest from local cache. It generates files behind the scenes and natively builds and runs tests. Buck is agnostic to code languages, according to Hamilton.
Facebook has just released a Buck OS X brew package with documentation and tutorials available as well as code. “Open source and available to build your apps the Facebook way!” read Hamilton’s presentation.
Direct from the source
If you have ever wondered how they make sure code works at scale at Facebook, the person to answer that question made the final presentation at @Scale. James Pearce, head of open source at Facebook, started his presentation by outlining the size of the engineering challenge at Facebook. Pearce says that the company wants as many of its engineers to be generalized developers as possible. And all Facebook production systems are open source.
With the large size of the codebase at Facebook growing all the time and the number of computer languages that must be supported shareable tools are necessary, according to Pearce. However, there are no off-the-shelf tools to do all this, he says. So Facebook created Nuclide to do that.
Under Nuclide, Facebook’s relatively small team of coders benefits from its culture of hackability to be able to affect large changes, according to Pearce. For example, individual product teams can hack and fix everything at Facebook. And with Nuclide, the Facebook code has internal functions that checks for bugs.
With all the open source resources that Facebook has made available to the community including Atom, Nuclide and Buck, developers can start building apps. They are all on GitHub now. At the end of the day, Facebook is committed to making open source work for the developer community, according to Pearce.