Concrete problem, reporting system to help our boss make fantasy baseball (or other random sport) choices. Your responsibility will be the schema and reports, I'll be responsible for getting data into your schema.
Reasonable requirements that often require changes to an initial schema:
- What happens if I'm trying to update data but I only get partial data, how am I supposed to fix that? (A surprising fraction of people denormalize data too early.)
- Can a player play two different positions?
- Can a player transfer teams from one season to another?
- Can a player transfer teams in a season.
- Can a player change names? (If we threw this one at you, then you probably had a very good schema!)
And then reasonable questions to test their SQL would be things like:
For an idea of how hairy this problem can get when you attack it "for real", take a look at http://sportsdb.org/sd (click the schema diagram on the right).
Those questions may be good for grilling candidates, but it is not how one would sketch up a fantasy game irl. The right answer to all those questions are YAGNI and KISS. :) But those answers aren't valid so the questions seem to be rigged against the candidate as in "come up with a schema similar to the one I would have designed - not more complex than that and not more simple". I've seen way to many situations in which developers or other persons tried to design a complete schema in which every thinkable and unthinkable instance where covered. Which leads to an incredible amount of work implementing the application that is to use that schema. The more complex the schema, the more complex everything around it has to be which exponentially increases the amount of bugs.
Designing applications "schema first" is a disastrous technique which will trigger the architecture astronauts in every developer. With your set of interview questions, you could very well miss a really skilled programmer because he or she understands that keeping stuff simple is hugely more important than not having denormalized data in the database.
Those questions may be good for grilling candidates, but it is not how one would sketch up a fantasy game irl.
Data point. This problem was suggested because one of the developers wrote that exact application as a weekend project, and that was exactly how he designed it - schema first. He noticed that it was both simple and interesting, and therefore was a possible fit for interviews.
The right answer to all those questions are YAGNI and KISS. :)
Believe me, I'm aware of that. Our favorite interviewees had answers with both of those characteristics. However a major source of real life complications is when YAGNI turns into, "oops, we did need it". And we were actively looking for how people handle that transition, so we asked the questions anyways.
Interestingly, the right brand of KISS made that easy. But that is a different topic...
But those answers aren't valid so the questions seem to be rigged against the candidate as in "come up with a schema similar to the one I would have designed - not more complex than that and not more simple".
ALL interview questions are "rigged against the candidate". You know them, you know how they work, the candidate hopefully does not. The goal is not for the candidate to get the "right" answer - it is to see them exercise their skills. This is doubly true of open-ended design questions, which this definitely is.
I've seen way to many situations in which developers or other persons tried to design a complete schema in which every thinkable and unthinkable instance where covered. Which leads to an incredible amount of work implementing the application that is to use that schema. The more complex the schema, the more complex everything around it has to be which exponentially increases the amount of bugs.
Absolutely. One goal of this question was to identify and reject that kind of developer. I think we did a pretty good job at it.
Designing applications "schema first" is a disastrous technique which will trigger the architecture astronauts in every developer.
You apparently know only incompetent developers.
My experience is the exact opposite. Competent developers will come up with simple schemas that solve the requested problem in a straightforward way. Furthermore when you're given a complicated spec for something you're supposed to build, the act of trying to lay out a schema for that spec is an excellent way to smoke out inconsistencies and hidden assumptions about how the application is supposed to work. Taking these back to the product manager lets you clarify things before you start writing code.
Once that is sorted out, you have your data store designed, your front end in the spec, and a pretty reasonable idea how every layer between is likely to work. Finishing off a basic CRUD application from there is fairly routine.
With your set of interview questions, you could very well miss a really skilled programmer because he or she understands that keeping stuff simple is hugely more important than not having denormalized data in the database.
ANY set of interview questions is going to miss some really good programmers. For that specific team, the ones missed would generally have not been a fit in how that organization worked.
I've given the question to people who know nothing of sports. The relevant sports facts take very little time to explain, and I've found that familiarity with the sport does not generally provide an advantage. (Excepting the interviewee whose first response was that his master's thesis had been on this exact problem. However he proved good enough as an interviewee and an employee that I think he would have done well regardless.)
The relevant facts are that there are teams. There are players on the teams for a period of time. Teams meet on particular dates and play games. In each game, a specific set of players are present. Each player does things that are tracked (comes up to bat, hits home runs, etc).
This is enough domain information to solve the interview question.
This sounds a lot like the traditional "design a music database" that we used to use as a test question 10 years ago. It's easy to make a single song db, but once you include compilations (album artist different from song artist), classical (composer and conductor are important; songs have movements or sections), and soundtracks, things get more complicated.
Reasonable requirements that often require changes to an initial schema:
- What happens if I'm trying to update data but I only get partial data, how am I supposed to fix that? (A surprising fraction of people denormalize data too early.)
- Can a player play two different positions?
- Can a player transfer teams from one season to another?
- Can a player transfer teams in a season.
- Can a player change names? (If we threw this one at you, then you probably had a very good schema!)
And then reasonable questions to test their SQL would be things like:
- Who played in game X?
- How many home runs did person Foo have?
- How many home runs did team Bar have?
- Sort all players by their hitting average.