I’m working on project that lets users choose some scientific authors and columnists and track their activities. Users can track authors activities either by :
- Choosing the author explicitly and then tracking him
- Choosing a channel (a list of authors that some other user tracks) and track the entire channel
Or
Here’s how the schema of the DB looks like (in regards to this specific use case only)
DB Model http://img526.imageshack.us/img526/7278/dbmodel.png
This design should be O.K. in case the user clicks author by author to track, the insertion goes into the DB quickly, and the UI animates (using Ajax via Jquery) indicating the success or failure of the process.However, if the user selects a channel, things will differ. Here’s what I came up with, when the user selects a channel I extract all the authors out of this channel and then insert new entries in the Users_Authors table. Now imagine that the channel contains 1000 users or more, the insertion should take some time, and the animated GUI won’t be as fast as desired. So, would anyone recommend any other way to improve this(even if I had to change the entire design).
Thanks
One thing you need to ask yourself is this:
If the user selects a channel of 100 authors and that channel changes, should those changes flow through to the user? The answer to that question will largely determine the design.
If you want automatic flowthrough then don’t copy authors when the user selects a channel. The design needs to accommodate a channel subscription.
In OO terms a User has zero or more Subscribables, which is a parent class to either Author or Channel. A channel has a one to many relationship to authors. The entity representation is basically the same. You just need to make what’s subscribed to a parent of both entities.
If you don’t want to flow through changes you need to either version the channel or do what you’re doing: copying authors from the channel into the user’s subscriptions.