The developer had initially used string concatenation to generate the HTML code for the row dynamically. As the complexity grew, it started getting hard to read and evolve. So I suggested the developer to use one of the template engines to replace string concatenation. However, I did not see him taking that direction in the next few days. I got curious what is holding him from making that move.
During the conversation, the developer told me that he had put some hard work to get the feature working, and using the template engine would mean deleting loads of existing code, particularly the one that was hard to write. He was finding it hard to see his code going away. As I understood the problem, I told him - "Don't fall in love with your code!", and explained the reasons behind it. Well, the code is just a means of delivering value. The moment, the value diminishes, the code has to change or go away. So instead of loving the code you wrote, the developers should enjoy the act of evolving their code and make sure it delivers real value. Better maintainability is also value here.
I have facilitated several code retreats. In code retreat, we delete the code at the end of each session. I have often seen participants having a hard time deleting the code.
If you are in love with someone, you must accept them as they are. However, this does not apply to the code you write. Please don't keep the code as it is. Let it evolve and deliver better value. Happy coding.