views:

218

answers:

2

Calendar should have functions like,

User should be able to set an appointment based on time and date.

Calendar will warn user if a conflicted appointment occur.

Please describe what Classes, data structure and design pattern you will use.

+2  A: 

At first glance, there would be an Appointment class that would consist of a date, time, title and description. Would there be the need for recurring appointments? Would there be reminders? There are lots of questions in terms of digging out the requirements here that would lead to a few discussion points.

Another point here is that this would be similar to Chandler, so I would consider looking at their code for some more ideas of what would be needed.

JB King
+2  A: 

There's no right answer. If I asked this question I'd be looking for the interviewee to do things like:

Draw some pictures (or write some code, or verbally describe -- but I'd prefer pictures) some classes and how they're related. Probably an "appointment" class that contains a start time, a duration, perhaps location, and a user. Any other classes?

Discuss how you'd store these appointments to retrieve them in ways you'd want them. It would be nice to know how to get the set of appointments for a particular time span for a particular user -- what data structure (or database design) would you use to make this feasible? Could you use, for instance, some sort of tree structure that breaks down time spans recursively and could contain these appointments?

Then like I said in my comment, start talking about more complicated scenarios -- recurring appointments, like JB King mentioned, are a great example. Multiple users, or multiple calendars per user, and so on.

I think the trick to answering this question is to just get started talking about what you would do if you actually had to solve this problem in code: how would you start? Break down the problem and change it from a vague question to a concrete one so you can attack it.

Moishe