Lasagna Code
Updated 2026-07-31
Summary
A software architecture with so many strictly separated layers that a small change must pass through a dozen of them.
Definition
Lasagna code is an architecture with too many layers and boundaries drawn too strictly, so that changing one small feature requires traversing controller, service, manager, and data-access layers in sequence. Each layer is internally clean and the separation looks principled, yet the vertical cost of any end-to-end change grows with the number of layers. The same pattern appears in organizations with many reporting levels, where information degrades and decisions slow as they travel upward. Decoupling in one direction creates a new coupling in another.
Introduction
How to use
- Count the crossings: measure how many layers a typical end-to-end change must pass. - Slice vertically: group code by business capability rather than by technical layer. - Flatten the static parts: merge or skip middle layers that rarely change.
Mechanism
Strict layering decouples components horizontally while creating a vertical dependency chain. Every change must be threaded through all layers, so coordination cost grows with depth and each hop adds translation, delay, and information loss. Clear structure and maintainable structure are therefore not the same property.
Practice
In progress 0/1Practice this model in one real situation:
Cases
- A one-field change in a layered application travels through controller, service, manager, and data-access code before it ships.
- Large firms with many approval tiers respond slowly because each level adds delay and distortion.
Common pitfalls
- Assuming that more layers always means clearer responsibilities.
- Confusing structural clarity with maintainability.
- Decoupling horizontally while leaving the vertical chain untouched.
Sources
Source support: Explicit
References currently contain only Wikipedia links; primary sources still need review.
- en.wikipedia.orghttps://en.wikipedia.org/wiki/Spaghetti_codeverified
account_treeGenealogyexpand_more
PRIVATE NOTES · Only visible to you
SAVED Q&A
ENTRY Q&A · Private saving available
Ask with a clear boundary
thinkingmodels answers from published entry context only.
Your question is sent to thinkingmodels. The answer uses public entry context only.
RELATED MODELS