This is a pretty good article to check out (or just read my summary below):
I don't agree with programming with a 20 year lifespan in mind, but people should definitely think in terms of code being around for 2-3 years and modified by 4-5 future developers that you have not met during that time.
- Stable - Unexpected inputs should lead to simple errors rather than cascading failures.
- Flexible - Lower level code should be flexible enough to accept some changes in higher level code without modification.
- Extensible - Interfaces should be written to be extended in the future, not with the presumption that there won't be any change in the future.
- Maintainable - Code should be clear and precise so that future developers can change methods without fear of breaking existing functionality. The corollary here is that automated regression tests should be part of the codebase.
- Scalable - Logic should be able to scale. It doesn't matter how fast an action is per se - it matters how scalable the action is with regards to the frequency with which it will run and how that impacts the rest of the system.