I’ve read a very interesting article today about creating unmaintainable code (was also featured on Slashdot, funny comments ahead!) and, as many fellows have observed, documentation is indeed its most important cause factor. Lack of documentation (very frequent) or even misleading text (that’s unusual, but can happen by being not up-to-date) gets in the way of understanding the decisions and (sometimes weird) behaviors behind a piece of software’s development.
I cannot say I’m not guilty of such bad practices, and recommend reading the article because receiving/using “unmaintainable” code tends to happen to almost all developers at some point.