Slashdot Mirror


Where Should I Get My Job Interview Code Samples?

crlove asks: "I'm preparing for an upcoming job interview and my interviewer will want to see some code samples. Unfortunately, all of the coding I've done work-wise since college is not only proprietary, but often classified. To be honest, with long days at work and a busy life outside of it, I haven't had much time to code on my own. So, what should I show my interviewer? Should I start working up some code samples? If so, what would be considered sufficiently complex to take to an interview?"

22 of 249 comments (clear)

  1. A total waste of time by toddbu · · Score: 4, Insightful

    Anytime somebody tries to show me a code sample, the first thing I ask them is where they downloaded it from. Seriously, any employer that asks for a code sample has no clue what they're doing. They should put you at a whiteboard with a pen and have you write something on the fly.

    --
    If you don't want crime to pay, let the government run it.
    1. Re:A total waste of time by suv4x4 · · Score: 2, Insightful

      Seriously, any employer that asks for a code sample has no clue what they're doing. They should put you at a whiteboard with a pen and have you write something on the fly.

      You know, after so much typing, I don't know how to write :(

    2. Re:A total waste of time by zullnero · · Score: 5, Insightful

      You know what works even better than a "lets stare at the poor guy as he tries to scribble some code clear enough for us to understand, then begin to nitpick like a bunch of chest thumping, thirtysomething, 'I'm an experienced coder and should be the manager'" orgy? Checking references. It doesn't take that long to do. If you can't get anyone, you contact the guy and ask them for someone else, and make sure it's either a college professor or the actual manager/supervisor. Doing that, in conjunction with sending the guy a short project and having him do it over the weekend, is as good as anything else.

      Seriously, how much of your project will this potential employee be doing on the whiteboard? NO one codes that way. Once in awhile, you stand in front of someone else and scribble out a flowchart or a diagram to clarify something. That's it. Just because the guy forgot a semicolon somewhere on a whiteboard scrawl doesn't mean he'll take 5 times longer to get something done working within an IDE that has built in context checking, has a help system loaded with code samples, and an internet connection that allows him to go out and find snippets made free to everyone when he's stuck on something.

      In fact, I'd greatly prefer employing someone that resourceful over someone who will sit there and bang their head over some problem for days or weeks. If you have someone who can find code, understand it well enough to incorporate it, and is detail oriented enough to refactor it clean, that's worth a heck of a lot more than some altruistic chump who thinks it's better to rewrite the wheel for everything. Resourceful people get the work done on time.

      There are occasionally situations where a coder has to solve a problem that hasn't been solved before, or where there isn't a solution readily available. However, those situations are really, in this day and age, few and far between...and if a coder can understand and incorporate a snippet of code into a project and make it work, he probably understands enough to write code on his own.

    3. Re:A total waste of time by Anonymous Coward · · Score: 1, Insightful

      "They should put you at a whiteboard with a pen and have you write something on the fly."

      To prove your memorization skills? That is why we have reference books, so we don't have to waste our time memorizing hundreds of interfaces and templates.

    4. Re:A total waste of time by Osty · · Score: 3, Insightful

      Unfortunately, since I've been kinda learning four or five programming languages at once for the last year and a half, syntax is a real pain. In retrospect, I am not sure if any of the companies involved were companies I would like to work for.

      Any good interviewer will be looking more for your ability to understand (ask for clarification if you need it -- oftentimes an interviewer will intentionally make a question vague or leave out an important piece of information to see how you handle adversity) and solve the problem (preferably in an optimal way, but a working solution is better than nothing) rather than your ability to remember semicolons and public/private/protected. As long as your syntax is relatively close, it doesn't matter (a good IDE will fix it all for you anyway). Bonus points for catching edge cases and actually testing your solution on your own (a good interviewer will walk you through that, but if you can beat him to the punch on finding problems in your code then you'll have taken away any negatives you may have had for having bugs in the first place).

      If the company is hiring for a full-time position (as opposed to a contractor), they should be much more interested in your ability to learn and problem solve than your ability to remember your semicolons. Syntax and language-specific constructs can be solved with IDEs and documentation (to a certain extent, of course). Problem solving is much harder to learn than programming languages.

    5. Re:A total waste of time by jrockway · · Score: 2, Insightful

      > This is a test to see how you handle string and array manipulation, not whether or not you happen to know the language or standard library.

      Maybe you're not aware of this, but many languages don't have strings, arrays, or even variables that refer to "memory locations". (Lisp, haskell, etc.)

      Anyway, I doubt any place is hiring you to write stdlib for them; they're hiring you to write applications. There's nothing wrong with knowing how to reverse a string with the good-old while *q-- = *p++ trick, but your daily work is going to be 99% interacting with the libraries that other people have built. Therefore, I suggest that you as a question that's actually relevant, instead of "I'm sooo cool because I remembered an example on the board from a CS class". You're hiring programmers to solve problems, not copy their CS textbooks.

      --
      My other car is first.
    6. Re:A total waste of time by Osty · · Score: 3, Insightful

      Therefore, I suggest that you as a question that's actually relevant, instead of "I'm sooo cool because I remembered an example on the board from a CS class". You're hiring programmers to solve problems, not copy their CS textbooks.

      If your daily job could be boiled down to 15-30 minute bite-size chunks of code that can stand all on their own, I'd happily ask you an interview question around that. Chances are that's not going to be the case. Therefore the point of the question is not so much, "Can you remember your basic CS 101 class?" and more, "I need to keep you up at the white board, thinking through a problem, asking questions, and generally getting a feeling of how you think and work." A "simple" question is best for that because you can fully solve and analyze the problem in 15-30 minutes. If you just bust out a solution based on rote memorization, you're going to be thrown for a loop when I ask you to do it in a different way, or to analyze why your solution does what you think it does, or what performance characteristics you'd expect to see from your solution, etc.

      Don't get hung up on the actual question. That's just a vehicle to analyze more important stuff. On the other hand, if you can't solve the problem, that's a whole different issue. It might be the question was too hard, inappropriate for the position, or required an "a ha!" type of solution that you wouldn't get unless you'd seen the question before. That definitely happens, but you get a pretty good question calibration when you use it across many different candidates. That means that unless you're testing out a brand new interview question, the more likely issue is with the candidate instead. Now it's up to you as an interviewer to see if you can figure out where the problem lies and determine if it's a superficial you can work with (candidate is just very nervous and wouldn't necessarily be that bad in a normal situation) or a deeper problem that means the candidate is not a good fit for your team. If you can't do that, you've failed as an interviewer just as much as the candidate failed as an interviewee.

      As for your point about functional languages, that'd make sense if I were hiring you for a position where you'd work with a functional language. If you're interviewing for a 100% .NET or Java shop, busting out Haskell or Lisp in your interview (beyond mentioning them on your resume) is likely to do more harm than good. You'll get "cool points" for knowing a functional language, but if you can't hack C/C++, Java, C#, Javascript or whatever I happen to be looking for, those cool points aren't going to do you much good. Yes, I know, you probably can learn the language. However if you haven't learned at least one of those languages by now, I have to question what you've been doing. Even coming out of university you should know one of Java, C, or C++ enough to answer a basic question. If you're coming from an industry position with only functional programming under your belt, that's a serious red flag.

    7. Re:A total waste of time by quantaman · · Score: 4, Insightful

      Anytime somebody tries to show me a code sample, the first thing I ask them is where they downloaded it from. Seriously, any employer that asks for a code sample has no clue what they're doing. They should put you at a whiteboard with a pen and have you write something on the fly. A whiteboard is a lot different than a computer and all its associated resources. I've seen great coders freeze up when asked to code on a whiteboard and useless people come up with something great, especially when how clever they can be when writing an algorithm isn't what I'm interested in.

      Programs are large and very complicated systems, in my opinion a great programmer isn't someone who can write the fastest sort, it's the person with the skill and determination to quickly understand, and extend, large complicated programs.

      Thus when interviewing I like to have someone bring in a bit of their code. I then ask them to give an overview of what it does and how it works. I then ask them about how they would go about making a certain change in the requirements. What I'm looking for is how thoroughly they understand the design of the code and how well they can communicate that code to someone else. Even if they did download it they still have to really understand it and that's the hard part.
      --
      I stole this Sig
    8. Re:A total waste of time by Anonymous Coward · · Score: 5, Insightful

      That's a horrible idea. What the hell are they supposed to write? "Write down a linked list object, you have 30 seconds on the clock!"

      Haw! I just had a job interview yesterday and that's exactly what they asked me to do on the white board! Then they left me with my laptop and a coding assignment. In the past I had fantasized about doing that to people whom I had had to interview, so I didn't mind. After all, they want to make sure you can code.

      But, I've gotta say, I think this approach favors 1) people who've recently had programming classes where they cover general algorithms and data structures, 2) programmers who tend to think at an abstract level, whereas what I've found to be a more typically useful skill is the ability to translate business requirements (ie, what the customer wants) into code.

    9. Re:A total waste of time by CastrTroy · · Score: 2, Insightful

      Do people actually remember how an insert on a B-Tree works 10 years after they've taken a class, and never had to write their own B-Tree implementation, because it's a solved problem? I'd ask them to do something a little more creative. Rather than just being able to spew out facts, that anybody could figure out with a 5 minute look in a computer science textbook, ask them how to they would design something. Ask them anything except something that can be memorized. Present a problem, and then ask what data structures they would use, and justify their answer with an explanation.

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
  2. Re:Do they have to be YOUR code samples? by andy753421 · · Score: 2, Insightful

    *cough* you could always spend some time improving support for the linux bcm43xx drivers... ;)

  3. Why is asking for code samples a bad sign? by BadAnalogyGuy · · Score: 5, Insightful

    Everyone seems to be in agreement except for a straggler a few posts down from here. Companies that ask for code samples are bozos and you don't want to work for them. But why?

    The answer has to do with corporate culture. Companies are made up of human beings and each one has different goals and needs and personalities. Some people get along famously while others will tear each other apart if left alone in the same room. Some people are very friendly and easy-going, others are hard-edged and driven. The type of people you hire will determine the culture of your company.

    Do people have fun at your company? Are they tired all the time? Do you have high rates of turnover? Do people think they work for the greatest company in the world? The worst? Do people dread meeting with other employees? Do people have a great time pounding out ideas together? Do people focus solely on their job position? Do people look at the company as a whole and see their role as a part of the greater whole? All these things are determined by the type of people you employ.

    The type of people you employ is determined by your interview process. If you make the interview process a relaxed one where the interviewee has the chance to articulate his thoughts well, you'll get one kind of employee. If you make the interview process a difficult, high pressure affair, you'll get another kind of employee. If you ask them to submit code samples, you'll get people who are either incredibly anal or look for shortcuts. If you ask them to code on a white board, you'll get people who can think on their feet.

    No one type of company works best for all situations. You wouldn't want cowboy coders in the bank software business. OTOH, you wouldn't want incredibly anal people working on next-generation UI stuff. But the type of people you hire is not only indicative of the culture of your company, it is a clue as to the personalities of the people working there.

    Another problem with the code sample thing is that it shows that the company values code quality over quality of character. My cousin BasementDweller78 is a wiz at coding. He can drop his pants and shit better code than I ever could. But he's a complete asshole. He isn't pleasant to be around. He's your prototypical computer geek. He's also the one that will get hired at a company that values code over people.

    So when some company asks for a code sample we all react with our gut and run far away. It's because we don't want to be around the type of people who would judge us on inanimate code. We'd rather be judged as humans and don't fear whiteboards nor do we lack confidence in our programming abilities. We are just a certain subset of all programmers. Those who value a pleasant working environment. Pleasant for us, that is.

  4. i prefer.. by poisonfruitloops · · Score: 2, Insightful

    i had a few interviews fresh out of uni. One place gave the final 3 applicants a puzzle to take home and solve based on a real-world situation, though no "code" was involved, we were asked to provide simple pseudo-code.

    I thought that was odd as we could all go to external sources or each other.

    The next place asked me in the interview "What can you tell me about this code? Problems, inefficiencies.. anything?". I thought that was a much better idea. Plus who wants to write code up on a white board when all nervous in an interview anyway right?

  5. Re:Be honest! by TrisexualPuppy · · Score: 2, Insightful
    FYI, most people call them the late 80's.
    Actually, no. $87500 is not "the late 80's."
  6. Re:Be honest! by Anonymous Coward · · Score: 1, Insightful

    FYI, he meant upper $80Ks, numbnuts. FYI, I'm pretty damned sure he knew what the guy meant. It was a joke. And a little bit of a slam, because the "please envy me" note in puppy's voice was a little too apparent.

    Of course, not getting the joke, Mr. $87,500 finds another opportunity to casually put it out there, in more detail, to make sure everyone gets it. He was forced! He didn't want to have to name his salary! He knows it's not classy!

    And now perhaps the upper-middle-class slashdot chicks will come flocking.

    Hey, you never know.
  7. Re:If they want to ask for a code sample... by Cederic · · Score: 2, Insightful


    working 60 hour weeks writing code and everything else that comes up on a software project, you think that when i left that job I had personal code projects at home I'd been writing on?

    no, at home I was playing computer games, getting out and socialising, shooting field archery and playing snooker.

    it isn't that i wasn't interested in code outside of 9-5, it was that the job wasn't 9-5 and i (along with a lot of other people) have more than one interest in life.

    Incidentally, one company I interviewed with did send a programming problem through with a "please send a programmed solution through within three days". I wrote it up and sent it in after two evenings and they liked my solution.

    Do that if you want code examples, don't expect everybody to be writing code in their spare time, and definitely don't expect commercially sensitive code to be brought along to interview.

  8. mod me down for obvious... by marktoml · · Score: 3, Insightful

    However this is a good reason to have considered (at least considered!) doing a bit of work for an open source project. There are lots of them on SourceForge (and many other fine places) begging for help. A few bits added in make nice examples you can point to when asked for code samples. I know, it seems like a huge time investment that you don't have, but it really doesn't have to be. Further, every little bit helps the project guys.

  9. you're wasting your time .... by nblender · · Score: 3, Insightful

    In the time that it's going to take for you to read all of these responses, you could have sat down and written some code that will impress them. They're not looking for your magnum opus... They want to see stuff that shows you can understand a problem and translate your understanding into compilable syntax. In fact, they probably don't even care about compilable syntax. Think of a cute hack and write it instead of reading slashdot. Take it in and say "I can't show you any of the code I've written professionally, so I wrote this last night. You can confirm with google that I didn't download it from anywhere if you like, or you can ask me any questions about it and I'll be happy to answer them." Don't pick something related to the companies' core business. They understand their problems _way_better_ than you do. Second, decide whether you want to work for a company that quantifies you based on your code output. I'm a coder and I only spend about 10% of my work time actually writing production code. The rest is hacking test cases, prototyping, designing, staring at graphs, and attending team meetings.

  10. Re:Be honest! by Ihlosi · · Score: 5, Insightful
    How is the interviewer to know that it is yours?



    Ask questions about it. They usually show very quickly if you understand the code. Then there are four possibilities:



    1. The code isn't yours and you don't understand it. Bad. You're out.

    2. The code is yours and you don't understand it. Also bad. Also out.

    3. The code is yours and you understand it. Good.

    4. The code isn't yours, and you understand it. Outstanding.

  11. Re:This is a trick question by crlove · · Score: 2, Insightful

    Except they specifically told me not to bring anything proprietary.

  12. That can backfire by geekoid · · Score: 2, Insightful

    I ahad someone do this to me once, I took a look at it and knew immediatly what it did so I told them straight off.
    They were unhappy that I didn't 'Walk the process'.
    I told them its 8 lines of code, 4 of them that just defining variables. If someone needs to sit down and think about it for more then 2 seconds then they are not principle material.

    Needles to say they didn't call me back; Which was fine since by that time I could see they weren't exactly the sharpest knife in the box.

    FUnny thing is, I had worked with the guy they hired before, and the y certianly got what they deserve.

    --
    The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
    1. Re:That can backfire by djh101010 · · Score: 2, Insightful

      I ahad someone do this to me once, I took a look at it and knew immediatly what it did so I told them straight off. They were unhappy that I didn't 'Walk the process'.

      Well, seems to me, that didn't backfire at all. You learned something about the people interviewing you. Remember, an interview is just as much "Do I want to work here", as "Do I want to hire you". The interviewer gets to set the agenda, but if you don't go into it with a "are they good enough to employ me" point of view, you're doing it wrong. It's one thing if you're broke, unemployed, and hungry of course, but even still, the interview process is your chance as a professional, to decide who you want to work for.