Coding sample as part of a job application?
February 22, 2012 1:22 PM   Subscribe

If I'm applying for a junior developer job in a web company, and they ask for a code sample along with the resume, what sorts of things would make a good sample? How much code is just enough/too little/too much? What would make a sample supergood, or the opposite?

Bonus points if you can provide a reasonable approach for someone without any existing code in a public repository. (I'm working on it, I swear!)
posted by jsturgill to Computers & Internet (8 answers total) 15 users marked this as a favorite
Depends on the job. If its standard web dev, show that you can build a clean todo system, with full database CRUD, decent looking UI. Sprinkle in some jQuery do they know you aren't scared of front-end stuff. I can tell in just a couple pages of code whether I'm feeling or not feeling the programmer.
posted by bprater at 1:26 PM on February 22, 2012 [1 favorite]

bprater has good advice, but I'll give my $.02 as someone who has reviewed this.

The actual data and fields would be irrelevant, so don't sweat that so much.

I'd be much more interested in seeing how the code itself is structured, from the back end code (commenting) to the front-end (JS for completion/validation of forms) to the stylesheets. Web developers today really need to be competent in front end as well as back end. It doesn't have to be overdesigned, but it does need to be clean and consistent.

The biggest thing for me, outside of showing a good conceptual understanding of the language in question, would be to show that you can logically organise and separate presentation and processing as appropriate, and comment when needed, and write in a clean way that multiple people could work on.

Don't try to show off any clever programming tricks, that won't do you any favors as a general rule, it will just show that you will have code that will be difficult for anyone else to work on.
posted by MysticMCJ at 1:35 PM on February 22, 2012 [3 favorites]

Lots of places are happy with github links.

Don't send in anything that they might suspect is proprietary. When I was a hiring manager, we were warned (by possibly over-paranoid lawyers) to stop the hiring process immediately until we could verify that we weren't putting ourselves in legal jeopardy by having someone else's proprietary info in our possession without all manner of prior agreements.
posted by dws at 1:47 PM on February 22, 2012

One tip I've heard for web designers or devs is to take the company's website, or a part of it, and redesign/re-implement it yourself. That way you're taking something they are familiar with as a starting point and possibly showing that you have skills related to what they are doing. It also shows that you are dedicating time to applying to that particular company rather than just spamming your resume around.
posted by burnmp3s at 2:57 PM on February 22, 2012

It has to work. Seriously. I don't mean it does something I need, I mean it's free of syntactic mistakes. You'd be amazed how often they don't.

Personally I'd want to see something that was non-trivial but not so complicated I can't just read it and see that you have a grasp of how to use loops, pick decent variable names, do some basic math and assignments, maybe some text formatting.

I can't speak for this company but anytime I've been involved with hiring juniors we've asked for samples to eliminate the folks who can't write a basic program in any language; a variation on the FizzBuzz idea. Wowing me isn't much of a gain - either way I have to chat with you for a second to determine that you are really the person who wrote this and you understand it.

So with that in mind, make sure that if you hand something over it's not you operating at your top level and doing something so complicated you can't reproduce it. So if you don't normally do bitwise math don't show me something making a clever use of it; when you can't tell me why you did something or how to change it slightly you'd make me wonder if you cribbed it from someone else.

So what bprater describes is a good idea but just be cautious about using technologies you don't understand; if you're not normally a jQuery person then don't use it in anything but the most basic way.
posted by phearlez at 3:30 PM on February 22, 2012

What would make a sample supergood, or the opposite?

What makes for good code is a complicated question, right? There are all sorts of layers and intersections to the question of quality in software.

Fortunately for people who want to know things like whether a programmer is worth interviewing, there are a vast number of superficial telltales for shitty code. If I see sloppy indentation, misspellings in the comments, and unintelligible variable names, then I probably already know what I need to know.

Whatever you're submitting, make it as consistent, readable, and respectful of other hackers' time as you can. Spell things correctly. Make your whitespace look nice. Eschew single-letter names and absurd verbosity alike. Don't leave random, meaningless crap (no-op or commented-out code, out-of-date comments, random blank lines, etc.) scattered throughout the code. Let your reader know that you care and have the wherewithal to get the little things right.
posted by brennen at 8:18 PM on February 22, 2012 [1 favorite]

Every interviewer is different, but I've hired Jr Web Developers before and when I ask for a code sample, I tell them that it doesn't matter what language or context it was created in (it can be from a school project), but it's very important that you wrote it by yourself. FYI, I'm probably going to have you walk me through it and explain what it does.

Really, I'm just looking to get a sense of your coding style, see how much experience you have, and hopefully get an idea for how you approach problems. For me at least, the sample doesn't need to be a full, installable, runable project -- I just want to see at least a few hundred lines. (If you can send me a project where I can get the whole thing running and it does something cool, great, but if it's going to take me more than 10 minutes to set up I probably won't bother anyway). It should also ideally do something moderately interesting or have required a bit of thought. I don't want to read 100 lines of broilerplate Java getters and setters.

Good code is hard to explain succinctly. But I can usually get a pretty good sense of how experienced you are by just looking for minor rookie mistakes: variables that are declared but never used, web code that has obvious security flaws, "cargo cult" code (where sections are copy/pasted from a tutorial or repeated verbatim throughout the file). Note that these are rarely dealbreakers -- for a Jr Developer I'm not looking for someone who does everything perfectly.

Things that are not such a good idea (that people have actually done) include: sending me thousands of files that include every freelance project you've ever done, sending me something that's so small and insignificant that it's impossible to judge, or sending me a group project where your classmates did all the hard work.
posted by meta_eli at 7:55 AM on February 23, 2012 [1 favorite]

A practical suggestion: Since you're applying for a web dev gig, have your sample running somewhere on the web that they can hit, and then link to the actual code on GitHub (or your host of choice). Saves an interviewer the trouble of trying to run something locally, and shows that you can do stuff in the wild.
posted by brennen at 11:22 AM on February 23, 2012

« Older Please tell me this can be done with a few clicks...   |   Five-year-old on third day of vomiting and belly... Newer »
This thread is closed to new comments.