My school programming club is setting up a tutoring program. We have 12 tutors who specialize in a range of different languages, and each is available for a different set of hours each day of the week. I want to set up a web interface where students can select the language they need help in, and then be shown a list of the time spans each day that there is a tutor in that language available to help them.
My main question at this point is how I should go about storing tutor availability data – should I use a database (and if so, how), or should I simply store availabilities as fields in POJO “Tutor” objects. If the latter would be best, what data-type should I use? Can I get by simply storing them as strings or should I use joda or java.util Date objects? The task that seems particularly tricky to me at this point is combining availabilities of multiple tutors into a single time-span for each day – i.e., if I have one tutor available from 10-2 and one available from 12-4, I want a single line saying “10-4” to be presented to the user.
I’m just beginning to design my approach to this task, so I’m very open to general suggestions and/or having unforeseen problems pointed out to me.
I would like to use a Java JApplet as my web interface.
2
In a tutor availability table store triplets of tutor_id, start_available, end_available with the latter two being some sort of date/time.
Have a query that joins from tutor availability through the tutor_id to a table for specific skills, and returns that availability information sorted by start_available, then end_available. Do the merge in code. (If you really want you can push that to the database using analytic queries, but you’ll probably find code easier.)
The details of converting between the database representation and an in memory representation that you can easily manipulate are up to you and your ORM. I am not personally a Java programmer, but http://blog.nemccarthy.me/?p=207 suggests that joda is a reasonable option.