There have been times when I have thrown away my code. Did you ever face this situation – I am very sure you did, as every developer does. Something that I have sweat over, written to deliver results, is ready to be discarded now thrown because I no longer need it or I find better ways of doing the same thing.
I never mind hitting the delete key on a code; actually when I reach that decision, I start to enjoy the experience as I realize that I am now evolving. I have faced this situation many times and it was only the first time that I was hurt. I still remember almost 3 years back when my Architect told me to scrap everything and start afresh, I was aghast, but now when I look back I realize how good a decision was that.
Today, as well, I am facing a similar situation, when I am looking at improving a code base which will bring in performance improvements to the application I am working upon. While the effort is a significant one, and I have many other things to take care of, the task itself is fun.
Do not get carried away with this and start doing it with your code, do it when it makes sense.