Don’t be offended when your code gets refactored.
Some developers get upset when they find out the software they spent countless hours working on has been refactored by a new programmer. They take pride in their work and consider it a personal offense when their code is replaced. Perhaps they feel that their code was perfectly fine and shouldn’t be altered.
There are many things wrong with these lines of thought. First of all, software is a living document. As time goes on, new developers are always adding to it and improving it. New techniques and libraries become available over time, and this leads to many opportunities for improvement. One should not expect software never to change.
Secondly, pride is not a virtue. You simply have to admit that you’re not the best programmer in the world. Your code isn’t perfect. It may run, it may pass tests, but it can always be improved. Accept this and embrace the idea of improvements.
Finally, be thankful that someone found the time to make your code better. They’re doing you, and everyone else, a favor. It’s not a personal attack. It’s an improvement on the foundation you built. Be honored that you’re part of a team that continues to deliver the best software.