Broken Windows Theory
The Broken Windows Theory in software was popularized by the book The Pragmatic Programmer. In a city, a broken window left unfixed signals neglect and invites more vandalism. Similarly in code, an apparent bug or messy section left untreated can lead to more developers bypassing the process or introducing more mess.
The idea is that quality problems snowball if left unaddressed. For example, if a team routinely ignores failing tests or lets linters/errors slide during builds, developers get the message that it’s okay to ship sloppy work. This accelerates code decay (also known as software entropy).
Conversely, if a team quickly fixes minor issues and maintains high standards, it creates a culture of quality.
- If you let minor bugs and bad style slide, people assume quality doesn't matter, and they'll ship messier code.
- A clean, well-maintained codebase encourages engineers to keep it clean, whereas a chaotic codebase encourages corner-cutting and further degradation.
- Fix problems while they're small. Refactor destructive code, update outdated docs, to prevent a downward spiral of code health.
评论
?
参与讨论