We’re currently hiring for a few .NET programming positions and always ask applicants to provide a code sample. Some applicants can’t provide one since everything they have is confidential information, and we don’t penalize people for this. Some others have to check with their employer or previous employer first, and we always consider this a good sign. And others just go ahead and send us samples, which is usually ok but it can also be bad.
On occasion we get samples that have obviously confidential or proprietary information in them. This is always a red flag. Even if the code is very good, the fact that a person was willing to send his current or previous employer’s confidential information to a prospective employer as an example of work is bad.
In one particularly agregious case we received an application that had the company’s database domain name, username, and password all within the config file. That’s a major security problem. Not the type of security problem we’d like to hire into our company.
So if you’re applying for a job and providing a code sample, think not just about the quality of the sample but what information it contains and what it conveys about you, your honesty, and your consideration of others confidence and privacy.