Where Should I Get My Job Interview Code Samples? 249
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?"
Easy solution (Score:5, Funny)
A total waste of time (Score:5, Insightful)
Re:A total waste of time (Score:5, Funny)
But since they asked, you might as well think big. [kernel.org]
Be honest! (Score:5, Informative)
But the TSP has a solution. Tell him that you will code for him if he can give you a terse, yet challenging assignment. This will let him see what he wants to see (i.e., what he wants to test you on), and you're willing to take out a bit of your time just to show him that you're a hard worker. This strategy worked for me and landed me a job in the upper 80's!
Re:Be honest! (Score:5, Funny)
Re: (Score:2, Insightful)
Re:Be honest! (Score:5, Funny)
Re: (Score:2, Funny)
Re: (Score:2)
Mental note: check if anyone else has used a bad joke before using a bad joke.
*sigh*
Re: (Score:2, Interesting)
$40K
$60K
$90K
$120K
$150K
Those are all figures of programmers at various levels I know personally. Yes, the $40K guy is a novice and getting screwed to boot. The remainder are an excercise for the questing reader. What kills me is that most of my friends and I consistently hit far above the highest posted salary averages, and we know we're not exactly the highest paid folk in the companies we work for. Considering the breadth of
Re: (Score:2)
But what has it done for you in the last 20 years?
*hopes someone gets it*
Re: (Score:2)
Re:Be honest! (Score:5, Insightful)
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.
Re:Be honest! (Score:5, Funny)
Re:Be honest! (Score:4, Interesting)
That's the approach I take. "Here, what does this script do? Go into as much detail as you'd like." It's not so much what they say, but how they approach the problem that I'm interested in.
That can backfire (Score:3, Insightful)
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 work
Re: (Score:3, Insightful)
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
Re: (Score:2)
(Of course, this isn't always the case -- a few rubes always slip by -- but it's true more
Re:A total waste of time (Score:4, Informative)
Re: (Score:2, Interesting)
Re: (Score:2)
Game over, man, game over!
Re:A total waste of time (Score:4, Funny)
For eln's delecate sensibilities about perl... (Score:3, Funny)
echo "this is a sentence" | awk '{ cnt = NF; while ( cnt > 0 ) { printf( "%s ", $cnt ); --cnt; } printf("\n"); }'
Happier?
-- Terry
Re: (Score:3, Funny)
Oh, that's alright, you can do that in Java, too:
Runtime.getRuntime( ).exec( "perl -e \"print join ' ', reverse split /[ \.]/, $ARGV[ 0 ];\"", new String[ ] { "this is a sentence" } );
Re: (Score:2)
No need to quote . inside character classes. Use [.] or \., but not both.
Re: (Score:3, Insightful)
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
Re: (Score:2)
The OP was referring to reversing the _words_ in a string, not the _characters_ in a string. Quite a different beast.
Re: (Score:3, Insightful)
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
Re: (Score:2)
Really? I think the answer would be "writing code in functional langauges". Yes there is real production code written in Haskell -- darcs and pugs come to mind.
Re: (Score:2)
What you would get with your approach is the worst kind of developer, one who spends days or weeks reinventing his own convoluted and probably bug ridden version of the wheel because he doesn't know how to make his language work for him.
Any CS student should know ... (Score:2)
My solution still needs three pointers/indexes, though.
Re: (Score:2)
Okay, now do it without using a built-in split, join, or reverse function. Oh, yeah, and make sure the result ends up in the same initial string variable (or string buffer object, if you're working in a language with immutable strings) without using any extra storage space beyond a single character.
It's not as easy as just splitting, reversing the resulting array, and joining it back together. 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. My base assumption is that you can do most "simple" interview questions in three lines of code or less if I allowed you to use built-in structures or methods. :)
Are you hiring coders or puzzle makers? Do you also ask them to write the code left handed?
And that isn't even a very hard puzzle-- it just weeds out those who can't think under pressure. Move characters one at a time from the end to the beginning, shifting the remaining characters right and keeping count of what you've moved. When you hit a space, start shoe-horning the characters in offset by the length of the words already moved. The only varibles needed outside the string array are a single character,
Re: (Score:2)
Re: (Score:3, Insightful)
You know, after so much typing, I don't know how to write
Re: (Score:3, Interesting)
That was it. No other direction, no manuals. Ah, yes, there was "man"...but the $MANPATH was bare-bones and the guest account had extremely limited access to anything besides /usr/* and /home/guest. On top of that, the only editor that worked was "ed" (vi couldn't handle the term I was ru
Re:A total waste of time (Score:5, Insightful)
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.
Re: (Score:2)
Re: (Score:2)
the problem with this is that a lot of companies disallow the giving of references other than 'he worked here from date x to date y' (and all references has to go tough HR even for this basic info) so the only references that you can really check are friends of the prospect... which will always be positive references.
Re: (Score:2, Funny)
Re: (Score:2)
Re: (Score:2)
I can show you samples, and I can point you to exactly where I got them- hint: they aren't downloaded. While I'm sure there are those who would try to cheat their way through this, don't be so quick to judge- it's as bad as the fallacious thinking behind the four-year-degree syndrome. For those wondering where to get the samples...CODE THEM. Write a small app.
Re: (Score:2)
Exactly! That way they can also observe your problem-solving process and your ability to communicate about your work. A code sample is mostly worthless. Even if you did write it yourself, it is impossible to tell a) how long it took b) what was wrong with the first revision c) who gave you input d) did you actually implement the right functionality for the problem,
So I agree, an employer that asks for a code sample is
toddbu is majorly underrated (Score:2)
Re:A total waste of time (Score:5, Insightful)
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.
Re:A total waste of time (Score:5, Interesting)
I disagree. I could be very useful in the interview process. We used it just to give us something very concrete and technical to discuss with the engineer. Throwing some people questions makes them very nervous, like they're being tested. Having them bring some of their own code to discuss makes most good engineers very relaxed. Here, they get to show their prospective employer something that they're reasonably happy with. If I ask any questions, they're usually very quick to answer. Now, I'm the "newbie" in the code, and they're just showing me around.
I suppose that it depends why the potential employer wants it. Ask them. Many programmers just "steal" a page of code from some system they're working on even if it is proprietary. If you don't feel comfortable doing that, just work on something for a few hours. Whatever you have time to do. It might not have to be complete or very complex.
When one of my managers started asking new candidates for code samples, it was actually quite useful in the interview process. I really didn't care whether they wrote it or downloaded it. We weren't looking for "do you know how to write code." We were really interested in hearing you talk about code. Hopefully, you sent us something you wrote. But it wasn't critical to the interview that you did.
That is, you'd send us a page or two of code the day before the interview. It didn't even have to be in the programming language we were hiring you for (Java, C++, or Perl). One guy sent us some LISP code. Your interviewers would read over the code. Then, during the interview, we'd take out a copy of the code, ask you to give us an overview of what it does, and ask some more specific questions.
Some examples: For a systems/tools job, one guy just pointed us to a little module in CPAN. The CPAN code had good PERLDOC comments, of course. It was packaged as a module. The guy could explain why he ended up writing it and talk about the code even though it had been a few years since he touched it. Another guy sent us code to a CGI script that he used on a personal web server to track some data between him and his friends. That code was okay, and the guy could explain what he was doing. But it was also a giant flat script. No subroutines. Almost no comments. Program logic and HTML output intervleaved in a somewhat confusing manner. The developer who sent us the CPAN code got the job. Not just on the basis of his code, but it just confirmed everything else we got out of the interviews.
For another position, some developers sent us a page or two lifted from some of their Java code. Of course, in any real application, a page or two of code doesn't show you much. Still, one guy sent us code with what were almost certainly errors in it. Rather than telling the developer, "Um, this looks like an error," we just asked him to explain what the code was doing. I've rarely seen a candidate look so nervous. He didn't really seem to know what the code was doing. Either he didn't write the code, or he didn't really feel comfortable talking about code. Bzzt. Not someone we wanted on our team. In any case, if you're going to steal code, try to have good enough taste to steal good code. And if you're showing me code that you didn't write, at least take the time to read it and understand what it does.
For the same job, another developer sent us code for a few methods. As soon as I started asking about the code, she looked so relaxed. Now we were just two engineers talking about code. She started sketching in the margins of the page to show a rough system architecture and where this code fit in. She explained a bit of the data flow and some use cases where the users interacted with the system. We talked about the data being passed in to one of the methods. At one point, she wanted to explain something, realized that she hadn't sent us that code, and sketched a rough version of the code on the back of one of the pages. Her quick version had a silly error. When I pointed it out, she just laughed and said, "Oh, right. It should be like this," and she fixed it. But she was eager to get back to explaining where that sketched code connected to the other code. That's the kind of developer we were looking for.
Re: (Score:2)
Re: (Score:2)
Usually the writing sample is some essay from their civ class. Their code is some class assignment as well. (CS students have reams of this stuff). If any one of the three is awful, they don't get a callback. (hoo boy! and do some stink).
In the interview, we ask them to explain the code, and ask why did you do X here instead of Y. If you had another hour what would you change first, etc. We a
Re: (Score:2)
Regardless, I enjoyed the tests because they were interesting and helped me lea
Re: (Score:3, Insightful)
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) an
Re: (Score:3, Insightful)
Re: (Score:2)
Re: (Score:2)
Re:A total waste of time (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.
Re:A total waste of time (Score:4, Interesting)
Re: (Score:2)
Aww. Don't force the poor C programmers to do bit-twiddling that should be done in assembly for any kind of efficiency.
Re: (Score:2)
If you can't think of anything (Score:5, Funny)
find theirs (Score:5, Funny)
but that is my personal view..
Re: (Score:2)
Re: (Score:3, Interesting)
Not necessarily at least for code (not data access and representation). Depends on the code example and language.
If the target language is sufficiently diverse and expressive the code example can tell you about the way a person thinks at least as much as the interview.
There is no point to ask for code samples in java, python, ruby or smalltalk. Different people asked about the same problem will usually end up with the same implementation sans variable names and minor stillistic differences. That is th
Re: (Score:2)
That actually works; I've done it before. Well, to be precise, it was the various bugs I told them about from looking at their disassembly that got me the job offer (it wasn't an interview, and I was never actually trying to get hired). But try that with Microsoft or Sony at your own risk (though I doubt most people here would even consider working for one of them an option)
Re: (Score:3, Funny)
Simple: "This does get the person who wrote it fired if it ever turns up in a real project."
Re: (Score:2)
Do they have to be YOUR code samples? (Score:2, Funny)
Re: (Score:3, Insightful)
Re: (Score:2)
And you have the nerve to submit to Ask Slashdot!
Some people just don't seem to understand that coding isn't a way of life. It is life.
Here's a code sample from my younger days... (Score:4, Funny)
20 print "HELLO, WORLD!"
30 goto 20
Re: (Score:2)
10 PRINT "YOU SUCK!"
20 GOTO 10
THEN I would have known it was actually your first program in elementary school on that TRS-80 in the lab in fact on all the computers you could get your hands on when the teacher was't looking...
Umm. Nevermind. It wasn't me! I was playing with my Logo Turtle the whole time!
Re: (Score:3, Funny)
One word (Score:2)
If they want to ask for a code sample... (Score:4, Interesting)
There's no way that a prospective employer can reasonably expect to be able to look at your current production code, and if they do and they expect you to bend the rules of your current NDAs I'm not sure it'd be somebody I'd want to work for anyways.
Re: (Score:3, 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 di
Re: (Score:2)
Yeah. Would you chose a neurosurgeon who pokes around people's brains in his spare time ? I wouldn't.
Once I get a (well paid) job in management, maybe then I'll start coding in my spare time. If I have any.
The answer is obvious! (Score:3, Funny)
RoR coders needed (Score:3, Interesting)
(only half joking)
i prefer.. (Score:2, Insightful)
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 a
Just say you invented this: (Score:5, Funny)
float xhalf = 0.5f*x;
int i = *(int*)
i = 0x5f3759df - (i>>1);
x = *(float*)
x = x*(1.5f - xhalf*x*x);
return x;
}
Re: (Score:2)
If you can explain it, you have a good chance of getting hired for certain jobs.
If you can't explain it, then we can both have a good laugh about your joke, and I can look at the next candidate.
Re: (Score:2)
After 8 Years in IT (Score:2)
Just keep an eye on past and current projects for ones that are reasonably self-contained (there are always a few gems that you write while working) and then go home and reimplement it on your own hardware and on your own time. It is perfectly acceptable to use a code sample like this for interview purposes, provided that proprietary information is not present. I have several samples from the past few years which are loosely based on insights that I gained during particular projects. I went home and rewo
Re: (Score:2)
Ok, I better qualify "knowledge" before I get slammed. By this, I am referring to your understanding of things other than trade secrets and the like. So, your knowledge of .NET, or Java, or Python, or building relational databases, or implemented object-oriented software architectures, or developing in an Agile framework, and so on.
My comment was in the context of code sample, so I'm assuming you're bright enough to not share your knowledge of trade secrets and the like in your code samples, :-).
Open Source? (Score:3, Interesting)
Re: (Score:2)
Everyone seems intent on stating that if they ask for code samples, you don't want to work for them. I work for a company that wanted a code sample, and life is good. I love this company. I think instead, companies that DEMAND code samples are the ones to watch out for.
At any rate, having open source work you can show will have 2 effects:
You'll have code to show.
You'll weed out companies that a
Really good advice (Score:3, Interesting)
Re: (Score:2)
Except that's exceptionally bad advice. The information isn't his to protect, it's property of his company and he's signed contracts to maintain its confidentiality. As an employee he doesn't have any power to re-engineer his contract to include external third parties.
What it would show me (as an interviewer) is that this person doesn't understand the proprietary and classified contract he's signed and is a security risk.
I would ev
Google (Score:2)
Here's what to use... (Score:3, Funny)
Notepad? (Score:2)
Explain the situation (Score:2)
I have never been asked for code samples as part of an interview. Probably because the vast, overwhelming majority of code that people get paid to write is either proprietary, classified, or both. Seems a
Whose luck? (Score:2)
Whose luck are you measuring, the candidates or yours?
I go through tons of applications looking for qualified people. It would be my luck to discard the one or two who actually know what the position they applied for is.
you said it (Score:2)
How about showing them some of the code that is proprietary but not classified?
mod me down for obvious... (Score:4, Insightful)
you're wasting your time .... (Score:4, Insightful)
Not all that Common (Score:2)
What I did when I was asked was simply state that all my relevant work in the language they asked for was done for my current job, and thus I couldn't disclose any of the code to them in good concious. I then asked them if, instead, they would like to give me a simple pr
Two things (Score:3, Interesting)
Either way, if a company asked me to bring in a code sample, I would cancel the interview, since obviously, I don't want to work for them.
Oh, and ANY code I worked on for previous employers is not my property, and to display it to someone else is violating the no compete clause I may have signed when leaving the previous company, or with my current employer.
In many job interviews over the last 25 years, not once have I been asked to show "code samples". With one company I was asked to take a basic programming test, but that only took a half hour. (Stupid test, they had an invalid question on it, where the correct answer would depend on the setting of a compile time switch in several languages).
Why is asking for code samples a bad sign? (Score:5, Insightful)
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.
Re: (Score:2)
The company I work for did a pretty good job of interviewing me... there was a ten minute "let's see if we like you" part, followed by a reasonably rigorous (but fair) test of the language. The only drawback is that the managers would generally pick the most technically competent person and ignore soft skills like "can understand and follow directions", "has a good personality" and "can think for themselves."
Fortunately I'm now the final decision maker when it comes to hiring programmers on my
Re:Why is asking for code samples a bad sign? (Score:5, Funny)
He probably isn't pleasant to be around because of his coding style.
There's nothing wrong with code samples (Score:2)
Re: (Score:2)
There's plenty of things wrong with it -- The code doesn't gracefully handle the file not existing, doesn't check for NULL, the loop is written as a for when it would be more clear as a while, variables are named things like x when they should be named things like currentFr