Quote:
|
Originally Posted by r937
no offence to you personally
|
I take no personal offence - I enjoy technical / design discussions such as these. I hope you don't mind if I don't agree completely with your opinion either
Quote:
|
Originally Posted by r937
consider a hotel reservation system, and let's try your method
|
There's a big difference between the analogies we are making. You are talking about a hotel reservation system - which obviously needs to keep certain rooms reserved (or locked) from use. Yes, I will know 6 months in advance of December that I wish for room 10 to be free. But leeand00 is actually talking about entering bible verses into a database.
I'd be surprised if his users will be saying, I'd really like to enter Matthew Chapter 3 Verse 16 in 6 months time - could you please make sure noone enters it before me (even though it is a popular verse). I thought the problem was more that the collaborative effort of entering verses into a database would eventually lead to two people trying to enter the same verse at the same time. I didn't think we were trying to create a bible entry reservation system.
Your suggestion would cause the following:
1. User A wants to enter Matthew Chapter 3 Verse 16
2. [Database checks that verse is locked. If locked - throws error. If not locked - locks verse by placing userid on database record]
3A. User A finishes entering verse
4A. [Database saves data entered on verse, and removes locking userid from database record]
OR
3B. User A cancels entering verse
4B. [Database removes locking userid from database record]
OR
3C. User A closes application without saving / cancelling changes
4C. [Database does not know that user has finished with verse, so lock stays]
In the example above - how would you suggest we deal with 3C - a lock on a verse that is not being removed by the user? You would either need someone to clean up the lock manually (remove the userid from the verse record) or some kind of periodical process that removes locks that are not in use.
leeand00's database will be giving the users the "next" verse to enter in the system. For example - let's say that 21 verses have already been entered:
Your method
1. User A logs on - and is assigned verse 22. This verse is flagged as "taken".
2. User B logs on - and is assigned verse 23 (as verse 22 is already taken).
3. User A cancels from the application (verse 22 is not entered).
4. User B completes entering verse 23.
5. User C logs on - and is assigned verse 24 (as verse 23 has been completed).
Result - Verse 22 was never entered - and will not be assigned again (as leeand00 stated that the application would automatically assign the next verse to a new user)
My method
1. User A logs on - and is assigned verse 22.
2. User B logs on - and is assigned verse 22 (as verse 22 has not yet been finished).
3. User A cancels from the application (verse 22 is not entered).
4. User B completes entering verse 22.
5. User C logs on - and is assigned verse 23 (as verse 22 has been completed).
Result - In this case - verse 22 was correctly entered - and we do not have a missing verse from the list.
All that leeand00 is trying to prevent is two users attempting to insert the same verse. Although this is a highly unlikely event (as it takes no more than a minute to type in a verse) - we can prevent it by double-checking that the verse has not been entered. I don't feel that it is necessary to add a "userid taken" field on the table to keep track of who has been "assigned" which verse. This is a much easier solution than trying to implement a locking system on each verse of the bible.
(sorry for the long post - just trying to make sure I'm not too vague)