Code examples for job interview

R

Rhino

I am about to start a job search as a Java developer. I've never looked for
a job as a Java developer before, having spent earlier parts of my career as
a DBA and instructor, so I need some guidance on what to expect.

I am pretty much entirely self-taught as a Java developer and I am not
certified in any Java skills. Despite that, I've been writing Java code,
mostly on my own time, for several years now and feel that I could do a
decent job at an intermediate level development job. The problem is that I
probably need to prove that.

I was thinking that some examples of my code would demonstrate that. (I'd be
prepared to talk at length about the code and what it does in case anyone
thought I'd just stolen it from somewhere.)

The question is: what samples should I provide? I'm wondering about the
number of samples, the size of each sample, and the format of the samples.
Also, what medium should I use for the samples: CD; download links on a
webpage; printed copies?

I'm also wondering about intellectual property issues. If I give out code
that I wrote while on a project where I'd signed a non-disclosure agreement,
I'd be at some legal risk if that ever got back to the client, wouldn't I?
So how would I proceed? Just say "Trust me, I did write some good code for
that client but I can't show it to you?". Is that going to be acceptable to
an interviewer? How do people normally handle that?

What about code that I developed for past employers? Even without a
non-disclosure agreement, don't I have some sort of obligation not to
disclose details of work I did for an employer? After all, if the
prospective employer is a competitor of the past employer and the
prospective employer learns something about the programs and/or business
practices and/or computer systems that his competitor uses, aren't I
basically blabbing something that I learned in confidence when working for
the past employer?

Please note that I'm not asking anyone for binding legal judgements on the
legality of anything; I know none of us are lawyers. I'm just asking how
this sort of thing is handled every day in job interviews around the world:
do interviewees typically produce examples of their work from past employers
or clients and, if they do, is that considered a negative by the interviewer
or an accepted business practice? Is anyone aware of cases where there were
negative consequences for the interviewee or past employer when examples of
old code were disclosed to prospective employers?

One other thing. I was thinking that my samples might include both Java and
non-Java code; after all, programming is programming (to some extent) and
being able to display working programs written in other languages that I got
as a salaried developer ought to count for something. Does it make sense to
have non-Java samples handy as well or should I stick to examples that
illustrate skills with the language(s) that the prospective employer would
want me to use if he gives me the job?
 
S

Scott Ellsworth

Rhino said:
I was thinking that some examples of my code would demonstrate that. (I'd be
prepared to talk at length about the code and what it does in case anyone
thought I'd just stolen it from somewhere.)

The few times I have interviewed for myself, rather than trying to sell
our consulting services, I brought code samples written up for that
specific job interview, and stats on the real code they represent.

Spend an evening writing up a toy problem, or a toy class. Be up front
- 'I cannot reveal the code I have written under contract, but this has
many of the same characteristics - getters, setters, unit tests, code
coverage, minimal but complete docs, etc.' Then discuss ways in which
this code is similar to or different from that which you normally would
do. For example, 'I have written a few thousand lines of numerical
analysis code. This is representative of it in style, method length,
metrics, etc.'

Talk about how your own projects differ from ones for pay. 'Half my
current clients use CVS, half use subversion. I use subversion through
the svnserve daemon for personal projects. I have found [stuff you have
found].'

They know you prettied up your code sample; being up front about it, and
in what ways, is a darn good idea. It then goes from a point of risk to
a source of questions and comments. For example - 'The setters are, as
you would expect, boilerplate generated by IDEA. I do try to be very
careful about exposing API, since then I am stuck with it for future
releases.' This turns a discussion about some code you prettied up into
a discussion about OO philosophy, and how you treat encapsulation.

You NEVER want to bring something you did for another employer without
permission. Not only does it put you in legal hot water, it also tells
your new potential employer that you are willing to violate an NDA for
convenience.

Scott
 
E

Eric Sosman

Rhino wrote On 02/13/06 13:44,:
I am about to start a job search as a Java developer. I've never looked for
a job as a Java developer before, having spent earlier parts of my career as
a DBA and instructor, so I need some guidance on what to expect.

I am pretty much entirely self-taught as a Java developer and I am not
certified in any Java skills. Despite that, I've been writing Java code,
mostly on my own time, for several years now and feel that I could do a
decent job at an intermediate level development job. The problem is that I
probably need to prove that.

I was thinking that some examples of my code would demonstrate that. (I'd be
prepared to talk at length about the code and what it does in case anyone
thought I'd just stolen it from somewhere.)

The question is: what samples should I provide? I'm wondering about the
number of samples, the size of each sample, and the format of the samples.
Also, what medium should I use for the samples: CD; download links on a
webpage; printed copies?

This seems like something you should ask before the
interview.
I'm also wondering about intellectual property issues. If I give out code
that I wrote while on a project where I'd signed a non-disclosure agreement,
I'd be at some legal risk if that ever got back to the client, wouldn't I?
So how would I proceed? Just say "Trust me, I did write some good code for
that client but I can't show it to you?". Is that going to be acceptable to
an interviewer? How do people normally handle that?

Show something you wrote on your own time for your
own purposes. (That, at least, is what I did on the only
occasion I was asked for a code sample.) If you haven't
written anything you can clearly claim as your own, now
might be a good time to start ...
What about code that I developed for past employers? Even without a
non-disclosure agreement, don't I have some sort of obligation not to
disclose details of work I did for an employer? After all, if the
prospective employer is a competitor of the past employer and the
prospective employer learns something about the programs and/or business
practices and/or computer systems that his competitor uses, aren't I
basically blabbing something that I learned in confidence when working for
the past employer?

IANAL, but the code you wrote for past employers probably
belongs to them, not to you. You almost certainly signed a
piece of paper granting the company ownership of anything you
developed on company time; some such agreements extend even to
things you did on off-hours while in the company's employ. For
safety's sake I'd steer clear of such samples, and if you really
want to use them you'd better get legal advice first. Also,
consider the impression you'll make on the interviewer: "This
guy's showing me a former employer's family jewels. Am I eager
to trust him with mine?"
Please note that I'm not asking anyone for binding legal judgements on the
legality of anything; I know none of us are lawyers. I'm just asking how
this sort of thing is handled every day in job interviews around the world:
do interviewees typically produce examples of their work from past employers
or clients and, if they do, is that considered a negative by the interviewer
or an accepted business practice? Is anyone aware of cases where there were
negative consequences for the interviewee or past employer when examples of
old code were disclosed to prospective employers?

Well, I'll offer my lone data point again: Forty years as
a programmer, thirty-five of them as a professional, and in
all that time ONE request for code samples. Draw your own
conclusions.
One other thing. I was thinking that my samples might include both Java and
non-Java code; after all, programming is programming (to some extent) and
being able to display working programs written in other languages that I got
as a salaried developer ought to count for something. Does it make sense to
have non-Java samples handy as well or should I stick to examples that
illustrate skills with the language(s) that the prospective employer would
want me to use if he gives me the job?

Depends on the job. When I have interviewed prospective
employees I have never worried about their skills with this
or that programming language, nor with the technology du jour.
Fifteen years ago everybody wanted Xwindows programmers; ten
years ago it was Visual Basic programmers, five years ago it was
Java programmers, today it's Web services programmers, tomorrow
it will be ...? Things change, and change rapidly, so I always
looked for people who had shown they could solve problems, not
for people who could tell me the minutiae of different versions
of Lisp.

But don't overlook that "depends on the job" part. If the
employer's goal is to solve problems of type X and he happens
to be using Java as the solution vehicle, he'll be (I think)
looking for problem-solvers, not Java Jeniuses. On the other
hand, if the employer's goal is specifically to Do Stuff In
Java, he'll probably have a different attitude. You've got to
study the prospective employer at least as carefully as he
studies you.
 
J

Jeroen Wenting

I am pretty much entirely self-taught as a Java developer and I am not
certified in any Java skills. Despite that, I've been writing Java code,
mostly on my own time, for several years now and feel that I could do a
decent job at an intermediate level development job. The problem is that I
probably need to prove that.
That's how almost everyone starts off...
The kids fresh out of school may have Java on their resumes but they know as
little (or likely less) than you do, and a decent recruiter (and certainly
an technical person) knows that and will appreciate that you at least know
how the real world works,
I was thinking that some examples of my code would demonstrate that. (I'd
be prepared to talk at length about the code and what it does in case
anyone thought I'd just stolen it from somewhere.)
I've never in a decade of working as a programmer been asked for any code I
worked on.
Code you write for an employer or under contract belongs to that employer so
noone can expect you to show it to anyone.
Hobby code while nice isn't generally expected to be in the same league.
The question is: what samples should I provide? I'm wondering about the
number of samples, the size of each sample, and the format of the samples.
Also, what medium should I use for the samples: CD; download links on a
webpage; printed copies?
Never assume the person interviewing you has anything available apart from
hopefully a desk, a piece of paper, a pen, and seats for both of you (I've
had interviews where there was less!).
Draw your own conclusions from that :)
I'm also wondering about intellectual property issues. If I give out code
that I wrote while on a project where I'd signed a non-disclosure
agreement, I'd be at some legal risk if that ever got back to the client,
wouldn't I? So how would I proceed? Just say "Trust me, I did write some
good code for that client but I can't show it to you?". Is that going to
be acceptable to an interviewer? How do people normally handle that?
See above, no interviewer would expect you to hand over code you wrote for
others. If they ask it's a trick question and you're supposed to answer just
that, that you can't hand over code you don't own.
What about code that I developed for past employers? Even without a
non-disclosure agreement, don't I have some sort of obligation not to
disclose details of work I did for an employer? After all, if the
yes you do. You don't own the code.
Maybe if the past employer went bankrupt while you were in their employ and
noone picked up the smoking remains you could argue that the code is part of
what they owned you, but it's still shaky and I'd sooner consider that code
lost forever (I do keep some such in my private library, but only as a
reference to check algorithms and methods I used in the past, I'd never
reuse it verbatim).
Please note that I'm not asking anyone for binding legal judgements on the
legality of anything; I know none of us are lawyers. I'm just asking how
this sort of thing is handled every day in job interviews around the
world: do interviewees typically produce examples of their work from past
employers or clients and, if they do, is that considered a negative by the
interviewer or an accepted business practice? Is anyone aware of cases
where there were negative consequences for the interviewee or past
employer when examples of old code were disclosed to prospective
employers?
If I were to interview someone and he'd show me code telling me he wrote it
for another company the interview would be over there and then and that
person would not get hired.
I might even contact that company and tell them one of their (ex)employees
has shown me intellectual property belonging to them to cover my own ass and
that of my own employer in case there is ever an argument.
One other thing. I was thinking that my samples might include both Java
and non-Java code; after all, programming is programming (to some extent)
and being able to display working programs written in other languages that
I got as a salaried developer ought to count for something. Does it make
sense to have non-Java samples handy as well or should I stick to examples
that illustrate skills with the language(s) that the prospective employer
would want me to use if he gives me the job?
Knowledge of more than one environment is always good. Shows you are not
extremely narrowly focussed.
 
D

Daniel Dyer

I was thinking that some examples of my code would demonstrate that.
(I'd be
prepared to talk at length about the code and what it does in case anyone
thought I'd just stolen it from somewhere.)

The question is: what samples should I provide? I'm wondering about the
number of samples, the size of each sample, and the format of the
samples.
Also, what medium should I use for the samples: CD; download links on a
webpage; printed copies?

If you do need to take some code along it's probably best to take a CD (or
USB key) and a hard copy, then you can use whichever is more convenient.

Take the code along, it can't hurt to have something to show if the
opportunity arises, but it probably won't be necessary. One of the most
challenging interviews I had was a pen and paper session with their senior
developer. We discussed various Java problems and how I would approach
them, discussed design patterns etc. for about an hour. I think after
that they had a good idea of what I could and could not do.
I'm also wondering about intellectual property issues. If I give out code
that I wrote while on a project where I'd signed a non-disclosure
agreement,
I'd be at some legal risk if that ever got back to the client, wouldn't
I?
So how would I proceed? Just say "Trust me, I did write some good code
for
that client but I can't show it to you?". Is that going to be acceptable
to
an interviewer? How do people normally handle that?

What about code that I developed for past employers? Even without a
non-disclosure agreement, don't I have some sort of obligation not to
disclose details of work I did for an employer? After all, if the
prospective employer is a competitor of the past employer and the
prospective employer learns something about the programs and/or business
practices and/or computer systems that his competitor uses, aren't I
basically blabbing something that I learned in confidence when working
for
the past employer?

As others have said DO NOT take along code from a previous employer. It
creates a very bad impression of your trustworthiness. It makes you look
like the kind of person that would upload all of their source code to
Sourceforge. They know you aren't allowed to show it to them, so don't.
One other thing. I was thinking that my samples might include both Java
and
non-Java code; after all, programming is programming (to some extent) and
being able to display working programs written in other languages that I
got
as a salaried developer ought to count for something. Does it make sense
to
have non-Java samples handy as well or should I stick to examples that
illustrate skills with the language(s) that the prospective employer
would
want me to use if he gives me the job?

Code in other languages is OK, but be careful not to let it overshadow
what you have to offer as a Java developer. You are right that it
displays a general programming competence, but the company will be keen to
see what you can do with Java, as they will want you to be productive in
that as soon as possible if you get the job. Also, the interviewer may
not be familiar with the other language. What I know about VB can be
written on the back of a postage stamp, so when candidates spend 20
minutes discussing their VB projects it's a waste of both our time (not
compeletely, but on the whole).

If you want to do some preparation for the interviews, I would recommend
getting hold of the books "Effective Java" by Joshua Bloch, and "Design
Patterns: Elements of Reusable Object-Oriented Software" by Gamma et al.,
if you don't have them already. These two books, more than any others I
have come across, are pretty much essential reading for any professional
Java developer.

Dan.
 
R

Rhino

Rhino said:
I am about to start a job search as a Java developer. I've never looked for
a job as a Java developer before, having spent earlier parts of my career
as a DBA and instructor, so I need some guidance on what to expect.

I am pretty much entirely self-taught as a Java developer and I am not
certified in any Java skills. Despite that, I've been writing Java code,
mostly on my own time, for several years now and feel that I could do a
decent job at an intermediate level development job. The problem is that I
probably need to prove that.

I was thinking that some examples of my code would demonstrate that. (I'd
be prepared to talk at length about the code and what it does in case
anyone thought I'd just stolen it from somewhere.)

The question is: what samples should I provide? I'm wondering about the
number of samples, the size of each sample, and the format of the samples.
Also, what medium should I use for the samples: CD; download links on a
webpage; printed copies?

I'm also wondering about intellectual property issues. If I give out code
that I wrote while on a project where I'd signed a non-disclosure
agreement, I'd be at some legal risk if that ever got back to the client,
wouldn't I? So how would I proceed? Just say "Trust me, I did write some
good code for that client but I can't show it to you?". Is that going to
be acceptable to an interviewer? How do people normally handle that?

What about code that I developed for past employers? Even without a
non-disclosure agreement, don't I have some sort of obligation not to
disclose details of work I did for an employer? After all, if the
prospective employer is a competitor of the past employer and the
prospective employer learns something about the programs and/or business
practices and/or computer systems that his competitor uses, aren't I
basically blabbing something that I learned in confidence when working for
the past employer?

Please note that I'm not asking anyone for binding legal judgements on the
legality of anything; I know none of us are lawyers. I'm just asking how
this sort of thing is handled every day in job interviews around the
world: do interviewees typically produce examples of their work from past
employers or clients and, if they do, is that considered a negative by the
interviewer or an accepted business practice? Is anyone aware of cases
where there were negative consequences for the interviewee or past
employer when examples of old code were disclosed to prospective
employers?

One other thing. I was thinking that my samples might include both Java
and non-Java code; after all, programming is programming (to some extent)
and being able to display working programs written in other languages that
I got as a salaried developer ought to count for something. Does it make
sense to have non-Java samples handy as well or should I stick to examples
that illustrate skills with the language(s) that the prospective employer
would want me to use if he gives me the job?
Thank you all for your feedback to my questions.

I'm very happy to see that your ethics match my own. I was very
uncomfortable about the thought of showing an interviewer code that I had
written commercially for someone else but I thought maybe I was
"old-fashioned".

I'm disappointed that code samples are so rarely used in interviews to
assess a candidate's competence but it's very understandable given the
ethical concerns.

Unfortunately, I've just spent several weeks developing a fairly impressive
example of my code when it seems I should have been out knocking on doors
trying to get interviews. It sounds as if few if any interviewers will
actually want to see my code. Obviously (in hindsight), I should have asked
these questions _before_ expending a big effort on making a good example. I
couldn't think of any better way to prove my competence rather than
expecting an interviewer to take my word for it so I just went ahead,
assuming it would help me.

The code I've written in the last few weeks was a resume generator and was
done entirely by me and for me so I can still use it to show the interviewer
my abilities. I suppose I shouldn't expect him/her to ask to see it though!

Apparently, the interviewer is going to assess my abilities based on some
combination of:
- what I tell him in my resume and in person
- what past employers/clients tell him/her, assuming the interviewer
contacts them
- a technical interview by someone who will ask me questions about how I
would solve certain problems that he/she will pose at that time

I'm not too worried about the first two of those but I'm not as sure about
the third. I'm afraid my OO theory is not that great yet and I may get badly
messed up if I try to talk in OO jargon for any length of time. Well, I'll
just have to do my best and keep my fingers crossed, won't I?

Thanks again for your feedback everyone!
 
A

Adam Maass

Rhino said:
I am about to start a job search as a Java developer. I've never looked for
a job as a Java developer before, having spent earlier parts of my career
as a DBA and instructor, so I need some guidance on what to expect.

I am pretty much entirely self-taught as a Java developer and I am not
certified in any Java skills. Despite that, I've been writing Java code,
mostly on my own time, for several years now and feel that I could do a
decent job at an intermediate level development job. The problem is that I
probably need to prove that.

Certainly. If you get through the door, there almost certainly will be a
technical quiz or screen.
I was thinking that some examples of my code would demonstrate that. (I'd
be prepared to talk at length about the code and what it does in case
anyone thought I'd just stolen it from somewhere.)

The question is: what samples should I provide? I'm wondering about the
number of samples, the size of each sample, and the format of the samples.
Also, what medium should I use for the samples: CD; download links on a
webpage; printed copies?

I wouldn't bother with samples unless specifically asked to provide some.
This does ocassionally happen, in which case...
I'm also wondering about intellectual property issues. If I give out code
that I wrote while on a project where I'd signed a non-disclosure
agreement, I'd be at some legal risk if that ever got back to the client,
wouldn't I? So how would I proceed? Just say "Trust me, I did write some
good code for that client but I can't show it to you?". Is that going to
be acceptable to an interviewer? How do people normally handle that?

What about code that I developed for past employers? Even without a
non-disclosure agreement, don't I have some sort of obligation not to
disclose details of work I did for an employer? After all, if the
prospective employer is a competitor of the past employer and the
prospective employer learns something about the programs and/or business
practices and/or computer systems that his competitor uses, aren't I
basically blabbing something that I learned in confidence when working for
the past employer?

IANAL (I am not a lawyer). But: In the US, the IP you produce as a salaried
employee belongs to your employer. [Way to go, capitalism!] The IP you
produce as an independent contractor belongs to you unless there is an
agreement otherwise [as is generally the case].

This leaves you with a choice, if you are asked to provide a code sample:

1) Live with the risk of showing them work you produced for another entity.
As you've pointed out, this isn't quite kosher, but generally speaking, it
probably won't get back to anyone.

2) Ask if there's a sample problem that they'd like you to work instead.
This involves extra effort on your part, but eliminates the risk of option
1.

3) Third option: work a small problem on your own; have it at the ready.
(Small problem generally means 1 class that solves your typical CS problem:
an implementation of a standard data structure, maybe. I was once asked to
implement a "Quack" as a sample -- which was cross between a Stack and a
Queue.)

[snip]
One other thing. I was thinking that my samples might include both Java
and non-Java code; after all, programming is programming (to some extent)
and being able to display working programs written in other languages that
I got as a salaried developer ought to count for something. Does it make
sense to have non-Java samples handy as well or should I stick to examples
that illustrate skills with the language(s) that the prospective employer
would want me to use if he gives me the job?

You must be ready to provide samples in whatever language and/or format your
prospect demands. Some will want Java; others will admit practically
anything.
 
A

Adam Maass

Rhino said:
. I'm afraid my OO theory is not that great yet and I may get badly messed
up if I try to talk in OO jargon for any length of time. Well, I'll just
have to do my best and keep my fingers crossed, won't I?

In which case, just talk about how you would approach the problem, steering
clear of the jargon you're not clear on.

Technical screens will generally pose very common problems; take your time
when they're posed to be sure your answers are correct, or admit an "I don't
know." As an interviewer, I find incorrect answers irritating, and an
interviewee who sticks to her guns when challenged to defend an incorrect
answer a sign of doom. That is, assuming that you get questions that have
right and wrong answers.

-- Adam Maass
 
E

Eric Sosman

Rhino wrote On 02/13/06 18:02,:
[...]
I'm disappointed that code samples are so rarely used in interviews to
assess a candidate's competence but it's very understandable given the
ethical concerns.

There's also the little matter of time. If someone
handed you a dozen *.java source files containing twenty
or thirty classes and interfaces, how much time would it
take you to get to know the program well enough to be in
a position to evaluate the various design trade-offs? The
interviewer usually has other responsibilities besides
conducting interviews, and probably lacks the luxury of
spending half a day or more poring over code samples from
a dozen interviewees.
[...]
Apparently, the interviewer is going to assess my abilities based on some
combination of:
- what I tell him in my resume and in person
- what past employers/clients tell him/her, assuming the interviewer
contacts them
- a technical interview by someone who will ask me questions about how I
would solve certain problems that he/she will pose at that time

A variation on the last point: I almost never asked a
prospect about how he'd solve some hypothetical technical
problem, but asked him to describe a technical problem he
actually had solved. Then I'd start drilling down from
there. You chose approach X; what alternatives did you
consider? Why did you decide X was better than Y? When
you actually went ahead with X, did you get the benefits
you'd expected? What difficulties, expected and unexpected,
did you run into, and how did you deal with them? In
retrospect, do you still think X was right, or have you
thought of a Z that you now think would have been better?
And so on, and so on. I think this gave me a pretty good
picture of how the interviewee works, of whether he'll learn
from experience -- and if he's claiming to have done something
he actually doesn't know anything about, I think this sort of
questioning will expose the fraud pretty quickly!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top