This morning, I happened to be looking over some of my early PowerShell code, written about a year ago if I remember correctly. My first impulse was to eliminate all evidence that it ever existed. The problem is, I published it online, and tracking down every person who ever viewed or downloaded the thing seemed like a daunting task.
So, I decided instead to make a project out of cleaning up this old code, using the tools and skills I’ve picked up in the last year. In particular, I’ll be using Pester to write a suite of tests for the code, and then I’ll be refactoring it from a single 300-line Advanced Function into much smaller, easier to understand units.
I’m not sure how much time I’ll have to dedicate to this, and it will be fairly slow-going since I need to try to document my thoughts and changes every step of the way. However, when it’s done, I hope that it will present an interesting read for anyone who’s had to maintain legacy code (yours or someone else’s), opened up the file, and thought, “WTF?!”
At any point, you can refer to the repository’s log file to see the complete history of what’s been done so far, including links to the commits and files referenced in each step.