Gmail’s smart compose feature is a fascinating implementation example of making technology smarter. It’s real time accuracy is helping a lot of Gmail users, especially in the corporate world, in making Email communication more efficient. Similar features have been implemented in many products, like WhatsApp offering predictive text messages, or Google Search autocompleting your query, but these are straightforward prediction methods and not as advanced as Gmail’s smart compose. Let’s think of a scenario to do the same with code bug fixes what Gmail does with mail composition.
For all product based companies, bug fixing is expensive. Increase in bugs increases the usage of resources to fix it. Every bug goes through many phases like bug reproduction, bug localization, bug fixing, bug validation and many more. The idea here is to be able to auto-compose a bug fix by just reproducing the issue locally using the knowledge your text editors already have of your code like your methods, variables, classes, interfaces along with all their references, and the past bug fixes history.
Smart compose for Bug Fixes
This concept is not something new out of the box in the Tech world. Intelligent code completion has been in the market for more than 20 years now. Many tech giants have been doing extensive research in making coding smarter through their products. IntelliSense, which is Microsoft’s implementation of code completion for Visual Studio, is one such example. Introduction of a smart compose feature for bug fixes will definitely make a huge impact in software development.
A tech giant has already implemented this feature internally, and has also been using it for fixing bugs automatically in production for more than 2 years now. It has built a tool that can find bug fixes automatically, and offers them for approval from the engineers. It is the Getafix tool by Facebook.
Getafix by Facebook – A Perfect Example
With modern codebases being extremely complex and requiring to be updated constantly, Facebook built a tool called Getafix which automatically finds bug fixes and offers them to engineers to approve. The uniqueness of this Getafix tool is that when deployed at production scale, it can contribute to the stability and performance of Facebook apps that billions of people use.
Getafix works in conjunction with two other Facebook tools, Infer and Sapienz. Infer is a static analysis tool that identifies issues such as null pointer exceptions. Sapeinz is an intelligently automated testing system for Facebook apps. Using this technology we can address code issues from any source.
The goal of Getafix, as described by Facebook, is to let computers take care of the routine work, albeit under the watchful eye of a human, who must decide when a bug requires a complex, non routine remediation. The tool works by applying a new method of hierarchical clustering to many thousands of past code changes made by engineers, analyzing the change and also the context around the code change. Using this method Getafix detects the underlying patterns in bugs, and the corresponding fixes unlike any other previous auto-fix tools. You can find the detailed working of Getafix here.
With the advancement of technology, we need to adapt new methods to improve the efficiency of work and optimize the outcome of software development. I believe that the addition of smart compose features for bug fixes in the development life cycle will help in achieving those goals.