DEV Community

Discussion on: What’s your favorite piece of code that you had to throw away?

Collapse
 
cubiclebuddha profile image
Cubicle Buddha

Truth! Recursive algorithms can almost always be expressed more simply.

That being said, have you ever had to delete code that you felt was as good as it can get? Or have you ever had a project canceled that you really enjoyed?

Collapse
 
andreasjakof profile image
Andreas Jakof • Edited

I threw away lots of code that was as good as it gets to my abilities at the time. But since I am still learning every time I do something in code (mostly intentionally) I never feel any regret or remorse, when deleting old code of mine.
Even though I might have done it similarly, I never get attached emotionally to code I produce. I code, because I like solving problems and the challenges that force me to learn.
So even though I threw lots of code away in my personal or professional life. I never felt, that I am destroying something invaluable. It‘s a means to an end. And if that end is reached, it can go.
Maybe IF I wrote an AI sometime in the distant future, that shows human treats, I could not, but so far... I always loved hitting the delete button.

But if I had to pick something, I'd choose a BER-Parser-Implementation, that was never used. I just wanted to see, if I can do it and used it at one point in my own code, which was superfluous, when we chose Azure-ADFS for authentication.
Others prefered the one from BouncyCastle or just dont want to have anything to do with certificates.

And I guess, there is another exception, which I wrote about already here: dev.to/andreasjakof/brilliant-but-...
It was wrong to do it this way, but still ...