One of the things I eventually realized was that -- maybe not for everyone, for all programs, but certainly for a lot of people -- the programs we write are very incomplete. There's a portion that we write down, that the machine runs, and then there's a portion that's only in our head.
When you've got both portions, everything is awesome. I'd worth with a guy for years, and never had a problem with them. If I was working with some code they wrote and didn't get what was going on, I'd ask them, they'd explain, it'd make sense, and everything would be fine.
Then they'd leave, and I'd no longer have access to the portion of the program in their head, and the code they'd left behind would become worthless crap. The structuring was all wrong, the choice of variable names idiotic, the corner cases they handled seemed trivial and the ones left unhandled, crucial.
Maybe there's something wrong with everyone I used to work with (as I tended to think the first time or two this happened), maybe if we were better and writing documentation this wouldn't happen. But it is very, very easy to be given a codebase from a former employee -- a perfectly fine codebase written by a perfectly competent employee -- and conclude they are an idiot, because you're missing the portion that's in their head.