How Many CTOs?

What are the challenges and strategies for decomposing a software monolith?

Short answer

Decomposing a software monolith involves complex challenges such as managing technical debt and tightly coupled systems. Strategies include incremental rewrites and maintaining clear boundaries to enhance system flexibility.

Decomposing a software monolith involves complex challenges such as managing technical debt and tightly coupled systems. Strategies include incremental rewrites and maintaining clear boundaries to enhance system flexibility. The process can be arduous and requires careful planning and execution to avoid pitfalls that can lead to more entanglement rather than resolution.

Understanding the Monolith Challenge

A monolith, especially one that has evolved over a decade or more, often becomes a "ball of mud" - a term used to describe a system with poorly defined boundaries and interdependencies. Scott described a typical scenario: "A monolith, when we say monolith, we're talking about a back-end, a giant back-end service that does many things, that has been adapted and evolved over the years as a business has grown and changed." ▶ 2:33. This evolution often leads to a system resistant to change due to tightly coupled components and accumulated technical debt.

Strategies for Decomposition

The primary strategies for decomposing a monolith are rewriting the system from scratch or incrementally refactoring it. Rewriting can be alluring but is fraught with risks, as Brad noted: "The teams that I've seen that I'm not going to say they're going to hit it out of the park. I'm not saying they've solved this problem, but the ones that I've seen manage this problem the most are the ones that essentially don't try to rewrite the whole system." ▶ 16:44. Incremental refactoring involves extracting smaller, less constrained components first, which can gradually lead to a more manageable system.

Real-World Examples and Lessons

Scott shared a real-world example from his time at Rover, where a seemingly simple change in the system required extensive investigation due to interdependencies: "We wanted to change the number of days in the future that somebody could schedule a dog sit... the estimate comes back like at two months... there were 21 places in the system that depended on this thing." ▶ 9:05. This illustrates the complexity of working within a tightly coupled system and the necessity of understanding all dependencies before making changes.

Measuring Success and Overcoming Resistance

One of the significant challenges in decomposing a monolith is demonstrating the value of the effort to business stakeholders. Scott emphasized the importance of metrics: "But once you've done the work, you ought to be able to have some metric of projects that touch this now go faster." ▶ 20:14. However, translating technical improvements into business value can be challenging, as stakeholders may not feel the benefits as tangibly as they do financial metrics.

The Role of Organizational Discipline

Successfully decomposing a monolith requires not just technical strategies but also organizational discipline. As Scott pointed out, without a disciplined approach, efforts can result in little progress: "You put some effort into chiseling some stuff off, but you never really make a ton of progress. You just it's a grind." ▶ 6:04. This discipline includes maintaining clear boundaries, enforcing best practices, and ensuring that new code does not introduce additional complexity.

The Financial Perspective

Brad suggested that viewing the codebase as plant and equipment might help convince business stakeholders of the necessity for ongoing maintenance: "If you think of your code as your plant and equipment and there's less you have to maintain," ▶ 34:19. This perspective can be useful for framing the conversation about why continuous investment in the codebase is necessary, akin to regular maintenance in a factory setting.

The Incremental Approach

Scott and Brad discussed the importance of taking an incremental approach to decomposing a monolith. Scott mentioned that often, the most obvious components to extract, like user or order objects, are the hardest because they are deeply intertwined with the rest of the system. Instead, teams should focus on peeling off smaller, less critical parts first. This approach allows for gradual progress without overwhelming the team or disrupting the system's functionality.

Conclusion: A Long-Term Commitment

Decomposing a software monolith is a long-term commitment that requires strategic planning, patience, and organizational buy-in. It involves navigating technical challenges, managing stakeholder expectations, and maintaining a disciplined approach to system architecture. As Brad and Scott discussed, while there is no one-size-fits-all solution, the key lies in incremental improvements and a willingness to adapt and refine strategies over time.