What do companies look for in code samples?

Even though only about 1 in 10 companies that I’ve contacted do this, I get worried about the dreaded request for code samples. With portfolio samples, the objective is easy, look for someone with visually pleasing websites that also fit the style they are looking for. But ironically, with code samples, I cannot understand how they think they can project a lot about my technical skills from a few short source files.

A company’s HR staff contacted me for a PHP developer position recently and then told me that the hiring manager (a technical lead) asked for some code samples.

I asked him what samples would fit the requirements they are looking for and the HR person said that he is not sure, but two files would do. I sent him two files, both from different projects and the code was for different purposes to show the versatility in my work. The context of each was explained a little in the e-mail.

Afterwards, they told me that I wasn’t considered to move forward with the hiring process. But more interesting was that they also said they had a bit of difficulty aligning my relative expertise to what the position is about.

Am I just bad at picking code samples? Was my syntax formatting bad? Lack of proper documentation? They didn’t say. Besides, with syntax formatting, every company has their own conventions that they follow and adapting to it is a trivial aspect to me. When a design portfolio gets rejected, you can safely assume that they did not like your designs, but I feel like I have to read someone’s mind when submitting code.

Some get stuck in the mindset “Coder” versus a “Designer”. That is, some see the clean web designs on your site (they’re nice) and may then next ask the question “yes, but what does his markup look like?”

Source code for HTML / CSS / JS can tell a lot about the maturity of a developer. Is it clean? Functional? Consistent across browsers? Flexible? Readable? Well commented? All of that speaks highly of your skills - in my mind, more than the overall appearance of the page.

If you’re asked for backend scripting / code - PHP, ASP, C#, JSP, etc. - it’s all about the cleanliness of the code, and how advanced it is. Is it as small as is necessary and no smaller? Easy to read? Avoid clumbsy and awkward conventions?

I’ve not heard of requesting these later types of code, but if they do, its likely best to send something that makes sense, if not a complete working example.

I consider myself fairly advanced in HTML and try to keep my markup tags to a minimum and avoid code bloat. My portfolio website is not perfect but I can still manage to make some things clean. For example, the gradient background image is defined in the h1 tag instead of an additional div tag.

By the way I’ve landed a full time web developer job already, but I appreciate the advice!

I wouldn’t necessarily assume it was your code samples that got in the way. They may have had many applicants and never even gotten to look at your code. I would say just keep persevering and be yourself. There’s a lot of competition in this world. Good luck!


I like your samples in your sig. Nice clean designs.

Keep your chin up.

That’s actually even worse, knowing that they did not bother reviewing something that they requested after having received your response. I’m not sure if they emailed a lot of applicants for this position. Pretty soon, college degrees need to become a guarantee for a job.

Unless I’m desperate, I will NOT submit sample code! This itself gives a lot of clues about that company. I’m fairly sure that they are micro managing their employees… yikes! A simple technical review through phone or face to face is more than enough to filter out the unwanted. Anyways, keep looking!