It’s ok to throw away your code. You will write it even better next time.

code

Being a software developer is not easy. When I say it’s not easy, I do not only mean its technically challenging, but its also emotionally challenging.

We as a developer can get attached to our code. We write it while our mind thought of creative ways to solve complex problems. The solutions we have are like our brainchild. However we work in a world that is constantly changing. Change happens around us and its inevitable. You can do scrum, mocks, freeze the product specification but a change will always happen and it can happen to an extent that the code you have written for a problem would not be applicable anymore. As far as that product is concerned, you may as well trash that code.

Despite of all that, I am here to tell you that its okay. It’s okay to throw your code and write it again. Yes it requires time and it’s not always justified but every creative challenge you have solved while writing that code has made you a better developer already. It may not do the product any good anymore, but it has already done good to you.

Every time you discover a new or a better way to do something it makes the previous method obsolete. Developers would often create something and keep throwing away/updating their code until they are satisfied with its performance, neatness and efficiency. The earlier in your developing career you learn, that its okay to throw the code and write it again, the more happy you will be working as a developer.

I have had plenty of encounters where I had to throw away the code and write it again, but every time you come back to a problem after a while, you have a fresh point of view and possibly a different approach, which can be efficient and better than the previous approach. Even if its not efficient than the previous one, its definitely neat and organized than previous one. It’s because you have already solved the problem once.

Therefore my friends, if you find yourself in a situation where you probably have to trash your code – archive it, and if you happen to write it again, compare the archive with the newly written code. You will probably find that you have gotten better.

Share your thoughts in comments.