In my search to expand my dev team, I use a code sample as one of the main determining factors. During an interview, I will always make the same request:
“Give us a code sample. It can be something that you think is really great, or something you think really sucks. Most importantly, tell us why you think it’s great, or why you think it sucks.”
No one seems to able to do it. I have received code samples that consist of stream wrappers, database wrappers, complete websites, etc. Some have been really good, and some have been outright scary. But very few candidates have been able to communicate what they think of their own code and why.
Which is very surprising, given most developers’ proclivity to judge others’ code as total crap without a second thought (guilty).