Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3986278
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:59:33+00:00 2026-05-20T05:59:33+00:00

I’m currently designing a complex website that needs to support Undo and Notifications for

  • 0

I’m currently designing a complex website that needs to support Undo and Notifications for CRUD operations.

By Undo, I mean that the user may create/modify/delete an item and then decide to cancel what he did (therefore removing the created item, restoring the previous state of the modified item, or bringing back the deleted item). He can do so for a short while after doing that operation (the timeout is 2 minutes, because the system is fairly complex and it may take some time for the user to notice that the modification was incorrect).

By Notifications, I mean that when an item is created/modified/deleted, other users that are interested in that item will receive an on-site notification (the next time they load a new page) and will also receive an e-mail or SMS notification if they asked for it.

Getting either feature done is simple: Undo involves keeping undo information around (old version of modified or deleted items, mostly) while Notifications are as simple as pushing a notification object into the appropriate tables and sending an e-mail/SMS on the fly.

Getting them both to work together creates a lot of additional complexity because Notifications must remain in stasis until the Undo becomes impossible, and I don’t have enough hindsight on the matter to design it in a sane way.

What would be patterns, best practices or pitfalls to avoid when building such a system?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T05:59:34+00:00Added an answer on May 20, 2026 at 5:59 am

    Based on a bit of experimenting both in thought and in code, I managed to extract a series of principles.

    • The user may cancel the operation by clicking the cancel button, or by performing the reverse operation (such as deleting his comment). From a notification standpoint, there’s no reason to treat these two situations differently.
    • Notifications for the same object that happen at about the same time should, as much as possible, be grouped together: there’s no point in displaying “A commented on your post” … “Z commented on your post” instead of “A, B … and Z commented on your post”. As such, creation and deletion notifications should be grouped together according to grouping rules: if they’re sufficiently close together, they cancel each other.
    • Because of the possibility of cancellation, never send notification e-mails straight away. Wait for two minutes instead. If the operation is canceled, the creation-and-deletion group rules will delete the unsent notification while it’s still pending. Of course, if the user is currently connected, you may display notifications in real-time because unlike e-mail, real-time notifications can be “taken back”.

    Based on these principles, I decided to architecture two distinct layers on top of the data access layer:

    • A set of semantically significant operations such as “post a new comment” or “delete a comment” which are then wired to send out notifications.
    • A definition of undo-enabled operation pairs : the “undo” aspect of “post a new comment” is “delete a comment”.

    This way, operations always pass through the basic set of operations and thus trigger notifications that are agnostic of whether they are caused by canceling an earlier operation or running its inverse operation manually — the system cleverly handles multiple notifications about the same object by grouping them together and letting them cancel each other out.

    Conversely, the “undo” facilities merely call the code from the semantic layer, without requiring any knowledge about the notifications being sent out.

    Obviously, there will still be a little amount of coupling, because it sometimes is necessary to add a semantic operation only because it’s the “undo” inverse of an existing operation. For instance, one can cancel the creation of a discussion, but cannot delete the message once it is sent (because there might be replies on it). So, a cancelDiscussion function might exist where a deleteDiscussion is unavailable. I suspect such situations are rare enough to safely accept.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.