We will be conducting interviews in the very near future. As I find asking technical questions to be a poor gauge of whether a person actually knows something, or just "studied" for the interview, I was thinking of conducting a simple code review during the interview. Overall I would try to keep the exercise to 5-10 minutes max.
Specifically, the format that I am thinking of using is to have two small classes (~20 lines perhaps, one in C# and one in JavaScript) that will include 5-10 "issues". These issues may range from simple things like poor variable names, to missed dispose calls on an obviously named MyDisposableClass object or something to that effect and up to things like modified closures or threading issues. I think I would likely use two samples, one for C# and one for JavaScript (since so many people say they know it and really don't).
My goal is to see how the person approaches the task, how they explain their thoughts on what is good/bad with the code and ultimately, see what issues they identify (idea being some should be targeted towards junior, intermediate, senior etc).
Has anyone conducted this type of exercise in an interview? Did you find it worked well for you? Any pitfalls that I should be aware of? Why types of "issues" do you think would be appropriate to include in the code?
As always, your thoughts are greatly appreciated. Thanks!
Edit
Awesome feedback everyone; thanks!
I spent 30 minutes this morning putting together my JavaScript "code review" code; I am not including any details on what is wrong with the code (there are some petty items, but also some major design issues). Any feedback would be appreciated
function CustomEvent(obj) {
_handlers = new Array()
this.subscribe = function (fn) {
var suscribed = null
_handlers.push(fn)
}
this.unsubscribe = function (fn) {
var temp = []
for (index = 0; index < _handlers.length; index++)
if (_handlers[index] == fn)
temp.push(function () { _handlers.splice(index, 1) })
for (index = 0; index < _handlers.length; index++)
temp[i]()
}
this.run = function (e) {
for (index in _handlers) {
try {
_handlers[index](obj, e)
}
catch (ex) {
Log.error(ex) //Assume Log is a global static utility class
unsubscribe(_handlers[index])
}
}
}
this.dispose = function () {
_handlers = new Array()
}
}
C# Class to be added later today when I have some time to put it together.