I have a problem with an application that I've written. The usage is about to change and now multiple users will interact with the system.

Given that there will be multiple administrators what is the best way to handle the scenario where: Hierarchy of objects

  1. Child 1 is being edited by admin 1,
  2. Parent 1 is deleted by admin 2,
  3. finally after the delete, admin 1 saves the Child 1.

Should I prevent a delete from happening if a child object is currently in use or should I just allow it to happen?

Nothing is actually deleted by the app, only marked as ready for delete.

  • Might be helpful if you supplied an image which demonstrates this.
    – Wander
    Nov 14 '12 at 13:55
  • Added the image to help clarify the issue.
    – Mauro
    Nov 14 '12 at 14:31
  • 1
    Conflicting updates in multi-user database usage isn't exactly the new kid on the block. I'd read up on 'concurrent updates', 'transactions' and the benefits and pitfalls of 'optimistic locking' versus 'pessimistic locking'. Optimistic being where you just go ahead and inform the user something went wrong (doesn't happen all that often in real life), pessimistic locking being where you lock and prevent others from performing updates, possibly on an entire (sub)tree. Nov 14 '12 at 19:52

Although unstated in the question, here are my assumptions about the system's behavior.

  1. Deleting Parent1 also deletes the subtree beneath Parent1.
  2. Changes to Child1 will be lost because Parent1 no longer exists.

My answer is based on those assumptions. Ignore the rest of this answer if those assumptions are invalid.

In the scenario above, Admin1 and Admin2 have conflicting views of the true state of the hierarchy.

  • Admin1 thinks Parent1 should exist because Child1 should exist. This is implied by Admin1 editing Child1.
  • Admin2 thinks Child1 should not exist because Parent1 is no longer needed.

Assuming both admins have the same role and therefore the same permissions on the objects, neither admin is correct or one of them is wrong and about to make a mistake.

As with any design for handling errors, prevention of errors should precede handling errors.

Recommendation 1: Mark the parent to show there is a child in an edit state.
Hopefully, Admin2 will not attempt to delete Child1. This is not a strong recommendation because I've never seen this done well.

Recommendation 2: Do not allow deletion of the parent.
Most systems I'm familiar with (Windows, IDEs) do not allow deletion of a parent when a child is in use or force you to approve loss of the child and any unsaved work in the child. Those systems display a message saying something like 'You cannot delete this object because a child of this parent is being edited.'

Recommendation 3: Undo
If you allow deletion of Parent1 then you should expect Admin2 to be wrong in some cases and the action will need to be reversed. Reversal of 'marked for delete' should handle this situation.

Recommendation 4: A 'Your work has been lost, sort of' message for Admin1
If you allow deletion of Parent1, then Admin2 needs to know the changes to Child1 will have no effect on the hierarchy because Child1 has been marked for deletion. In other words, you need to tell them 'Thanks for all your hard work but Admin1 decided it was not necessary and, although we could have prevented you from wasting your time, we chose to let you keep going.' (That's written tongue in cheek but describes a potential outcome of allowing both Admin1 and Admin2 to keep working independently.)

  • +1 For a really good break down of the priority of your recommendations. I agree completely with this approach and the fact that Recommendation #4 is the last one on this list due it destructive result. Nov 14 '12 at 21:22
  • This gives me different methods of handling the delete, thanks. I'll have to check which one will be most easily validated for GXP but at least I know which applies now.
    – Mauro
    Nov 16 '12 at 16:48

My suggestion would be that you should not prevent the delete operation and allow both the users to complete their tasks. While admin1 is editing and admin2 deletes the parent object then show a non-intrusive popup message (for example on the top of the screen) informing admin1 that parent object has been marked for deletion, so admin1 can decide to continue with editing or discard the changes. If for some reason you cannot show this message while edit is in progress then show the message when admin1 saves the edit.


I wouldn't let the application delete the page if there is another user editing it.

Instead, I would alert them about the simultaneous use of that page (showing the other user's info)... And even offer to send a message to the user that's editing the page. Even though the page is not actually deleted, it would be more trouble for the user to recover it.

Google Docs is a good reference for this, you should check it out.


You could prompt the user who is trying to delete, that other adm is editing the page, and the deletion action has been sent to the admin editing it.

Admin1, who's editing, would receive a non intrusive message, warning him admin2 has request deletion of the page. Admin 1 now has some choices:

1 discard the changes, and approve the deletion now;

2 continue editing, and the approve deletion on the end;

3 continue editing and discard the deletion request

I think it would depend the logic of you app what options to present. But the user who is doing the most laborious work should have the privilege of the decision. In the sample, admin 1


Delete the parent as usual. Save the updated child. Notify admin2 that its parent was deleted by admin1 and ask them if they want to restore the parent.

Edit: Assuming that child objects are tied only to a single parents–as the diagram implies–so that deletions cascade and no orphans are produced, my rationale is that the deletion is a higher-level action that indicates Admin1 has greater knowledge of the situation than Admin2.

Example 1: A company has a list of global offices grouped by country and they are no longer doing business in Canada. Admin1 attempts to delete Canada from the system while Admin2 is correcting information for the (now defunct) Ottawa office.

Example 2: Admin2 is editing a blog entry in a CMS while Admin1 has been tasked with deleting the entire blog from the website.

In both cases, I don't believe it makes sense to prevent Admin1 from proceeding with a deletion just because Admin2 is updating information that has been rendered irrelevant.

I'm sure there are counter-examples. Certainly if deletion produces orphans that must be reassigned to another parent, you should provide Admin2 with a method for reassigning the child they are editing.

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.