Mark Watson’s Artificial Intelligence Books and Blog

Share this post

Code refactoring and cleaning out the garage

markwatson.com

Code refactoring and cleaning out the garage

Mark Watson
Jun 19, 2005
Share
Share this post

Code refactoring and cleaning out the garage

markwatson.com

My wife and I did a major garage cleanout this morning. We have a general rule: anything that has not been used for a year or two years goes to the Good Will charity (or the recyclers, or the trash - in that order). The same rule is not so bad for software systems also :-)

I made a small mistake recently while refactoring code in a large system written by other people. Refactoring is a functionality-preserving activity. It is usually a mistake to try to add functionality while refactoring; rather, we should make small changes with lots of intermediate testing in order to minimize debugging time (i.e., make one or two changes at atime, and is is more obvious what caused a new bug). I added some functionality to the system that I was refactoring and in the end, I think that it took me more time than breaking this process into two pieces: refactoring, then adding functionality.

Share
Share this post

Code refactoring and cleaning out the garage

markwatson.com
Comments
Top
New

No posts

Ready for more?

© 2023 Mark Watson
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing