views:

1236

answers:

13

I often see job posting with a request for "resume, cover letter, and code samples" and this baffles me.

If I am applying for job with little, or no prior knowledge of what types of projects I'm going to be working on, how am I to provide code samples? And even if I have an idea of the type of project, what are they REALLY looking for in my code?

Can you help me out, StackOverflow?

+10  A: 

Code samples.

They are looking for how readable your code is and how well you document. Why hire someone who is going to cost them more in the long run writing spaghetti code? In addition, it shows that you are motivated by coding, and not the salary that comes with it. Intrinsic motivation is a great thing to find.

geowa4
maybe also money and chocolates.
Simeon Pilgrim
Robert, they are looking for people that are *motivated* for free, and work for money, rather than people that are motivated by money and work for nothing.
Peter Boughton
+1 on the comment @Peter; exactly my point.
geowa4
...the rest of us become PMs
jim
+5  A: 

They're expecting you to have shown enough extra-curricular interest in software development that you've been involved with Open Source projects, or written your own free software.

They want to see the code you've produced for yourself, for fun, to exercise your skills.

Be careful - I do developer recruitment, and I've rejected people because they have published terrible code online.

RichieHindle
It doesn't have to be open source projects, but it does need to show you have an interest in programming other than just bringing home a paycheck.
280Z28
@Robert: no, to determine if they will love their job. a bad apple makes the whole bunch rotten. if you don't want to be there for any other reason than to make money, you are that apple.
geowa4
+3  A: 

Some error handling. Comments that explain what's going on without explaining what is obvious from the code. Well named variables + method names that clearly identify what they're purpose is.

Scott Langham
+16  A: 

Code samples shouldn't be required. If they are, that's a -1 for the company, but since no company is perfect, this will not typically be a deciding factor.

All the code I've written is proprietary, and yet I've written good code. Also, most of it has been contributed in part by other people, too, so the "genius" you would read would not only be mine. (Which by the way, you never can tell, when you get code samples from other candidates.) I can't provide samples, and I'm not going to do it: it would be crazy for me to publish company owned code for you to read it. You'll have to trust me.

IF you the company can't understand that some code is not my property, and still require it, then it's an unfortunate situation, because you won't have me as one of the candidates - and I don't know if I'm the best one, but I'm sure I'm a good one.

And no I don't code for a hobby, because 40 hours a week is enough for me.

PS - You can also ask them for clarification if you really want to know what they want. Companies are not all the same.

Daniel Daranas
+1 : There are legality issues in giving code samples that shouldn't be forgotten.
Andrew
well yeah, don't hand over something that's not yours. what you are paid to do is probably not yours.
geowa4
Thanks for your comments. It's _certainly_ not mine, it's the company's property. But it's the only code I write.
Daniel Daranas
then tell them you work so hard at your current job that you don't have time when you go home. btw, i hope your boss isn't reading this...
geowa4
+1 "And no I don't code for a hobby, because 40 hours a week is enough for me." Which is more important, learning new cool nerdy stuff or LIVING, as in spending time with your wife, kids and friends.
Maltrap
@George IV: Actually, I'm not seeking a new job now; I'm writing from my experience in the past. By the way, I was speculating, because nobody has ever asked me for code samples.
Daniel Daranas
I love this answer, I have no desire to code after I get home. If I'm in the middle of a big project, I go home, relax and think about the code I'm going to write tomorrow.
jim
@jim That is also my spirit. Refresh your mind running outside, going for a walk, watching a movie or listening to Bill Callahan, and get to the office fresh the next day to continue coding. I would only consider personal side projects if I worked, say, 30 hours a week instead of 40.
Daniel Daranas
+2  A: 

They want to know if you can code. A person can have really good credentials and not know how to code. However, I've never been asked for open-source stuff that I've written. That seems like a pretty odd requirement.

If you're not asked for code samples, you should be asked to write code to solve a simple problem while you're at the interview. You would be surprised how many people who claim to be programmers cannot do this.

If a shop is very code-centric (i.e. they want Java, not C#) then I guess code samples might make sense. But what you do on your own time is your own business, and if you've worked for closed-source shops all your life (as I have), you don't have a portfolio of code to show. Generally speaking, I like to make money when I code, and I don't think there's anything wrong with that.

As a hiring manager it's more important to me that a person can code than if he has code already written that he can show.

Robert Harvey
+21  A: 
Adam Liss
+1 This could be a blog entry - it stands alone very well.
Tom Leys
+3  A: 

What I don't get is, if you do give them a code sample, how could they even tell whether it was you who wrote it? How would they know whether you spent stupid amounts of time on it? And how would they know whether it was peer-reviewed and corrected (which I'd guess it should be, if you're submitting it as a portfolio sample)?

It seems to me that they'll be looking in the code sample for the same thing that they'll look for in your resume and cover letter: i.e., they'll be looking for any sufficient excuse to put your application in the 'discard' pile, and skip the time required to interview you. And/or they may be looking for some code which they can discuss with you when they do interview you. They may also be looking for compliance (i.e. for candidates who are willing to jump through hoops).

ChrisW
That's a very valid point, which also applies to another comment about take-home tests: given the luxury of time, and the resources of friends, Google, books, etc., anyone who's seriously interested in the position will provide a reasonable sample. Anything less, and an interview would waste both my time and theirs.
Adam Liss
One would hope that one of the things they would do at interview is discuss the code and the decisions and tradeoffs you made writing it. If you did't write it then that will probably become quite obvious.
Ade Miller
I think the second paragraph is dead on. This is a way to weed out applicants who aren't worth interviewing.
Keith Smith
+2  A: 

I think communication is the key. If you are not sure why they require it then it wouldn't hurt to ask. Asking for clarification is part of our job anyway!

If the company doesn't response to your question then either a> they are the wrong company for you anyway. b> you might want to try to approach them from another angle.

Personally, If they want to see any code I would rather do it at the interview.

firefly
+1  A: 
I often see job posting with a request for "resume, cover letter, and code samples"...

This job posting is probably written by a clueless HR person ;-)

[The "cover letter" is also a clueless-HR giveaway.]

Steven A. Lowe
Why is a cover letter evidence of cluelessness? Our programmers have to be able to communicate well, both internally and with clients. Resumes are an exercise in lying anyway. Acronym city!
ScottE
@[ScottE]: in general, cover letters are not read by technical people, they're more interested in your experience ;-)
Steven A. Lowe
+2  A: 

My former company once hired someone we shouldn't have. We knew that, seeing his code sample. We knew from the code that he would need mentoring -- from his choice of variable names, from the incomplete coverage of edge cases, and from the inadequate error handling. We brought him on as a junior programmer anyway, since we needed people.

We shouldn't have. He consumed more of our time than he contributed in value.

Code samples are nice. Many people don't have a lot of code they can freely show off; as others have said, if it belongs to their (former) employer, they can't share it. But small test cases or puzzles can tell you a lot. I used this XKCD comic a couple of times, both to look at coding style, and to see how people dealt with loosely specified requirements...

khedron
I'm a big fan of a puzzle or two during an interview, when I'm on either side of the desk. It sheds light on the person's reasoning, communication skills, ability to think creatively under pressure, attitude, and sense of humor.
Adam Liss
A: 

The only job I ever applied for that wanted a code sample was around 1980. I printed up a PL/I program I was rather proud of. The guy who interviewed me just wanted to see how thick the stack was. He never read a line. Perhaps the moral of the story is to be wary of potential employers seeking code samples?

Norman Ramsey
A: 

Proof that you know how to use a printer... unless they are going to grill you on it, I see no point.

Captain Insano
A: 

It's kind of a ridiculous request, so I'd probably just send along my resume and what not with no code samples. And then, if they asked me where my code samples were, I'd probably withdraw from consideration.

bpapa