UPDATED 15:26 EDT / MARCH 17 2020

APPS

Uber’s open-source Piranha tool hunts down redundant application code

Uber Technologies Inc. today made another addition to its open-source repertoire in the form of Piranha, a tool that automatically removes outdated and unnecessary code from application projects.

Uber originally created Piranha to help its developers rid its mobile apps of redundant code. Specifically, the software cleans up expired feature flags, software components essential to the continuous delivery methodology that underpins modern enterprise software projects.

Feature flags, also known as feature toggles, essentially function as an on-off button for code. Uber uses them to help its engineers test new features in its apps before releasing them into general availability. Feature flags also provide a way to customize a service for different users and double as a code kill switch, allowing engineers to disable a malfunctioning part of an application remotely to prevent it from crashing the entire program.

But with the benefits come certain downsides. Feature flags add complexity to an application’s code base and have to be manually removed once they outlive their purpose. 

“These nonfunctional 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 addresses the challenge by largely automating the removal of stale feature flags. The tool finds all the feature flags in an application that have not been modified for a certain time period, say eight weeks, checks whether they’re in active use and, when it determines a component to be stale, removes all the associated code. Piranha then submits the proposed changes to the relevant member of the development team 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 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 prove to be a valuable tool for large enterprises with a lot of code to maintain. Automating the removal of stale code in applications not only frees up time for developers, which in turn speeds up software projects, but also potentially improves security by reducing a workload’s attack surface. 

Piranha is available on GitHub. The tool currently supports the Objective-C, Swift and Java programming languages, a list Uber’s engineers hope will grow now that outside developers have an opportunity to contribute to the project. 

Photo: Unsplash

A message from John Furrier, co-founder of SiliconANGLE:

Your vote of support is important to us and it helps us keep the content FREE.

One click below supports our mission to provide free, deep, and relevant content.  

Join our community on YouTube

Join the community that includes more than 15,000 #CubeAlumni experts, including Amazon.com CEO Andy Jassy, Dell Technologies founder and CEO Michael Dell, Intel CEO Pat Gelsinger, and many more luminaries and experts.

“TheCUBE is an important partner to the industry. You guys really are a part of our events and we really appreciate you coming and I know people appreciate the content you create as well” – Andy Jassy

THANK YOU