My favourite interview question(weblog.raganwald.com) |
My favourite interview question(weblog.raganwald.com) |
What a refreshing statement at a time when we're bombarded with so many annoying "SQL is Dead" posts.
Try designing an enterprise production/distribution system where:
- set-ups must be minimized
- backlog must be minimized
- inventory must be minimized
- trucks must be full
- warehouse space is limited
- deliveries must be on time, but not too early
- sales people must have stock on hand
- plant absorption must be maximized
- bills must be paid on time
- down time must be zero
- working capital must be put to the best use
- stockholders must be satisfied
Say what you want about enterprise programmers, but they get stuff built that handles all of these while academicians fuck around with linear algebra and OO castles for years.After this, Monopoly sounds like a day off. Great post!
We all stand on their shoulders... it's fine to give em a good kick every so often but remember who is holding us up.
As a trained mathematician, I wish I could agree with you and cite all the wonderful applications of classical thinking that I've used to solve real enterprise problems, but alas, I can't. It was only after I abandoned the constant search for "elegant" solutions to real world problems that I was able to embrace good old fashioned "blocking and tackling" to solve the problem at hand.
I've lost track of how many times I was challenged to "use the simplex method" to attack multiple simulaneous mutually exclusive constraints when the most effective approach ended up being, "Put all the data into a relational database and keep spitting it out different ways until our people figure it out." The scientist in me wishes it wasn't true, but the pragmatist knows better.
Sorry to dump on the academic world so much, but I suppose I wouldn't if I could cite more success stories.
The Monopoly example just struck a nerve; a classic example of the difference between theory and practice.
What makes the game fun? Part of it is the interaction between players, laughing, joking, scheming, and posturing. How do you bring that to a game played over the net? Is text chat sufficient, or can you easily do voice? What do you display to the players? Certainly part of the board needs to be displayed. When I play, I like to see what people have for properties and money. Will I be able to see that Alice has a stack of $500 bills or that Bob has nothing larger than a $50?
The original question is a very cool thought experiment, imho. My initial reaction was that to design this, I'd want to sit and play some games of Monopoly to see what to include and to see what the game is really all about. I've played hundreds of games of Monopoly, but that's not the same as designing a fun game to play over the net. Running through this little thought experiment helps raise many questions about how the game will work. Does each player have a complete client, or is this a server based system (or is it somewhere in between)? How do you handle dice rolls? How quickly can people start a game?
You need to know what you're going to create before you start applying tools to create it.
I think this is a great reason why most interviewing techniques fail. The interview is not a reliable model of the work environment. This is especially true given the fact that people love "gotcha" interview questions which are essentially brain teasers which require you to know some arcane trick to get the question right.
I have seen great candidates spend a lot of time trying to understand a simple problem in an interview. These are people who under normal working conditions would never waste tons of time trying to get a perfect spec before starting work. But, because of the types of interviews people try and pass over as being "reliable indicators of future performance" candidates get stuck trying to find the trick in each question. If you have a candidate spend their entire interview trying to tease out a spec it sounds like a better indicator of the low quality of the interviewer rather than the candidate to me...
When people start heading that direction in an interview, be sensible and say, "Do you feel like you need a complete spec before going on? I promise there's no trick I'm trying to get you to fix" and you'll get the response you're actually looking for.
I don't know how long your interview is, but if its just an hour and if the game is as ambiguous as you seem to say it is, I think its the fault of the interviewer, not the interviewee. The interviewee doesn't know what your schedule is -- unless you tell them, "You must code monopoly by the end of this hour, warts and all". But otherwise, I think its reasonable to take the full hour on requirements. In real life, an hour on requirements doesn't describe if there should be a splash screen or not.
Or don't even pick a game; I love "design an elevator control system". Most anyone looking for a programming position has interacted with one at some point in their life, and while you could easily mire down in details, it's not so complicated that you couldn't give it a fair hearing in the context of an interview.
There's a million things like this in our everyday lives that make great fodder for mental exploration in an interview.
One of my first Uni projects was to write an elevator control system and as you say, it's very revealing.
That's the pattern to all this, rules and exceptions and how easy it is to change those rules (because they change constantly).
So do you put all that into your SalesPerson object or is there a better way to abstract the logic of commissions?
Monopoly is not just an external entity, it's a pretty big one with tight cultural ties. If the candidates you interview were not born in the same country as you, the best case scenario is that they played Monopoly in a different language and the worst case scenario is they never played it.
I prefer to focus my interviewing on questions that rotate around pure coding (if that's what the candidate is interviewing for) and even then, I hardly find the time to dig as deep as I'd like.
http://news.ycombinator.com/item?id=2063092
;-)
I don't remember if "fun" was specifically discussed, but the discussions were more focused on what users would do and see, very much in keeping with your second paragraph.
The product manager was also asked to consider the exercise from a competitive perspective. What could be done to differentiate a new site from an existing, popular site? is the strategy to be simplere and easier? To cater to power users running into limitations of the existing site? And so on.
I develop s/w in an R&D environment. My users are very specific about how they use information, but know almost nothing about s/w development. Likewise I know little of their specific domain, but can develop whatever tools they need. While I can craft and code algorithms that should dazzle them, if it doesn't solve their problem they won't use it. For me, design has to account for the users' experience as well as developing clever and efficient algorithms to solve problems.
I really love the original question, Reg. It was fun.
There's not really a good digital equilvalent to this, but that's the tricky thing about monopoly: the things that set it apart from other games are the hardest to transfer to a digital analogue.
This reminds me of the ongoing quest to make a popular online version of Cosmic Encounter. I grew up playing the paper version with every expansion. There were so many aliens to be (and we frequently played with two/person) that the dynamic was different every game. But to add a new power to the digital version can require a whole new set of rules, and so they always fall startlingly short. [as a brief example, the Filch power, when coupled with it's power card, allowed you to cheat by secretly taking cards from the discard pile and whatnot until you were caught - this is nearly impossible to accurately mimic digitally]
When I'm only doing average or not so well as I want to let on I make sure I have my 1000s on the top of a large stack. When I'm clearly leading I spread all my money into individual stacks so that people can clearly see that I'm far in the lead. The same goes for properties. Especially when I have stuff built on them. Anything with the most value is up in people's faces unless I'm slightly behind the curve where I obfuscate what I have to not seem a threat. (Games of monopoly often turn into horse trading in the late stages.)
Translating that online would be hard. Fun but hard.
Secondly, rules do have state, in so far as one rule is distinct from another. Perhaps a rule has preconditions (which could be represented as a binary tree and evaluated through recursion) that must be true before the rule is "active". Perhaps rules have effects, a list of state changes that they impose on the rest of the game world. You could model these as functions, or alternatively again as trees, evaluated through recursion. If the rule system needs to be flexible enough, they could be serializable and deserializable from a text or binary format.
If the game is a simple one, with a fixed set of rules that never change, there's little need for this. But if you look at a game like Monopoly, there's a lot of complexity that comes up in real-life games that isn't so simple to encapsulate in rule lists, such as making complex deals, haggling, borrowing money from other players, even receiving charitable donations from other players to prevent the game ending prematurely.
Move further into business rule systems and the need for flexibility increases again. I've architected systems which needed a generic rule-based system for data validation and workflow transitions; and these rules had themselves rules for when they applied, as older rules needed to be grandfathered in to older data, but expired for new data.
On the other hand, the way in which you think of mathematical entities can be very important and useful, particularly in thinking of things in terms of constraints and preconditions and the resulting guarantees the code can make. Again, not in a flat-out "code proof" sense, but as a way of approaching the code. This has allowed me to write some surprisingly capable code in a multi-team setting by carefully considering the minimal requirements I can impose on the other teams to get a desired result, then making sure I enforce those requirements carefully (since I am in a language where I can't do it with a type system), and then on those basic promises build another layer of the system that is the thing I am actually working on. If I came at this with a hacky hacky chop chop approach it would fail... just as the previous effort did, ahem.
Also, in programming as in math, a thing is what it does, profoundly. This can take a long time to come to grips with. A typical programming entity "is" quite a bit more than your typical math entity, though, for better and for worse.
Preconditions, postconditions, and constraints also make great testing fodder, by which I mean, they make great practical testing fodder. Writing code in practice is a lot easier if you have some assurance that those things are actually true.
I don't necessarily even sit down and sketch this all out, again, because being too rigid causes your rigid assumptions to break, but this stuff is always in the back of my head, and it will get you quite far once you master it....
... and I say that in general. edw519 I wouldn't care to second guess how you're doing things at this point. :)