We are all attached to the things that we create. From our relationships, to our work, to trivial things like the way we decorate our home — we don’t like to destroy things that we have put effort into.
That’s why it’s even more important to delete your code.
When working on a project recently, I had put several hours into creating the application logic, crafting the code with care, and feeling quite pleased with myself. That was, until I realised that due to a requirement I hadn’t considered and my tight coupling of the code, I had written a codebase that was not flexible.
Being human and attached to my work, I tried to think of ways around this. I wrote convoluted methods to try to compensate for the lack of flexibility and whilst this worked, I knew that I was creating an overly complex system which would not be good for maintenance or even further development.
So after wrestling with this for a day or two, I reached the conclusion that rather than holding onto my old code because I felt attached to it, I should just delete it and start over.
I knew the architecture, and the new project goals. This means I would have the benefit of a ‘new’ project with zero technical debt. I also had the benefit of experience on my side and would not repeat the same mistake.
So with some trepidation, I ran the command:
rm -rf client-project
Within less than a second, hours of my work were deleted.
It felt good.
I was able to immediately spin up a new project and rapidly create a clean codebase which was not tightly coupled, worked perfectly to the new spec, and was ready for any changes that could be thrown at it.
Had I kept going with the old code then I would have become more and more frustrated as I tried to apply quick fixes to a codebase that would rapidly spin out control.
Instead, I now have a project which I can feel proud of and will deploy with confidence.
So for all developers out there who have been, are currently, or will be in this position. Delete your code. You won’t regret it.
Note: I did back up my code to Github before deleting it, just in case. That probably helped me feel a little better too ;)