Uber’s Piranha Automatically Removes Redundant Application Code

  • Piranha is a tool that automatically removes inessential and outmoded code from application projects.
  • Piranha could turn out to be a valuable tool for those organisations which have a lot of code to maintain.

In the form of Piranha, Uber Technologies Inc. has added another project to their open-source repertoire. Originally, Uber created Piranha to assist their engineers to liberate them from their mobile apps with redundant code. Precisely, Piranha removes expired feature flags, software components essential to the continuous delivery methodology that supports modern enterprise software projects.

In effect, feature flags function as an on-off switch for code. Uber uses them to help its developers test new features in its apps before releasing them to the public. Feature flags also offer a way to customise a facility for different users and double as a code kill switch, allowing developers to remotely incapacitate an out of order part of an application to stop it from hurting the entire program.

With benefits accompany certain drawbacks. Feature flags increase the complexity of an application’s codebase and have to be manually removed once they outlive their motive.

“These non-functional feature flags represent technical debt, making it difficult for developers to work on the codebase, and can bloat our apps, requiring unnecessary operations that impact performance for the end-user and potentially impact overall app reliability,” the Uber engineers behind Piranha explained in a blog post.

Piranha tackles the challenge by mostly automating the removal of old feature flags. The tool finds all the feature flags in an application that have not been altered for a certain period of time, inspects whether they’re in active use and, when it ascertains a component to be old, eliminates all the related code. Piranha then presents the suggested changes to the appropriate engineer for approval.

“Determining whether a flag is stale or not is surprisingly nontrivial,” the tool’s authors detailed. “First, the flag should have been rolled out 100 percent either as a treatment or as control.  A flag that is not 100% rolled out presumably means its experiment is still in progress. Even when it is rolled out, the developer may not be ready to eliminate the flag.”

Piranha could turn out to be a valuable tool for those organisations which have a lot of code to maintain. Automating the removal of useless code not only frees up time for developers but also theoretically enhances security by reducing a workload’s attack surface.

Piranha is available on GitHub. As of now, it supports Java, Swift, and Objective-C.



Please enter your comment!
Please enter your name here