The Iffy Tractor (Can they code OO?)

A Simple OO Refactoring Problem That Can Be Solved in under One Hour

When interviewing developers I like to use have a variant on the Rover problem (posed by Thoughtworks during their interview process) . The main difference is that the problem is specified as an existing class that needs refactoring. (essentially it’s a ‘Replace Conditional with Polymorphism’ refactor) and, as such, can be done in around 30-45 mins.

The problem is named “The Iffy Tractor” and you can download the full source for it here: TheIffyTractor or take a quick look at the main class here. It consists of a single class with a test that moves a tractor around a field. The class contains a few large ‘if’ statements that offer a variety of opportunities for the candidate to show off their OO skills. In addition the problem of rotating through the ordinals N/E/S/W to track direction presents a pleasant problem that has a variety of interesting solutions.

It helps to keep the scope of the problem small. It’s easy to get to grips with and start refactoring meaning that you can get something significant out of the candidate in under an hour. Its downside is the outcome is affected by weather you’ve used the refactor before and you can see that in the candidates approach (the test worked very differently in India to in the UK). I don’t find it matters that much though. You just have to interpret the results differently.

Like all tests it’s hard to say for certain how accurate or useful they really are. However the results from different candidates has been varied so they are at least a useful yardstick that provides some empirical measure of the candidate’s ability.

 

TheIffyTractor

Posted on May 11th, 2011 in Team Development


  1. Seb July 30th, 2014
    14:43 GMT

    can I take a look please?

Have your say

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>




Safari hates me
IMPORTANT! To be able to proceed, you need to solve the following simple problem (so we know that you are a human) :-)

Add the numbers ( 5 + 2 ) and SUBTRACT two ?
Please leave these two fields as-is: