What trick/pattern/concept/whatever did you adopt that has improved your code quality?
One big thing that has made maintenance of my older code easier has been considering the concept of cyclomatic complexity. In particular, limiting conditional checks to exceptional cases as much...
One big thing that has made maintenance of my older code easier has been considering the concept of cyclomatic complexity. In particular, limiting conditional checks to exceptional cases as much as is reasonable has made it easier to focus on the "happy" path of code execution and easily track down the errors, and the limited nesting depth has made things easier to read as well. Overall, my code remains relatively flat and I'm not branching through layers of logic trying to track down a simple bug.
What are some simple things you do to keep your code from being a massive headache long-term?