In my new job I'm dealing with a lot of legacy code and from time to time, I want to set it all on fire and burn it to the ground and nuke it and burn it again, just to completely rewite everything. And although I know, that exactly this would be wrong, introduce a lot of old/new bugs blablabla, I still have this wish sometimes.
When I was unemployed, I found a long thread on Hacker News about this topic: Ask HN: Codebase at my work is a complete mess, what should I do?. When I first saw it nearly two months ago, I just left the browser tab open to read it sometime in the future.
I spend a lot of time commuting these days and so I'm quite grateful to have something interesting to read. Last week, I stumpled upon the HN-tab again and sometime in the future has turned out to be since last week. There are a lot of good advices, this one made me smile:
You know what they say in [real estate] about 19th century buildings, which are certainly technically inferior to newly constructed houses? „At least these buildings have been standing for a century without collapsing“
Another one compares large codebases with very interesting puzzles.
What has helped me in the past when dealing with legacy code, was to ask myself and other people: "Why are things the way they are? How do they work?" instead of judging them in the first place. I still regularly fail to not judge things. Most of the time, I just didn't understand the code.
Maybe I should be more grateful to see buildings from the 19th century. Oh, and I totally suck at solving puzzles. But nevertheless, I like them. Sometimes.