views:

1706

answers:

15

I've been asked to write code/design things in an interview. Sometimes even to provide code samples. Very reasonable and very wise (always surprised when this DOESN'T happen)

I had a job a year or so back where the code was so awful that I would not have taken the job, if I'd seen the mess I had to deal with ahead of time. And I can't tell you how many horrendous databases I've had to work with.

Is it out of the question for me to ask them to provide a code sample and to view their database design? Assuming I'd be happy to sign an NDA, part of me feels it would insane to take a job without examining the codebase or database I'd be working with.

Anyone done this?

Update

This would be something I would ask later in the interview process, if things were proceeding well and I felt an offer was forthcoming.

It's also in the context of working in a small shop or small project as my preference is to avoid places that use phrases like "get a developer off the floor"

+8  A: 

None of the candidates we have interviewed have ever asked that; however, many of them have been co-ops/interns in the company so they are familiar with our code...

Having said that, it is highly unlikely we will show our code to ANY candidate, regardless of an NDA. I would be happy to answer questions about what technologies we use, what system we use for revisions, practices around, etc. Actual code though? No.

Also in a large enough system (as ours is) someone can just show you the "best" code there is...and you would be where you started :) As for a database design...both companies I have worked at have had enormously large databases (university, corporate company)...so that wouldn't work either.

Swati
I have to ask: What is the danger of letting a potential hire look at your code for a few minutes? Do you really think that you have such valuable trade secrets that could be stolen so easily?
Kristopher Johnson
Our group happens be a core group in the company; seeing our code can reveal some unreleased stuff...which would be a legal no-no. Even a quick glance at the file names can give you an idea of what we have coming.
Swati
Many companies that I've observed treat industrial espionage as a bigger threat than spying or theft of government classified data. An interviewer being a possible mole for a competitor doesn't seem too far fetched to me.
James Schek
+2  A: 

It can't hurt to ask and this is a very good idea which I am going to add to my checklist of questions to ask employers.

Cade Roux
A: 

I think this is a great idea; however, as an employer, I would be hesitant -- even with an NDA -- to provide an interview candidate samples of real, working code unless I was pretty sure I wanted to hire the person.

James Sun
+16  A: 

You can definitely ask. The answer may be "No," but nobody should consider that to be a bad or inappropriate question.

If they won't show you the code, you should definitely take that into account when you decide whether you want to accept an offer. I would take it as a sign that at least one of the following things is true:

  • The code is so horrible that they know you'll run away screaming.
  • The company has an ultra-secretive trust-nobody culture (which I would hate).
  • The company thinks they have such amazing code that just glancing at it would turn you into a superstar competitor. (In other words, they're self-deluded morons.)
  • They have glaring security holes that they hope to keep secret.
  • The people who are interviewing you don't know how to get the code themselves. (In which case you are not talking to the right people.)
Kristopher Johnson
I'd usually assume: "The people who are interviewing you don't know how to get the code themselves."
Zack Peterson
Well this is not true in all cases..company for which I work uses 2 rounds of interviews and if you are allowed to pass to second round you get to talk to people who are actually skilled in such areas (like lead developers and such)..problem is that you will not learn much in first round
drax
+13  A: 

I did ask: "Can I see some code and talk to programmers working here?"

The employer replied: "Sure! Come you can directly talk to our lead programmer of our information system!"

What an honor!

  • they showed me concept papers
  • I could talk to the lead programmer
  • they showed me a small part of a very new project telling: "this is just a prototype, direct3d is so sketchy, that's why this code is so messy"

It turned out that:

  • the lead programmer left the day I arrived
  • the software he had the lead, was a big mess
  • somehow I ended up spending 50% of my time, fighting against the mess
Andre Bossard
+2  A: 

An interesting idea, but I don't know how many companies would go for it. I know we can't do it where I work now.

I think the biggest problem you're going to have with this is that I have found that a lot of people take offense to people not liking their code. It's like criticising someone's therapist, it's just not a good idea to be an outsider and do it. Seeing the code and then not taking the job could give you the reputation that you're arrogant or not good enough to work on the code and that's why you didn't take the job. It might save you from getting job you don't want, but it could give you a negative reputation down the line. I live in a sizable city, but the IT people still know one another and word spreads. People in our field have egos, and it's easier to trash somoene else's reputation than it is to admit that code you wrote isn't up to par.

Kevin
It seems to me that you could side-step this issue by not telling them that the bad code was the problem. Really bad code usually comes with a lot of other bad job aspects. Some variation of "I don't think that we are a match" is a) true and b) not disrespectful.
Jørgen Fogh
+4  A: 

Similarly to some of the other responses, I've never had a candidate ask to see our code. Even if they did I've be very careful to do so and most likely would not. As Swati mentions, pretty much any non-trivial system will have sections that look good so even seeing the code won't help that much.

Better than looking at actual code is the Joel Test. Basically it is 12 yes or no questions that you can ask an employer. The more yes answers, the better the work environment is expected to be. It's obviously not a hard and fast "rule", but it would seem to indicate those companies that take code (and coders) seriously.

akmad
+1  A: 

Even if they showed you some code, would that be sufficient for you to come to a rough conclusion about the quality of code that you would be spending time with? For example, at my previous place, one of their products was a large e-banking middleware application. The core of the application was in C++ and designed and written in a great way. However, the extensions (which by far covered a large part of the application and its various different versions), which were in C++ too, that were mostly coded by the less-experienced and less-knowledgeable developers were a pile of crappy code (which I had to fix and work with or write from scratch at times) slapped together to just somehow work. If I had asked them to show me a snippet of the code during the interview, and they had shown me some of the core stuff (the extension code actually mostly contained the client-specific business logic so it wouldn't make much sense without the business-domain knowledge, etc), I would've thought that the overall quality of the code is good (which was not completely the case).

ayaz
+3  A: 

I can't think a reason for not showing some classes or talking about the architecture they're using. From my point of view it's like asking them to show you where are you going to work (room, table, chairs, teammates...). Anyhow, asking for it will show them you're interested in best practices and also that you're not desperate about finding a job at any price, and don't know how this can hurt.

+4  A: 

If you are going to do this then I think you need to give them a little warning so they can prepare an NDA and get an apppriate environment set up in which you can see it. Also be prepared to dedicate a little time to understanding why the code is in the shape it is.

If you turn up at your first interview and say, right, can I see the code, all but a very few people will say no. And not necessarily because they are evil and don't want to show you, but because it just isn't as simple as saying yes.

In my experience as a recruiter for a large software company it would have taken a considerable amount of time for us to disclose enough detail of the code and internally developed frameworks for any candidate - however bright - to be able to make a meaningful judgement of its pros and cons. We would only contemplate doing that if we were serious about hiring them.

If I were asked that question I woul say yes, come back another time and we'll arrange something. I would get a trustworthy developer off the floor and have them bring a laptop to the next interview and show a little of the code.

The reality is pretty much any software project which is of a reasonable size and has been in existence for more than one release will have some horrible scary rubbish in it.

Simon
And there you go with 'off the floor' , what are we, copper tops?
Tim Post
@tinkertim, if the cap fits :-) seriously, don't be so sensitive, I am one of you too, I just happen to do some management and recruiting too. Does the rest of the post not have any truth?
Simon
+16  A: 

I'd be more interested in seeing the company's systems - i.e. test framework, release process, autobuilds.... The presence or absence of those would tell me a lot more than a couple hundred lines of code.

Airsource Ltd
Well, this sort of question is obviously in addition to sensible questions one should always ask (such as those you describe)
davetron5000
I saw a bigger point in here which is that the everyday life of a developer is probably as much, if not more, influenced by the build and source control environment than the code itself. If it takes you 4 hours to build and breaks every other day you will still hate an elegant code base
Simon
+3  A: 

Go to open source projects. There you don't have to ask for permission to see the code.

David Schmitt
Transparency is inversely proportional to the monetary reward 8-)
Chris Noe
+1  A: 

More important than to ask for code snippets, I believe, is to ask them for which source code control product they use (run away from companies that answer "Visual SourceSafe") and which methodology they use: "Agile" or "Scrum" sends positive signals, CMMI usually means company loves bureaucratic processes, if they give you a "huh?" then you're warned ;)

Joe Pineda
+5  A: 

I've asked this in interviews with Xerox PARC, a startup, and Yahoo.

At PARC they sat me at a workstation with the code I'd take over if hired, went over the structure of the codebase super-briefly, and left me alone for around 20 minutes. This was enough to get an idea whether I could stand working with it, though I'd have liked some more time, like an hour total. Afterward I asked about a design decision that seemed dubious, and we chatted about the design and the style in general. This didn't just tell me more about the job, it told them more about me: did I explore their code top-down or bottom-up, what did I pick up on or ask about, etc. Valuable all around.

At the startup, they set up a separate meeting on another day, bringing in the author of the code (who wasn't an employee); we sat down at a laptop and went over things together. It was an unusual request to them and I think I had to sign a new NDA. This was once again worthwhile: my earlier interviews hadn't really cleared up what this fancy AI language was all about or what they'd want me to do with it, and sitting down with some concrete code blew away a lot of fog.

At Yahoo, I didn't see much of anything; I don't recall just what their response was. If I'd seen the code I ended up dealing with I might have had second thoughts (though it worked out all right in the end). (Both of the above codebases that I did get to see seemed generally nicer; the PARC one was open-sourced later on.)

In all these cases I shared some code of my own with them.

Darius Bacon
A: 

The problem is they will show you a little bit of code, but each of their programmers will write code in a different way. You are unluckily to have to work on the part of the code base that is well written.

Asking to see their coding standard and how they enforce it is more likely to be of use.

Ian Ringrose