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.



Posted on May 11th, 2011 in Team Development

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

    can I take a look please?

  2. IDS Wireless alrm June 18th, 2022
    23:14 GMT

    Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point.
    You clearly know what youre talking about, why waste your intelligence on just posting videos to your blog when you could be giving us
    something informative to read?

  3. friv August 12th, 2023
    12:50 GMT

    Fantastic beat ! I would like to apprentice while you amend
    your web site, how could i subscribe for a blog web site?
    The account helped me a acceptable deal. I had been tiny bit acquainted of this your broadcast offered
    bright clear idea

  4. bucket hat June 23rd, 2024
    10:01 GMT

    Very quickly this site will be famous mid alll blog viewers, due to it’s pleasant content

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 ( 13 + 7 ) and SUBTRACT two ?
Please leave these two fields as-is:

Talks (View on YouTube)