1

There are 2 entities. One is admin. The task of admin is to define slots for appointments which will be taken by applicants.

The admin will choose a default time for the appointments like 10am to 2pm and then 3pm to 5pm.

Now the confusion how to save this information in database.

  1. In a single row which contains start date and time and end date and time and number of applicants allowed for that time slot.
  2. Create multiple rows with each date and time slot. Like if there are 2 slots for 15 days then

day 1 10a - 2p

day 1 3p - 5p

day 2 10a - 2p

day 2 3p - 5p

.....

Which will be a better way to save the appointments?

The second way offers flexibility to edit the appointments but will take multiple rows.

The first way saves rows but is complicated when editing and adding or deleting special slots.

1

There are 2 entities. One is admin. The task of admin is to define slots for appointments which will be taken by applicants.

  • admin sounds more like an user that an entity. Of course, user may be an entity (or not if your model does not incorporate authorization information).

  • I see many nouns there : "The task of admin(user) is to define slots for appointments which will be taken by applicants". Why do you think you only have two entities?

Note that I am not saying that any noun should be an entity. Maybe some nouns can be expressed as a relationship. And maybe some nouns are not specific enough and should be represented by several entities. But it is a good rule of thumb to begin the search for entities.

Anyway, it seems that you may think more about your model.

  • I have used the word wrongly. I used the entity word to define who will be changing the other objects in the system. These two are the only one who can change the state of the system and others (slots, appointments) will not be active. Yeah the admin is an user not an entity. But the question still remains, which pattern to use? – t0mkaka Sep 2 '14 at 12:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.