Ball of mud is the world's most popular software architecture. The one we all use at work while we debate gang of four and fancy patterns on the internet.
But a ball of mud is awful to work with. Sneeze in one part of the codebase, break features you didn't even know existed. Slows you down, causes bugs, makes you want to rage quit the industry.
So what do you do? How do you fix a rapidly deteriorating codebase?
People. The answer is people. I've spent years of digging into architectural complexity and best I can tell there are two solutions:
- Stressed burnt out architect(s) running around fixing things, being annoying, and slowing you down
- Teams and processes structured in a way that self-corrects
How people fix a ball of mud
Here's what you do: Give people or teams ownership of parts of the system. Over time the system will naturally break into decoupled sub-systems where sneezing in one area doesn't break the other areas.
Decoupling happens on its own. Your job is to give folks ownership, step the heck back, and let them shine. Be patient and give people space to fix things when they're annoyed. Let annoyance fuel their refactors π
Pay close attention to the abstractions that arise. What patterns are people repeating?
Make those The Official Way We Do Things. Build tools to make those patterns easy and others hard. Architecture is like a path in the woods. Desire paths rule.
Encourage contract-driven-development
When people or teams work together, get them to sit down for 15 minutes before writing any code and discuss their approach. Identify moving pieces and how they talk to each other. This naturally leads to decoupled systems with clear interfaces.
Type-driven-development also works. The goal is to define your architecture before you have long frustrating debates in pull requests.
If your engineers don't wanna play ball, wait until they feel frustrated about all those async discussions then suggest "Hey this would've been easier if you talked about it before writing code" :)
I like the swarm doc format.
There is no perfect
You may think you're brilliant, but it's almost impossible to build good architecture as a soloist programmer working on a feature or large program that fits in your head. You will make all the code entangled into one big blob. Even if you think you're not.
The architecture will never be perfect. Small balls of mud is the best we can do. The size depends on how many people work together.
Cheers,
~Swizec
PS: this is sometimes called the inverse conway manuever
PPS: in a changing business today's perfect architecture is tomorrow's pile of mud
Continue reading about *People* detangle a ball of mud
Semantically similar articles hand-picked by GPT-4
- Big Ball of Mud βΒ the world's most popular software architecture
- Finding modules in a big ball of mud
- Why even care about code structure
- Software architecture IS Conway's Law
- You can't fix the wrong abstraction
Learned something new?
Read more Software Engineering Lessons from Production
I write articles with real insight into the career and skills of a modern software engineer. "Raw and honest from the heart!" as one reader described them. Fueled by lessons learned over 20 years of building production code for side-projects, small businesses, and hyper growth startups. Both successful and not.
Subscribe below π
Software Engineering Lessons from Production
Join Swizec's Newsletter and get insightful emails π on mindsets, tactics, and technical skills for your career. Real lessons from building production software. No bullshit.
"Man, love your simple writing! Yours is the only newsletter I open and only blog that I give a fuck to read & scroll till the end. And wow always take away lessons with me. Inspiring! And very relatable. π"
Have a burning question that you think I can answer? Hit me up on twitter and I'll do my best.
Who am I and who do I help? I'm Swizec Teller and I turn coders into engineers with "Raw and honest from the heart!" writing. No bullshit. Real insights into the career and skills of a modern software engineer.
Want to become a true senior engineer? Take ownership, have autonomy, and be a force multiplier on your team. The Senior Engineer Mindset ebook can help π swizec.com/senior-mindset. These are the shifts in mindset that unlocked my career.
Curious about Serverless and the modern backend? Check out Serverless Handbook, for frontend engineers π ServerlessHandbook.dev
Want to Stop copy pasting D3 examples and create data visualizations of your own? Learn how to build scalable dataviz React components your whole team can understand with React for Data Visualization
Want to get my best emails on JavaScript, React, Serverless, Fullstack Web, or Indie Hacking? Check out swizec.com/collections
Did someone amazing share this letter with you? Wonderful! You can sign up for my weekly letters for software engineers on their path to greatness, here: swizec.com/blog
Want to brush up on your modern JavaScript syntax? Check out my interactive cheatsheet: es6cheatsheet.com
By the way, just in case no one has told you it yet today: I love and appreciate you for who you are β€οΈ
