[Pdx-pm] sample code

Bruce J Keeler bruce at drangle.com
Wed Jan 31 14:29:09 PST 2007

Robert Shepard wrote:
> Newbie to the list here. Hi!
> A couple of times when I have applied for work, the employer asks to see 
> some sample code. I find it difficult to decide what to show them.
> What are they looking for?
> Are they looking to see if it conforms to standard practice, and looks 
> like something straight out of an O'Reilly recipe book? If so, how do 
> they know it's really mine, and not something I just ripped from somewhere?
The ideal, I think, is to just point them at a module on CPAN if you 
have one.  That's what I do.  Failing that, just look through your code 
directory and pick something out.

I'd say it should solve a real-world problem, rather than an abstract 
CS101-ish one like the recipe books give.  Something relatively concise, 
clear and easy to follow.  Make something up if you don't have such a 
program.  Say, perhaps an HTTP proxy server that mangles content in some 
specific way.

Bonus points for including some tests.

> If they know enough about it to judge my skill, then they must already 
> have the skill, and therefore they don't really need me.
They may well have the skill, just not enough of it.
> On the other hand, if they don't know enough about it, then what are 
> they going by? Neatness and penmanship? Comment lines that document the 
> thing? Or will they actually install it and run it and see if it works?
They might, but more than likely not.  I would judge based on how easy 
it is to understand, and how well it demonstrates knowledge of CS 
fundamentals - using the right data structures or algorithms for the job.
> Will a snippet suffice? I don't want to give them a fully functional 
> copy of anything, because I don't want to give away the goods. They have 
> to pay for that. But if it doesn't function, then they will think I 
> can't write code. I could give them something that has a require() in 
> it, and withhold the required subprogram. It won't run, of course, but 
> at least then they can't rip off my blood, sweat and tears. 
Pfft!  I wouldn't worry about that.  Samples need to be small enough 
that one person can read and understand it in less than, oh, say 5-10 
minutes.  Such programs aren't worth ripping off, even to the unscrupulous.
> But okay, assuming I decide to give them something self-contained that 
> actually does something functional, what would be sufficiently 
> impressive? How fancy does it need to be? Should it hook up to databases 
> and send out emails and spiders and have password protection and whistle 
> the Star Spangled Banner backwards? Or will a simple webform backend 
> that says "Thanks for your submission" suffice?
If it's a web service you want to submit, I'd suggest sending the code 
along with a URL where they can play with it.  They're probably not 
going to go to the trouble of setting up a database and obscure mod_perl 
configurations themselves.

Perhaps something like your average site registration thing would be 
about right: they fill out a form, get a URL in the email that they have 
to click to complete the registration.  Covers quite a lot of ground 
while being an easy problem to define.

More information about the Pdx-pm-list mailing list