Are there any common practices in mathematics to guard against mistakes? It occurred to me that math is somewhat like programming (or vice-versa, if you prefer) because, in both, it is easy to make mistakes or overlook them, and the smallest error or misguided assumption can make everything else go completely wrong.
In programming, in order to make code less error-prone and easier to maintain, there are some principles such as don't repeat yourself and refactor large modules into smaller ones. If you ask any experienced programmer about these, he will tell you why these principles are so important and how they make life easier in the long run.
Is there anything that mathematicians frequently do to protect themselves from mistakes and to make things generally easier? If so, what are they and how do they work?

An example:
After Doron Zeilberger was criticised repeatedly for errors in his long proof of the alternating sign matrix conjecture he rewrote it in a tree-like structure and had other people check each node of the tree:
http://arxiv.org/abs/math/9407211
