Cognitive Scaffold

Preparing your thinking workspace

arrow_back_ios_new
MENTAL MODEL · M3424

Lasagna Code

Lasagna Code
BusinessHigh supportManagement
Included
account_tree

Updated 2026-07-31

Loading revision record…

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.

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/1

Practice this model in one real situation:

Check to track your progress (stored locally)
Learning progress0%

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.

  • link
    en.wikipedia.orghttps://en.wikipedia.org/wiki/Spaghetti_codeZH · Explicit
    verified
account_treeGenealogyexpand_more

RELATED MODELS