views:

910

answers:

8

I'm currently breaking into the job market and see lots of applications that request code samples. I have lots of code to show, but what would be the best:

  • Code length, I have anything from huge to tiny.
  • What specifically do I want to show with my code? Lots of comments? Self commenting? What do they look for?
  • Would something like a fizzbuzz be worth writing up?

Anything else worth showing?

+1  A: 

I would try to show an example of something that solves a fairly generic type of problem, or at least, one that is not specific to a particular industry or field. Document the code and clean it up as if you were going to publish it.

I haven't been asked for code samples, but that's how I would put something like this together.

Derek B. Bell
+5  A: 

pick something you are proud of and something you can explain in an intelligent manner

LOL the troll gets an answer accepted!
+2  A: 

Start a Programming Blog. Update it frequently. Point them to the blog.

CodingWithoutComments
/me visits codingwithcomments.com
A: 

As an aside, for reasons of copyright, privacy, security and self-protection I've also globally replaced anything displaying the company name and/or personal information. That would include anything like company names in packages (in java, com.mycompany.... is common in package names) to hardcoded urls, passwords (which of course you don't have, right?).

Steve B.
+1  A: 

Something small, elegant and self-contained would be the way to go. The average time spent evaluating a resume is ten seconds. I don't imagine that interviewers are going to spend more that a few minutes looking through the code. Make it easy for them to see that you are a competent programmer who knows how to follow the standards of your chosen language.

Eric Ness
+1  A: 

When I perform technical interviews, I generally give the candidates two pages of aweful sample code. It starts with simple issues and goes on to more advanced and subtle issues (basically to give the candidate a chance to de-stress and relax as we progress). The idea is that I can tell how skilled they are by how far they go before they can no longer find issues, sometimes even with probing.

At first the issues are simple, like naming conventions, basic idioms. But by the end of the last page the candidates are facing exception handling, lose database connections, memory leaks, etc. Advance but subtle issues. And they aren't the type that you have to look forever to find, more of the type if you've been programming for any length of time they should jump out at you. An example is a database connection that's never closed (And you can assume a hint has been given). In any case, it's not like they have to dig through hundreds of lines of code, it's only about 50-75 lines.

So what I would suggest is something along these lines. A simple 1-3 page code sample that shows the harder constructs of your language. For example, if it's in Java, show that you understand OO, exception handling, etc. And instead of focusing on the comments, I would make sure your naming conventions are good. I would instead comment on why you did this or that in terms of what design/construct decisions you took.

Stephane Grenier
A: 

Show something which demonstrates a good solution to a problem, rather than technical knowledge of a language

Xetius
A: 

Make absolutely sure you have the right to use code in your portfolio. You don't want to give any impression in an interview that you're willing to violate any sort of confidentiality or copyright.

David Thornley