Meet the Bots That Review and Write Snippets of Facebook’s Code
Sapienz and SapFix are automated tools that Facebook now uses to find and fix problems across all of the company’s apps Facebook’s Getafix tool serves up templates for how to fix common coding errors to its SapFix system, which then recommends solutions to developers. A null pointer exception is like having the address to a house that was never built. It means a programmer has referred to an object that doesn’t actually exist because it was never described in the code.
Null pointers are extremely common and relatively easy to fix—easy enough to be boring, in fact. Unfortunately, the tedious work of finding and fixing errors like these still takes up much of a developer’s time and mental energy. A 2016 evaluation of 1,000 Android apps [PDF] found that null pointers caused more crashes than any other kind of error, includingillegal arguments, array index out of bounds exceptions, andbad tokens.
To make its developers’ jobs more rewarding, Facebook is now using two automated tools called Sapienz and SapFix to find and repair low-level bugs in its mobile apps. Sapienz runs the apps through many tests to figure out which actions will cause it to crash. Then, SapFix recommends a fix to developers, who review it and decide whether to accept the fix, come up with their own, or ignore the problem.
Engineers began using Sapienz to review the Facebook app in September 2017, and have gradually begun using it forthe rest of the company’s apps (which include Messenger, Instagram, Facebook Lite, and Workplace). In May, the team will describe its more recent adoption of SapFix at the International Conference on Software Engineering in Montreal, Canada (and they’re hiring).