Here’s a great story to get you thinking about how legacy code can build up (I can’t find who originally told it).
At Christmas, a father prepares a Christmas ham. He cuts of both ends and puts it in the baking pan. His child asks why he cut off the two ends, wasting the meat. The father says it’s how he learned it from this mother.
Later, he wonders about his child’s question and calls his mother to ask the same question. She can’t answer however, and tells him to call his grandmother, whom she learned it from.
He calls the grandmother who tells him: “well otherwise it didn’t fit in my pan.”
“It’s the way we’ve always done it” is a blocker to innovation and improvement. And it can cause the amount of (what we consider) legacy code to build up until it is unmanageable. On the other hand, sometimes the old way is still the good way. Maybe it avoids some pitfall that isn’t clear to us currently.
So how can we distinguish the two scenario’s? By using Architectural Decision Records. They can help us identify the reasoning behind a certain way of working.