• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S: Record Locking

 
Muhammad Shafique
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi There,
I have two buttons (Book, Release) on my client GUI. User need to click on Book to enter owner ID and Release to clear it. Since these are changes in DB so we should lock record first. I am thinking about two approaches:

1- When use click Book or Release button, first lock the record (if its unlocked) and when (s)he is done, unlock automatically.

2- Have a separate lock button for locking record. User first should click on lock button to Book or Release record and then Book or Release should unlock after doing necessary changes.

What do you think, which approach is better? OR please let me know some better idea.

Thanks!
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would the user need to know about the internals of record locking?
 
Muhammad Shafique
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to current requirement, we can hide this from end user or can set a timer in update method to wait and try again before sending failure message to end user.

But in future, if CSR is responsible to update other fields e.g rate, size etc, it may be annoying for him to recieve a failure message after entering all values.
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In that case you may want to go for pessimistic locking, and start the lock when the user selects a record for editing rather than when he chooses to commit his work.

Never should he need to do so himself though.

You're thinking of your implementation in terms of the actions the software needs to take internally, when you should be thinking of how the user does his work.
First do that, and only then try to figure out how to map those user actions onto software operations.
That's the only way you're going to end up with something approaching a decent user interface (approaching, as there are other factors involved like colours, keyboard shortcuts, control flow dictating control location, etc.).

It took me quite a while to figure out such things, but after a decade writing software (and most of it for end users) I'm starting to get it.
Mind this is no criticism of you or anyone in particular (unless it be people teaching software engineering for not spending enough time on teaching user interface design concepts), it's just a general rant on the follies of the techie brain and the way it is often incapable of thinking down to the level of the end user and the way he perceives his work (rather than the way we techies see it).
 
Muhammad Shafique
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jeroen for your detailed and quite helpful comments. You are an active and helpful member of this group!

To make it more simple and easy for end user, I decided to lock record before entering the value of owner ID and release it when that operation is done. It's easily extendable to whole of record since update operation is same and we call is once for all fields.
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure you have some way to remove stale locks, especially since you've chosen a potentially long lock period.
What if someone selects a record, at which point you lock it, goes out for lunch in town, gets run over by a truck, and spends half a year in hospital?
That might be extreme, but you get the idea
 
Muhammad Shafique
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
End user should be kept away from tech details but there are some scenarios where you can't do that. That�s why we have end user training like things. BTW, thanks for helping to get a better decision.
If someone is run over by a truck, (s)he may not be able to spend half a year in a hospital
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic