A Simple Code Sample
September 20, 2009

First thing's first, my company is hiring iPhone developers. If you are an experienced iPhone/Cocoa developer, please contact me. Please.

Recently, we have been getting a decent amount of resumes to apply for a position at 9mmedia. One of them was interesting in that the potential candidate sent in a test that another company was sending out to weed out people: PDF Link

Basically the requirements for the 'long' test was to write and display a plist of any type and length. This means a number of things: you have to support every single plist type, it could be of arbitrary depth (which makes for some curious display decisions) and your reader most certainly needs to be recursive. It's a somewhat interesting question in that it somewhat encapsulates what most people would ask a candidate in an interview situation.

Of course I think that this wouldn't be the be-all-end-all of interview questions as the algorithm is quite simple. As long as it is recursive and pops out views you're all set to go. The display approaches are more interesting -- most people would either go with some sort of UITableView/UINavigationController based approach with what I would expect would be GroupedViews or views with headers to encapsulate a NSArray, for example.

Since I was interested in how long a relatively experienced iPhone developer would take doing this kind of question I took the test myself. The version that I have posted to my github (link below) took me about 85-90 minutes to finish, and I am sure if I hadn't been working all day it would have been a lot faster. I am surprised that the PDF indicates 'no more than four hours. I don't think I would hire someone who would take so long on a problem like this!

I decided to take the approach of a UIScrollView with text only -- I thought a UITableView/NavController would be too many taps usability wise and would doubtlessly take actually more time. I set up the scrollview to scroll horizontally so if the output goes outside the bounds of the screen you will able to see the results as well. Finally, for a small visual touch I gradient the first 5 levels so they are easy to read. I wasn't particularly interested in finding the max depth first and decided to just assume that most plists don't go very deep.

Anyway, the source is located here: GitHub - Random Crap. Let me know what you would do differently with this problem!

PS: We didn't hire the person who sent his challenge code. Didn't even run. You'd think people would test this stuff first!

<<  Back