Refactor Legacy Code

Refactor to Learn What Not to Do

One of the things that I was not expecting when I started refactoring other people’s code was that I started to see improvements in the way I wrote my own code. I didn’t make those same mistakes. Refactoring other people’s code has taught me a great deal about things to do and things not to …

Read More
Refactor Legacy Code

Refactor to Clean Up Before Moving On

Of course, the best time to refactor code is while it’s fresh in your mind, right after having worked with it. Once I get a feature to work, I go back and think about how I can make the code easier to understand. I’ve done this so often that it’s natural for me, almost of …

Read More
Refactor Legacy Code

Refactor to Redesign When You Know More

One of the reasons that I’m such a proponent of doing emergent design or just-in-time design, is that this is how we learn a system and this is typically how a system needs to be built. It’s fallacious to believe that you can easily envision every aspect of a complex system and come up with …

Read More
Refactor Legacy Code

Refactor to Clean Up as You Go

We should be refactoring the code we write and all the code that we encounter all the time. Making little improvements to code should be just something that developers do without even thinking about it. I find that many of the anti-patterns the developers engage in when writing code are easy to spot and after …

Read More