D
32

Before and after: how a simple code review changed my whole project

I spent 3 weeks building a small Python script for my work and it kept breaking every time I added a new feature. Then my friend who codes for a living looked at it for 10 minutes and pointed out I was repeating the same block of data cleanup code in 4 places. Once I made one little function for it, the whole thing got way easier to update. Has anyone else seen a huge jump from just one tiny refactor or is it usually not that big of a deal?
1 comments

Log in to join the discussion

Log In
1 Comment
baker.ben
baker.ben15d ago
Found the same thing with my own mess a few years back. I had this one chunk of date formatting that kept getting copied and pasted into every new script I wrote. It took maybe 15 minutes to make it a single function, but after that I could fix a bug in one spot instead of chasing it through five different files. The real kicker was that I stopped dreading adding new features, because I knew the messy part was already handled. It's not always that dramatic, but when you spot a clear repeat like that, it's almost always worth the time to pull it out. Most of my refactors are small and boring, but they add up to a project that doesn't fight me every step of the way.
1