Re: How to stop a User from clicking submit button(An interview question)
Posted By:
Robert_Lybarger
Posted On:
Thursday, May 29, 2008 06:30 PM
This is a standard configuration management system (CMS) issue. The app in question needs to be designed, ahead of time, with some concept of a "lock" on the user's information. When worker #1 accesses the info in an "edit" mode, they effectively lock that record (which probably means a flag in the database for that user). When the second worker tries to access it for editing, they are denied, preventing an overlapping change. Now if the first user takes too long, the system needs some way to decide they no longer have a lock. This might be a simple timer (get your work done in five minutes or start over) and/or might involve the ability to steal or reassign the lock to another person (with appropriate notice to worker #1 their lock has expired or been taken, denying them the ability to save information. The exact implementation details are left as an exercise to the system architects. (You might also look into how some software version control systems work, since it's the same sort of idea.)