The gateway drug to mass, automated refactoring is technical debt

Tyler Van Gorder
|
March 18, 2022
Automated refactoring away your technical debt

Key Takeaways

In my previous essay, I discussed some of the reasons an agile environment is a breeding ground for technical debt. A team will focus on adding value for their users (as they should) and it is easy to live with an "If it ain't broke, don't fix it" mentality.

Eliminating Technical Debt Is Bringing Value to Your Users

I don't think it would be hard to argue that a production outage impacts users of your systems. I also do not think your users would be very happy if you managed to leak their personal information to a hacker.

The problem with technical debt is that it can often be hard to justify the short-term return on investment:

You - "It will take us two weeks to upgrade our systems to use {insert your framework of choice here}".


Director/Team Lead/PM - "OK, how much money will this save? What is the benefit of doing this now vs. doing it later because we have a ton of features that need to be added to our platform"

Automation to the rescue?

We already have static analysis tools that can find and estimate the cost of these types of issues.

The resourceful, regex hero, will most certainly claim they can knock that estimate to a fraction of the originally reported cost. "I ran this regex and it correctly addressed 500 of the originally reported 1000 issues. I will just now have to go back, fix formatting, and do some quick copy/paste to fix the rest."

Better automation to the rescue

Regular expressions are great when a fix is syntactical and constrained to a single line within the source. Unfortunately, source code will always have inferred semantic information that is not present in the syntax of the code.

A better approach is to use a search and transformation framework that understands both the syntactic and semantic structure of your code. As a prelude to what is next, I would like to introduce you to OpenRewrite, https://github.com/openrewrite/rewrite.

Colorful, semi-transparent Moderne symbol breaking apart like a puzzleColorful, semi-transparent Moderne symbol breaking apart like a puzzleColorful, semi-transparent Moderne symbol breaking apart like a puzzle

Back to Blog

Colorful, semi-transparent Moderne symbol breaking apart like a puzzleColorful, semi-transparent Moderne symbol breaking apart like a puzzleColorful, semi-transparent Moderne symbol breaking apart like a puzzle

Back to Engineering Blog