I wrote it, and it was horrible
I needed to handle some task recently, so I sat down and did just that. It took me most of a day to get things working.
The problem was that it was a horrible implementation, and it was what you might call fragile:
I don’t usually have the patience to tolerate horrible code, so after I was done, I just reverted everything, without bothering to stash my work somewhere where I could retrieve it later. That sort of code is best kept lost.
Time lost: ~12 hours.
I talked with other team members about how to resolve the problem and they made me realize that there isn’t a great deal of difficulty in implementing that and that I am just being an idiot, as usual. With that insight, I spent maybe two hours in rebuilding the same functionality in a much more robust manner.
I could also reuse all my understanding on how things should behave, now that I knew all the places that needed to be touched.
Overall, it took me about 14 hours (spread over three days) to implement the feature. Scrapping out everything and starting from scratch really paid off, I invested 15% of the original development time, but I got a robust, working solution.
Trying to fix the previous implementation would have taken me significantly longer, and would result in a fragile bit of code that would likely need to be touched often.
Comments
I doubt there is any programmer out there who doesn't have this once in a while...I just had this on a minor scale two days ago for a component for natural language time period output.
The first 5 tests were fine, the next five were awkward to pass and the 11th test required me to scrap the whole lot and make it new.
Pure LOC is pretty much the same, just clean and it will just work as intended.
Smoke screens! Just another Clark Kent move, I'm on your tail Superman...
I don't know about you, but sometimes typing "git --reset hard HEAD" to backout of a crappy codathon is a big relief!
Reminds me of the line from Fred Brooks' book, "The Mythical Man-Month" -- "Build one to throw away."
Comment preview