Legacy code bases and the five stages of griefFrom denial to acceptance, learn how to navigate the emotional stages of working with legacy code and turn frustration into growth. Thomas Taylor | September 13, 2023
Hey there, I'm Thomas, and I've recently joined Swell as a UI Engineer. Currently, I’m focused on improving Swell’s admin dashboard and implementing a new design system. Here's a glimpse into my journey thus far...
Established code bases can be both a blessing and a curse for Engineers—regardless of seniority or experience. On one hand, they provide a foundation for building upon existing systems (keeping in mind these systems are paying your salary). On the other hand, they often come with technical debt and haven’t kept up with the rapidly evolving frontend world that can make even the simplest task feel like an uphill battle. As engineers delve into these code bases, they often find themselves experiencing a range of emotions that mirror the five stages of grief. In this blog post, I will explore these emotional stages and provide tips for navigating each one effectively.
Stage 1: Denial
When confronted with a sprawling and complex code base - regardless of seniority, it's common to experience a sense of denial. "This can't be as bad as it looks", you might think. Unfortunately, denial can hinder progress as you underestimate the complexity of the situation. To move past this stage:
Accept reality: Acknowledge that the code base is indeed challenging. Embrace the fact that you'll need time to understand its intricacies.
Documentation is key: Start by documenting what you observe, even if it seems chaotic. This will help you create a roadmap for understanding the code better.
Set realistic expectations: Give yourself permission to encounter difficulties and setbacks. Patience is crucial.
Stage 2: Anger
As you begin to unravel legacy code, frustration and anger may set in. Why was the code written this way? Why weren't better practices followed? Instead of dwelling on these emotions, channel them constructively:
Avoid blame: Remember that the original developer/s likely had their reasons, be it tight deadlines, limited resources, or anything in-between.
Find venting outlets: Discuss challenges with colleagues or in online communities. Sharing experiences can provide emotional release and potential solutions.
Incremental improvements: Identify small, manageable tasks you can improve. This will give you a sense of accomplishment and gradually transform the code base.
Stage 3: Bargaining
In the bargaining stage, engineers may try to find shortcuts or ways to make the legacy code work temporarily. This can lead to patchwork solutions that only exacerbate the issues. Instead:
Plan for refactoring: Instead of patching, plan for systematic refactoring. Identify key areas to improve and create a clear refactoring strategy.
Balance pragmatism and long-term goals: while it's important to address immediate concerns, don't compromise long-term maintainability. Strive for a balance between quick fixes and holistic improvements.
Stage 4: Depression
As the enormity of the task sinks in, feelings of hopelessness and depression may emerge. The code might seem insurmountable, and doubts about your own abilities might arise. To overcome this stage:
Break it down: divide the code base into smaller, manageable sections. Tackling one piece at a time can make the challenge seem less daunting.
Celebrate small wins: recognize and celebrate each successful refactor or improvement. These victories build confidence and momentum.
Seek support: collaborate with team members or mentors. They can provide fresh perspectives and encouragement when you're feeling stuck.
Stage 5: Acceptance
Finally, after investing time and effort, you'll reach a stage of acceptance. The code base's flaws are no longer a surprise, and you've made significant progress. To reach this stage:
Celebrate achievements: reflect on how far you've come and the positive impact your efforts have had on the code base.
Share knowledge: document the improvements you've made and share them with your team. This ensures that future engineers won't have to endure the same struggles.
Learn and grow: embrace the lessons learned from working with legacy code. These experiences will make you a more adaptable and skilled developer.
Working with legacy code bases can be an emotional roller coaster, but by acknowledging and navigating the stages of grief, engineers can turn frustration into growth. Embrace the journey, apply patience, and remember that the process of improving legacy code is a testament to your resilience and dedication as a software engineer.
I look forward to sharing more about our design and development process, and the major improvements coming to Swell merchants soon. Stay tuned!
Paypal Commerce Platform integrationAugust 14, 2023
right to your inbox