Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Recently I was asked to show "a page with code" for a job interview. Being mainly a back-end programmer, and that's the position I applied for, I first said to the person I was talking to exactly that: PHP is executed at the server and therefore not visible by just giving a "page".

However, following their desire, I sent links to the pages I've worked on before. Obviously they couldn't see anything except for the HTML, CSS, JS... They said it was not enough, they could not see the PHP.

Understanding that they probably just wanted to know my skills and/or interest I sent them my Stack Overflow profile. Among all my questions and answers, most of them with code, certainly the PHP is there. But it seems this is not what they wanted.

Well, I don't have any code put together that I can simply publish for someone to see. And I would never do it for the code I have deployed, obviously.

So my question is/are: What does "send us a page with code" mean? What should I send? Is this a typical interview requirement?

share|improve this question

closed as off-topic by GlenH7, MichaelT, Dan Pichelman, gnat, Bart van Ingen Schenau Oct 12 '14 at 15:54

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking career or education advice are off topic on Programmers. They are only meaningful to the asker and do not generate lasting value for the broader programming community. Furthermore, in most cases, any answer is going to be a subjective opinion that may not take into account all the nuances of a (your) particular circumstance." – GlenH7, Community, gnat, Bart van Ingen Schenau
If this question can be reworded to fit the rules in the help center, please edit the question.

From the recruiting person's point of view, this just says to them that you lack commitment to come up with a decent sample of code. I recommend you make an effort, write up some code to do something, anything really and send it to them – Jason Mar 31 '11 at 23:15
They probably want to see how you code. Send them a tiny sample project. Or point them to a online repository of yours if you have. – S.D. Oct 28 '12 at 19:02
up vote 25 down vote accepted

It means send some source code. It is a quite common interview candidacy request.

You should do it. It doesn't have to make much sense to them. They just want to see some basic flow and good coding style.

A long time ago during my job searching, I solved a bunch of old ACM programming contest questions in a variety of languages. I use those for code samples.

Regardless how this job prospect turns out for you, I'd recommend putting together some samples for your next prospect. When we've considered people in the past, I always ask to see some code. I don't even bother compiling or executing it or anything, I am more interested to see structure, commenting, and that it doesn't look like this sort of stuff.

share|improve this answer
I have a lot of code I used to solve Project Euler questions however I don't consider that a bunch of loops would fit in as a good coding and expertise example. – acm Mar 31 '11 at 15:44
@andre matos: so split it into functions, pretty it up a little, and use that. Writing a program to solve a very difficult mathematical challenge can be a great code sample. – whatsisname Mar 31 '11 at 15:45
I was wondering... If the goal is to avoid something like what you show at dailywtf link, shouldn't the javascript be enough? Everyone coding style is surely similar between PHP and JS... – acm Mar 31 '11 at 16:46
For those that ask for this - how can you be sure that what the candidate is sending you was actually written by him/her? Do you ask them to explain it to you or read it for you? We always ask candidates to write a small snippet during the interview and do a mock code review on a piece of code we give them. – Dave Kincaid Mar 31 '11 at 16:47
@Dave, these are usually "rejection" steps. If someone can't give you a decent snippet of code even with help (Google/Friends), he is either not interested in position or not capable. If you have 100s of resumes, steps like these reduce that number a lot. – Shamit Verma Mar 31 '11 at 19:21

While their request isn't abnormal, it is much more productive to have a candidate actually write some code during an interview that solves a problem that the interviewer described. Or, perhaps you'll be asked to review a random snippet of code from their production stuff and provide feedback. Hopefully, you'll be asked both.

You really want to work at a company that asks you this, because it means the people who will be working with you in the future have to pass through the same filter.

Still, why not publish a few useful bits of boilerplate stuff that all of us have laying around on a site like Github? Keep it up to date, refine it (in other words, don't just drop it and forget about it) and send that stuff with your application. Also indicate something like:

I love solving problems on the spot! Please give me something to solve
during the interview.

That's not at all inappropriate, and might help you get around a (lack of) available snippets to send.

share|improve this answer

I am not really sure what they want... maybe a sample program? For web demos you might have to bundle with a server configuration? I'm not sure how I'd do that if I were asked. Even the phrase "a page with code" is not easy to understand... do they want an actual printed letter-format page of PHP? Do they want an executable demo "page" from a website (forget the fact it might not work without the context of the rest of the site). Are they able to further clarify this requirement?

But if they are hiring for a PHP developer and they can't understand that the PHP from a live site will never be visible to them, maybe this is a sign to look for a knowledgable potential employee?

share|improve this answer
That's what I thought first. But there's an intermediary between the employee and me so I'm not sure who's the fault. :-) – acm Mar 31 '11 at 15:42
@andre matos: Oh. If this is a non-technical recruiter who has no idea what's what you really might need to press them for clarification by presenting them with different possible options for WTF "page with code" means... Or try to contact the employee/hiring manager directly if possible. – FrustratedWithFormsDesigner Mar 31 '11 at 15:44
Believe me, I did. By now, I believe the recruiter might think I'm a moron by the way I said that showing PHP code is a WTF. :-) – acm Mar 31 '11 at 15:46
@andre matos: It's not a complete WTF, but they way the asked for it was. You could offer to show them a sample program, something simple that takes a user's form input then prints the string in reverse or something, just to prove that you actually know PHP. But I'm not a fan of such questions because they're easy to fake the answers to if you have the right friends. The real test comes in a face-to-face where you can actually talk about coding! – FrustratedWithFormsDesigner Mar 31 '11 at 15:55
I don't know, it seemed pretty clear to me that they were asking for a page of PHP, where "page" means a printed page worth (50-60 lines) of code. I try not to assume my potential employers are morons, it makes interviews depressing. – TMN Mar 31 '11 at 16:41

I have been asked before to send/email code samples, once I demoed a web site to them. There's nothing wrong with that. You send what they require. If you going for an ASP.NET job, then it'll be code-behind and the aspx page.

share|improve this answer

I believe you are stuck with some process. Talking directly to hiring manager might do the trick.

Or you can write a "page" with generic problems like some aspects of shopping cart and show that you care about code quality aspects like unit tests / comments / error handling etc.

share|improve this answer

While applying for my current job they asked for a couple examples of my PHP programming.

I searched through all the code I had written and found examples of my better work.

I believe you are concerned about the 'rights' to showing a new possible employer code that you done for someone else in the past.

I would not be too concerned over this as long as you don't give any code that could be considered a trade secret.

Take a class that you wrote and remove any specifics about who it was written for and any trade secret sections.

Your prospective employer is (hopefully) not looking to steal code from your previous employers, they just want to ensure that you know something of proper coding technique/organization.

So by providing sections of code that, for all intents and purposes, is useless outside the project for which it was written, you satisfy your prospective employers need to see your output while still maintaining your ethics and not sharing trade secrets.

share|improve this answer

Asking to send code -- I dunno. Using previously written code in interview is IMO fair game. On interview I always have a pen drive in my pocket with my previous work, and happy to show it if there is an interest. (And there is no interest O,O. Droid interviewer sticks to make me reimplement strstr() or strcat() rather than accepting to look my solution for real world problems...)

As interviewer I'd be more than happy with such offer. I would not ask to send code as it is useless without context and explanation. code review works best if done face to face. ;-)

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.