Articles
Jun 5, 2023·3 min read

Broken Window Theory in Software Development

Years ago, Stanford University conducted an interesting social psychology experiment. A car was abandoned in the Bronx — a high-crime neighborhood in New York. Within hours, it was completely vandalized: parts stolen, windows smashed.

Another car was abandoned in Palo Alto, California. It remained untouched for over a week. To continue the experiment, researchers broke one of its windows. Within hours, the same vandalism process that happened in the Bronx had begun.

Applying the Theory to Software Development

If there's a broken window in a building and it isn't repaired for a long time, it gives the impression that the owner doesn't care. Eventually, more broken windows will appear.

Think of the window as a part of your code — from an implementation that doesn't follow the architecture, to a function whose name doesn't follow conventions. It gives the impression that nobody cares about the quality of the software being written.

A broken window — a piece of badly designed code, a poor management decision the team has to live with throughout the project — is what leads to the beginning of decline. If you're working on a project with several broken windows, it's very easy to fall into the mentality of "all the rest of this code is garbage, I'll just follow the example." It doesn't matter if the project has been going well up to this point.

The Pragmatic Programmer, Dave Thomas & Andy Hunt

Define Standards (and Follow Them)

By adopting code standards, developers establish a common set of rules and conventions — variable naming, code formatting, folder structure, comment usage, and more. These guidelines ensure the code is readable, understandable, and cohesive, regardless of who is developing or maintaining it.

Recognize and Take Responsibility

Identify parts of the code causing problems or not adhering to established standards. Take responsibility for fixing those areas. It doesn't matter how small the fix is — as the theory shows, it's not just about fixing the actual problem. It's also about sending the message that someone cares about well-written code and that action will be taken.

Promote a Culture of Continuous Improvement

Encourage the entire team to follow established code standards from the beginning of the project. Promote regular code reviews to identify and fix broken windows before they become more serious problems.


In summary, the broken window theory applied to software development highlights the importance of maintaining clean, standards-compliant, high-quality code. This involves following coding standards, fixing problem areas, and promoting a culture of continuous improvement. These practices help preserve software quality and prevent code decay over time.