Keep it simple, stupid.

When writing software, one really should endeavor to create programs that are easy to understand. The logic should be obvious and easy to follow. When it comes time to make changes, the developers who come after you will not want the software to meet them with irrational challenges.
Software development must not be an exercise in showing off how intelligent you are. One must resist the temptation to use tricky algorithms and obscure tricks of indirection. While these may provide a solution you consider “elegant,” others will find it difficult to understand your intent.
To make matters worse, the people who have to modify your code will likely be under immense pressure and probably won’t have access to you. If they’re unable to ask you questions, they will have to figure it out on their own. There’s a significant chance that they may misinterpret your intent.
So what are you giving to these future developers? A gift of maintainable code? Or a legacy of difficult challenges that they will need to replace? While the choice seems obvious, one should remember how many times you have encountered complicated code yourself. The urge to replace legacy code is strong because it costs too much to maintain. Only code that clearly reveals its intent will be admired and kept.