Legacy Code and the Buddhist Monk


Many, many years ago, I was at my rock bottom. I decided to leave a relationship that had turned abusive, and the financial burden of the ordeal cratered my credit score, dismantled my social network, and shattered my self-confidence. I felt so broken. Unloveable. Unrecoverable. Disposable.

I could go on and on about my trials, but I’ll spare you the details and skip to the moment that matters. During this difficult time, I stumbled on a book by a Buddhist monk named Pema Chodrön titled Start Where You Are. In chapter six, I came across this passage:

“Start where you are. This is very important. [It] is not about later, when you get it all together and you’re this person you really respect…Just where you are—that’s the place to start.”

Those sentences were my turning point. I started seeing myself as valuable and worth saving. Once I adopted the mindset that my current situation did not define my worth, I started to notice ways I could make things better. Some of these were small daily habits, like journaling and meditation, while others were big shifts, like moving to a new city. I felt motivated to make these improvements and also gave myself a lot of grace during the process.

Two years later, I looked back in awe of how much better my situation was. I felt confident and enjoyed my life. I felt like a new person.

Around this time, a friend from high school invited me to join his startup, Corgibytes. He loved improving legacy software systems using methodologies such as XP and Agile. Little did I know that my experience of rebuilding my life by embracing a “Start Where You Are” mindset would be so applicable to software modernization initiatives.

Software systems can find themselves in a state of “rock bottom,” too. These systems, while often serving critical business needs, become incredibly difficult to change due to technical debt, a feature-only focus, an outdated model for ongoing development, and too much deferred maintenance. When projects get to this state, they also get branded with the moniker “legacy code” — code that is undesirable, complex, and hard to improve.

When we encounter projects like these, we need to channel our inner monk. Start where you are. Eliminate the shame that goes with having a messy codebase. Embrace that your system is worth investing in and start making it better from where you are today.

The “start where you are” approach to legacy systems is also useful because it so beautifully captures the nature of continuous improvement, which is one of the foundational elements of agile software development. You don’t have to go from where you are today and take a monumental leap into perfection tomorrow. You just need to move forward, however small that step may be. Do this over and over and over again with consistency and eventually, you’ll be able to look back on your progress and see how far you’ve come, just like I did with my personal situation.

In fact, the idea of perfection is incredibly elusive and something that you’ll never achieve. Getting your software to an imaginary ideal isn’t realistic because the environment in which it is developed is ever-changing. Even if you did achieve perfection today, chances are there will be something — a third-party dependency, a language, a framework, a security vulnerability — something that needs to be done in reaction to a change outside of your codebase. When you need to change, you start where you are all over again.

It’s so easy to look at a software system that’s difficult to work with and look past its inherent value. When we only look at the flaws, it’s tempting to want to throw it all away and begin anew, where things aren’t so messy and complicated. However, this is often a misguided bias. Rewrites can be risky and more expensive when compared to using strategies that are more gradual, such as the strangler pattern. By applying the principles of continuous improvement, you can transform your system and make it a joy to work on again. The first step? Start where you are.

Want to be alerted when we publish future blogs? Sign up for our newsletter!