In Part 1, Christopher pointed out that since we all spend a lot of time maintaining and fixing code, a good interview test is to have people fix up some smelly code.

Since I couldn't possibly agree more, I wrote a smelly codebehind page as an example of the type of test you might ask a potential candidate. I wouldn't expect someone to catch ALL the issues, or even agree with me that something actually IS an issue…but there are certainly some key items which should be fixed, and others which should atleast we discussed.

You could ask them to rewrite the code. You could ask them to talk about what they'd do, or number issues and provide a corresponding numbered list of suggestion/comments

I'll post my own "solution" to this "problem" next week

The test…

We have built a very simple page where clients can search our list of products by category. There are two ways to change category, either via a dropdown on the page, or by passing a categoryId in the querystring (so other pages can link directly to a category). There isn't anything functionally wrong with the site and we love the look (i.e, don't waste time changing how it looks), but the code is a little messy and we'd like to clean it up. There are no tricks or secrets. Here's what the page looks like:

Here's the codebehind file:

span.kwd{color:#22F;}

span.obj{color:#008080;}

span.str{color:#811;}