Lava Flow
Lava Flow is an anti-pattern where old, fragile code remains in the system because no one fully understands or dares to remove it. Like hardened lava, this code was once fluid but has since cooled into a rigid structure—difficult to change, yet essential to production.
Background and Context
Lava flow often originates from experimental code, one-off patches, or rushed decisions that are never revisited. Over time, these paths become dependencies, even though they are undocumented or rarely maintained.
The more a team fears touching it, the more embedded it becomes.
Root Causes of Lava Flow Code
This pattern emerges when delivery takes priority over hygiene. Common causes include:
- Legacy systems maintained by new teams with no historical knowledge
- Features added without tests or documentation
- No clear ownership or long-term roadmap for older components
- Fear of breaking critical but mysterious dependencies
When something works but no one knows why, it is probably lava.
Impact of Undocumented, Untouchable Code
Lava flow traps teams in complexity. Effects include:
- Delays when new work depends on legacy paths
- Risk of regression from invisible dependencies
- Higher onboarding friction and training costs
- Systems frozen in place due to fear of change
Inaction feels safer than improvement, until it is not.
Warning Signs of Lava Flow
This anti-pattern often hides in core systems. Watch for:
- Code that has not been edited in years but still runs in production
- Sections where multiple teams say “we do not touch that”
- Functionality no one claims to own or understand
- Files filled with comments like “temporary fix” or “don’t delete this”
If every workaround traces back to the same place, lava has hardened.
Metrics to Detect Lava Flow
These minware metrics can help highlight brittle and aging system components:
Metric | Signal |
---|---|
Code Churn | Low churn in core files may reflect fear, not stability. |
Rework Rate | Frequent patching around the same modules suggests embedded fragility. |
Defect Density | Bugs in unowned, rarely touched code point to lava flow risk. |
The riskiest code is often the most mysterious, not the most active.
How to Prevent Lava Flow
Prevention requires intentional code hygiene and documentation. Best practices include:
- Regularly review and refactor legacy systems
- Rotate ownership of older components to maintain context
- Document critical logic, even when it is “temporary”
- Treat legacy cleanup as strategic, not cosmetic
The best time to clean it up was when it was written. The second best time is now.
How to Melt the Lava
If lava flow is already entrenched:
- Start with tests to build confidence in behavior
- Refactor in stages rather than all at once
- Assign cleanup as part of ongoing delivery, not a one-off task
- Track technical debt and make it visible to stakeholders
Lava flow is a byproduct of fast-moving teams, but it does not have to remain permanent.