Reaper: When Deleting Code Is as Important as Writing It

In my experience with mobile development, I’ve seen how apps become increasingly complex and projects grow uncontrollably. I remember perfectly that feeling of having thousands of lines of code and not being sure what was really being used and what wasn’t.

That’s why I was so struck by the tool that Sentry (formerly from Emerge Tools) just released as open source: Reaper. An SDK that does something that sounds simple but is tremendously useful: find dead code in your mobile applications.

What Exactly Is Dead Code?

Dead code is code that’s there, takes up space, but never executes. It’s like having a room at home full of things you’ll “someday use” but have been collecting dust for years. In the mobile development world this is especially problematic because:

  • It increases app size: Every KB counts, especially in markets where slow connections are common
  • It complicates maintenance: More code to review, more surface area for bugs
  • It slows down builds: More code to compile and process
  • It confuses developers: It’s easy to get lost in code that seems important but isn’t used

How Reaper Works

What’s interesting about Reaper is that it doesn’t use static analysis (like Periphery or other tools), but real-time analysis. That is, it monitors how users actually use your app to identify what code never gets touched.

The process is elegantly simple:

  1. First step: A script analyzes your binary and generates a set of all types Reaper can track
  2. Second step: You collect data from real users using the app in production
  3. Result: The difference between both sets tells you what code has never been used

On iOS

In iOS, Reaper takes advantage of metadata that already exists in the Objective-C and Swift runtime. It uses the RW_INITIALIZED bit that activates the first time a class is accessed. It’s brilliant because it adds no runtime overhead to your app.

On Android

In Android the approach is different because they don’t have access to those runtime metadata. So they instrument classes at build time, adding calls to logMethodEntry in the <clinit> and <init> methods of each class.

Why I Find This Fascinating

I’ve been saying for years that “for every minute you dedicate to planning and study, you’ll need 2 minutes less of development.” Reaper fits perfectly into this philosophy, but applied to code maintenance.

In my times developing for mobile, this tool would have saved me headaches. I remember projects where we had features we thought were being used, but in reality users never touched. Or classes that were left orphaned after refactorings.

The Irony of Modern Development

The original Sentry article mentions something that made me reflect: AI tools are accelerating development speed, but they’re also increasing code duplication and affecting stability. Studies like Google DORA’s Impact of Generative AI in Software Development show productivity improvements, but also negative impacts on stability.

It’s as if we’re writing code faster, but maintaining quality is becoming more difficult.

That’s why tools like Reaper seem so important to me. It’s not just about deleting dead code, but about really understanding how your application is used in the real world.

Is It Worth Implementing?

If you’re developing for mobile, especially in large teams or apps with a lot of history, I’d say yes. It’s open source, for both iOS and Android, and you can use it with your own backend.

They’ve even created a sample server so you can get started quickly with your own implementation.

Companies like Duolingo have already used it to eliminate 1% of their iOS codebase. It might seem like little, but in large applications, that 1% can be the difference between an agile app and one that staggers under its own weight.

Conclusion

Although I’m now more focused on backend and systems, tools like Reaper still seem fascinating to me. They remind us that writing code is only half the job; maintaining, understanding, and cleaning it is just as important.

As the classic development saying goes: “The best code is the code that doesn’t exist.” And Reaper helps you find exactly what code shouldn’t exist.

Have you used similar tools? Are you considering implementing something like this in your mobile projects? I’d love to hear your experience.


If you liked this article, you can follow my reflections on development and technology at my blog. And if you work with mobile development, definitely check out Reaper - it’s a tool I wish I’d had years ago.