The broken windows theory is a criminological theory of the norm-setting and signaling effect of urban disorder and vandalism on additional crime and anti-social behavior(James Q. Wilson, George L. Kelling)
The theory states that maintaining and monitoring urban environments in a well-ordered condition may stop further vandalism and escalation into more serious crime. The original example follows:
“Consider a building with a few broken windows. If the windows are not repaired, the tendency is for vandals to break a few more windows. Eventually, they may even break into the building, and if it’s unoccupied, perhaps become squatters or light fires inside. Or consider a pavement. Some litter accumulates. Soon, more litter accumulates. Eventually, people even start leaving bags of refuse from take-out restaurants there or even break into cars.”
Also, “A successful strategy for preventing vandalism is to fix the problems when they are small. Repair the broken windows within a short time, say, a day or a week, and the tendency is that vandals are much less likely to break more windows or do further damage. Clean up the sidewalk every day, and the tendency is for litter not to accumulate (or for the rate of littering to be much less). Problems do not escalate and thus respectable residents do not flee a neighborhood.” (Broken Windows: Restoring Order And Reducing Crime In Our Communities – George L. Kelling, Catherine M. Coles)
It goes the same with software development …
Sometimes you get the chance to work on a big legacy code base.
First thing to do is open you eyes and look around: look at the source code, do informal code review to share the knowledge, every time you see problems write them down, as most probably you will not be able to correct them immediately (use wiki, ticketing system or any alternative for this)
Share the list you’ve got with involved people and start the fixing activity. Fix most important problems first.
Then, in the future, be careful to clean problems while they are few and small, you already have a list of them and you know how ugly could get.