views:

921

answers:

15

My understanding is that asking for a work sample is a good way to determine if someone has the skillset you are looking for, as some people just interview well. So I want to ask potential developers to write some sample code for me.

I'm looking for ideas on what kind of small project would be something they could do in an hour or two, and would show that they have a good grasp of OOP, good coding practices, etc. And what to look for once they finish - how to evaluate it fairly and usefully.

For context, I'm a small business owner, interviewing prospective developers, for PHP development on internal projects. I can code PHP but am not an expert (some of the work is refactoring code I've written to be better structured and consistent), and so I'm also looking for what to look for when evaluating the samples, given that I'm not a trained or super experienced programmer.

Especially for people who have done hiring of this type before and used this method.

I was also thinking I could give them some code to refactor, and see how they do on it. Has anyone ever given a refactoring test as part of the hiring process?

Clarification: I'm not talking about coding during an interview. I'm talking about coding instead of an interview. For context the inspiration for this question came from this article in FastCompany about how work samples are better predictors of job success than interviews:

Why It May Be Wiser To Hire People Without Meeting Them http://www.fastcompany.com/magazine/136/made-to-stick-hold-the-interview.html

+6  A: 

If you are not an expert then I would suggest you be careful about trying to evaluate other developers. You should probably figure out a better way to assess the dev skills of someone else if you are not that comfortable with your own level.

I am not sure there is a good solution for you.

I'd make the coding samples very straightforward and not have it take an hour or two. Simple coding exercises that take a few minutes should be sufficient - combined with other discussions about best practices, frameworks, design questions, etc.

Tim
+16  A: 

I would create a not necessarily good application and embed some bugs. I would come up with some simple functionality to be added to the program.

Does the applicant find some bugs?

How does the applicant's code integrate into the existing code?

Does the applicant get stuck on something that doesn't really matter?

Does the applicant adapt to the coding standard of the existing code?

After this exercise, discuss the code with the applicant. This may be more valuable than the actual code.

NOTE: with regards to @bpapa answer I would make sure that problem is novel and obviously not to be used in production.

jrcs3
+1 for the third question you listed.
karim79
It depends if you're hiring him/her for an entirely new project or if the applicant will have to deal with legacy code. If that's the case, by all means, try his bug-fixing skills.
altermativ
True @altermativ, the interview process should reflect the job you hiring for.
jrcs3
+14  A: 

Personally I would refuse to do this when asked. An interview is one thing, and doing programming questions on paper to asses technical knowledge is fine, but actually writing some kind of application for somebody is billable and I wouldn't do it for free. Even if it only is supposed to take an hour.

I think you should focus more on what the person has done in the past, and ask technical questions that you know the answers to (since you said you have limited PHP knowledge and want a PHP developer).

bpapa
i wouldn't think you'd ask anyone to make something particularily useful. This is a very useful way to make sure people actually know what they say they know.
Victor
If it's a career move you're pursuing, then that's not a great plan. Some employers might view that as a lack of enthusiasm, even arrogance (especially applicable if it's an entry level / junior position). It's especially helpful to root out the ones who don't sweat the small stuff and can handle spontaneous pressure.
karim79
@karim79, if it is a contrived sample piece of code specifically written for the purpose of the interview then I wouldn't have issues refactoring it. However, if it is production code then it seems like it falls into a different catagory. This happens to artists a lot when potential employers ask for "Sample Artwork" for a new Company Logo or something similar and they end up using the interview items while not hiring/paying the individual.
Simucal
@Simucal - that's exactly what I was talking about - a pre-set mini-test just to make sure the candidate isn't there for fun and games. Asking him/her to refactor production code is *exactly* as you say it is - I can't disagree on that, along the same lines as asking a candidate for a marketing position to produce a marketing plan (which I've seen happen).
karim79
It's an interview and it should be an obviously contrived task, kept to something which can be solved in 30 min.If they interviewer is asking for anything more, it's time to walk out and not look back because chances are you don't want to be working there.Junior position or otherwise.And looking back, I'm certain I solved at least one problem during an interview which I'm still a tad miffed about.
hythlodayr
+1  A: 

Give them an address or such as a plain text file and ask them to create a simple script to turn it into XML. I used that once and it worked wonders.

If you want to test them on the spot, ask them to reverse a string. From an organisational standpoint, perseverance, determination and enthusiasm are just as important as being technically adept, IMHO.

karim79
Reversing a string would be a great question for a C/C++/Java applicant, but in PHP you either know that strrev() exists or you don't. :)
Bob Somers
Good point Bob - I don't want to test simple knowledge, but how they approach things. The XML problem sounds promising though. Thanks karim79
and thanks for actually answering the question. =)
There are common library functions for string reversal in C/C++ and Java too, Bob - if the candidate knew of the library function, then given them extra credit, but ask them to show you how to do it without recourse to the library function.
Dexter
@Bob Somers - I don't think it's that straightforward. I wouldn't expect a developer to know strrev() if he had never used it. If he solved the problem either ways (using strrev() or the 'long' way) it would show that he's capable of getting stuff done. As a bonus you would get to tell him about strrev() after watching him code it the hard way :)
karim79
+1  A: 

Having a small, well defined task can help you take examine people on a level playing field with a relatively small investment of time on their part. You don't need something complicated to see what people can do.

In the past, I've asked people to write a small web application that exercises a few fundamental concepts. We keep the particulars of what the application is supposed to do really simple.

I would also try to avoid tasks that require a lot of supplemental knowledge (viz, don't ask them to solve a problem from your particular problem domain).

Edit:

Regarding "small, well defined tasks": What I try to shoot for is something that includes a very thorough description of some simple business logic as part of a larger programming task. For example, one of the programming assignments I've given in the past involves setting up a simple Java web application and implementing a few features. We made sure to describe thoroughly how the features were supposed to work to remove ambiguity. This was for a couple reasons:

  1. The point is really to see if the candidate can build a simple application from scratch, not to see whether they can guess correctly about what we want.
  2. If you define the task really well, you get to see more about how thorough someone is with the type of work that they're likely to be doing in a business situation.
  3. We wanted something flexible enough to give to candidates at varying levels of experience.

I should note here that I think programming assignments are most effectively used to check for competency. If you give a really hard assignment, or one that isn't well-defined, odds are that you're not going to get results that tell you what you want to know (unless you're testing specifically for how the candidate handles difficult assignments or ambiguity).

Paul Morie
Yes - can you give some examples of what you consider a "small, well-defined task"?
See my edits above.
Paul Morie
+2  A: 

I think the best thing you can do is try to have a real expert sit in on the interview with you. Hire a third party if you need to. I'm not sure it's possible to be able to give a quality assessment of someone who is a more experienced developer than yourself.

The other thing to consider is that really good developers may pick up on the fact that they are more experienced than yourself, and if you indicate that you are one of the developers it may actually put them off (not trying to be offensive, I just mean in the context of you implying that you are not very experienced.)

Wayne Koorts
A: 

I argree with bpapa about it being an interview instead of a test run, maybe instead consider asking some questions about how they would undergo certain talks to do with the programming...

d1k_is
A: 

I once had to sit a Visual Basic MCP exam at the end of which they didn't even bother to give me the result.

Happily though when I asked the question as to whether I would be given the result I was sitting at the Commit/Cancel screen.

So I hit cancel thanked them for wasting my time and walked out.

griegs
A: 

To answer the question:

For PHP, I think a shopping cart, address book and forum would be good projects. Those usually cover a wide spectrum of web-programming topics - sessions, registration, database, form processing and authentication.

Personally speaking: It looks like you looking more of an architecture person than a coding guru. I wouldn't penalize the applicant because he cannot come up with the name of an obscure function or need to refer elsewhere. The key thing is that he has the initiative and know where to look (heaven knows how many times I need to look up PHP.NET). A good question for an architecture guy, IMHO, is to tell him you have a data-set, but you have three different ways of displaying them and each view has different operations. If his answer is just a gigantic SWITCH-CASE, then he may be the wrong choice.

Extrakun
you want them to code a shopping cart, in two hours, from scratch, on a whiteboard? Can people even do that?
Dan.StackOverflow
Well, he could try to describe his strategies, sql data structure and so on. I once had an interview where the interviewer sat next to me and wanted me to modify the code on the fly. The topic was to add paging to a list of data...
Extrakun
This is also a problem that many people have thought about ahead of time. I would want to force them to do origional thinking on the spot and see how their minds work.
jrcs3
Extrakun,I'm wondering if you would clarify what you mean by an architecture person vs a coding guru?Knowing the name of an obscure function is exactly NOT what I'm looking for. I would love to make resourcefulness part of the task.Given your data-set example, I'm wondering if you could describe briefly what a good answer would be?
Extrakun
To acorn: A coding guru is basically someone who knows the language extremely well and well, know obscure functions, at least in my definition. An architecture person is someone who usually use OOP/structural principles for his code, making sure his code is easy to maintain, to read and to debug. Not mutually exclusive, but I have come across good coders whose code are really ugly to read, hard to update, not modular and if you just change one part, the other would all fail to work.
Extrakun
+1  A: 

I've never been a part of the hiring process... but in interviews I've done, I was asked once to implement a doubly linked list, and another to work out an algorithm, the classic, how many integer points within a given shape, in this case three points forming a triangle, once in O(n^2) and then again in O(n).

I don't think the way to do it is to make them program something, but to make sure they know how to figure it out. You give them a problem or ask them a question, and tell them to think out loud, and observe their thought process. This doesn't exactly show if they have clean code, but depending on the problem it gives you insight as to wether or not they know what their talking about.

Victor
+7  A: 

I would heed Joel's advice that giving homework assignments for interviews just weeds out the best programmers (paraphrased from his book). The better programmers have a lot of options and so won't want to go through the exercise of a programming assignment. They just won't apply. That will leave you with the mid-competency people. Unfortunately, in my experience those are the ones most likely to try to look better than they are and if you aren't an expert yourself, the ones most likely to mislead you.

Here's an alternate option. Have them point you at some work they have already done. Not necessarily the code, but the site. During the interview, ask them questions about how they coded it. What data structures did they use? How were the classes or functions organized? What problems did they have to overcome?

Then as traditional programming questions in the interview that they could answer for you ont he spot. This way you can gauge their understanding and their syntax. The two don't have to be the same question.

Steve Rowe
I respect Joel a lot, but he's hiring at an entirely different level than I'm talking about. I'm not going to attract "the best" anyway, and frankly I would rather have a competent coder with a good attitude who is responsible and gets things done than a brilliant coder with a sense of entitlement. I do like the idea of asking them questions about how they coded something they coded and why, to show their thinking, thanks for suggesting this.
I agree. I would turn down any job that required me to write code in the interview. I take it as somewhat of a slap in the face. The employer is just saying I don't believe you can do anything you say.. Ask me all the questions you want, explain how I would write something, but not actually code it.
corymathews
Spoken like a decent developer who doesn't lie. We get dozens of resumes from people who "embellish" (read: lie) and we can't trust everything they say. It's not a slap in the face, and in my experience it doesn't weed out good developers - they rise to the challenge (our programming problems are more algorithmic exercises that many programmers find fun, it's not a "build an address book" type thing). I've found far better devs with assignments than without. If that means I don't get the "best", I'm more than happy with the ultra calibre talent I do get.
cynicalman
+1  A: 

Well, everyone seems to be discouraging the coding effort for an interveiw. I'll disagree with the disagreers. To answer your question--if you want an example of what to have them code--drop a simple calculator on the table in front of them and ask them to write a program to create the calculator virtually. Give them half and hour and see how far they get. Some may finish in that time.

+3  A: 

I like the problems at streamtech. They are pretty easy and can often be done in rather short time, but they show that the applicant is capable of structured thinking and translating this to structured code.

As for evaluation---I would use this as an opportunity to learn. Do the problem yourself first, then compare to the applicant's code. Look up any constructs that you don't know, then ask yourself which version is more obviously correct.

Svante
Excellent, thanks for that link. And great strategy re: doing it myself and comparing the output. By "obviously correct" are you getting at the readability of the code, or something else?
+2  A: 

Have you ever tried pair programming before? Two people sit down at one machine, they share keyboard and mouse, and talk about what they're doing as they go. I think this is absolutely the best approach, because it will, eventually (after everyone's panic subsides), really indicate how well you two work together.

If you're not a great programmer, this person should be able to teach you and put you at ease. If they're not that good, but you work together well, that might be more desirable than a brilliant but unpleasant person.

At the end of the session, just delete your work. No big deal.

jared
I appreciate the idea. I have pair programmed before. The people I'm looking at are not in my same geographical location necessarily, and I'm not wanting a teacher so much as someone I can rely on to produce good code on their own. I agree on the undesirability of the "brilliant but unpleasant" person. =)
I see what you're getting at. As far as the geographical gap, I know there are distributed teams that do pairing. Eclipse, vim, and doubtless other IDEs offer ways to share focus; you can handle the other parts of the interaction via skype or even over the phone.Regardless of whether you're actually planning to pair with this person for production work, I think it's a good interviewing technique because the person's actual problem-solving and coding skills are on display. To me, this is better than "find N bugs in this sample program."
jared
A: 

hi there,

Usually weak programmers does not understand recursion pretty well, that's from my observations as far as now, now this does not have anything to do with PHP directly and probably a recursive factorial or fibonacci series wouldn't be a big deal, but let's say to load a tree control with data from a database with some parent-child relationship might be a good sample.

Also as you're not an expert as you said, think off something you can handle confidently.

Tiberiu Hajas