Nick Hodges recently had a post on FizzBuzz (http://www.nickhodges.com/post/Fun-Code-5.aspx) as an interview question. It dawned on me one of the strategies that I use in my interviews which is a very small filter question to weed out developers who really I don’t think have the thought processes to develop. In summary the question normally looks like this in Delphi:
procedure PutOperation1(n1: double, n2: string, answer: integer)
answer = StrToIntDef(n1 + n2)
I want to be clear. This function is wrong in so many ways but thats its core purposes. Its amazing how many how many people don’t know how to think about a thing as simple as a function.
The things that this picks up is:
1. One of the other thing you might get is someone who just doesn’t know the language. It is quite common for someone to apply for a job that knows programming, but doesn’t know the language. This test will filter those people out. Its amazing how things like Semicolons, := and other things are there to trip people up.
2. That they should understand the calling conventions
3. That they should understand how to convert between data types
4. That it should be function and that having it as a procedure is bad form.
5. That the procedure should be named appropriatly; or
6. That people should expect to know what it is supposed to do when they look at the function and then realise that the whole purpose of the function is to add two numbers. A smart person will say that it serves no purpose and you should just add the values from where you are. They may ask whats the point and thats a good sign.
A suprisingly simple test, but its amazing how many people it clears out. You then have other questions on a range of topics from testing, refactoring, OOP and then platform specific issues and a slew of others, but its an interesting point I thought I’d share.
I have C# versions of this that I use, but its amazing how something simple can get to the point.