Live data from Hacker News

Undo

sachagreif.com

71–80 of 100 posts

Re: Undo

#73
post #9

I would wager that the reason Undo isn't implemented more often is that it is very difficult. Executing a DELETE statement and deleting a bunch of data is simple. Implementing "undo" is more difficult, especially for browser based software. How long is the undo valid for? Can you undo every action? How many levels of undo do you support? Do you allow an undo for UPDATE's as well (updating a blog post to set it's cont…

Instead of actually deleting a record when a user hits 'delete' just flip a boolean that indicates it is 'deleted'. Then undoing a delete action is as easy as flipping the boolean back. For more complex application state you can keep a stack of state or actions (depending on the application and code) and then push onto the stack as the user performs actions (killing off actions older than a certain point). When the u…

The problem with adding tombstones to a schema is that they infect every join and you must manually cascade the delete in related tables. For simple schemas, like a blog or simple cms it is manageable but it gets hairy as your schemas get more complex.

Re: Undo

#74
post #9

Earlier quoted context omitted.

Instead of actually deleting a record when a user hits 'delete' just flip a boolean that indicates it is 'deleted'. Then undoing a delete action is as easy as flipping the boolean back. For more complex application state you can keep a stack of state or actions (depending on the application and code) and then push onto the stack as the user performs actions (killing off actions older than a certain point). When the u…

The problem with adding tombstones to a schema is that they infect every join and you must manually cascade the delete in related tables. For simple schemas, like a blog or simple cms it is manageable but it gets hairy as your schemas get more complex.

This is 100% accurate. In some cases you can't use a unique on a column because of the "deleted" boolean or a state machine that is in a deleted state. I would venture to guess that this is where a NoSQL solution would come in handy. Just grab all the data they deleted, shove it into a nice json or xml data structure and store it in the nosql database as a document.

Re: Undo

#75
post #51
post #25

Interesting write up. Thanks a lot for writing it Sacha. Okay, so I have a question. Isn't this just a property of the internet as a system? If we remember the history of human-computer interaction on 2D displays, we first really remember what led to the desktop GUI (Xerox Alto, all that stuff). This domain had tons of research poured into it (of which Raskin is a member) - including from the military, for usability…

Many things will be impossible unless you delay the initial action. I mean, how do you really undo sending an email? You can't. What you do instead, and I'm guessing this is what gmail does, is to delay the sending for 15 seconds to give the user time to regret. Seems like delaying the action will almost always be possible. Guess i could give the users the misconception that they can undo whenever they want, which is…

Sometimes the actual deletion must occur before a mistake is realized. I have often seen undo implemented as a 'soft' delete which means the read-side needs to be 'undo aware'. Sometimes undo is implemented by backing up all related data to a separate location which is also non-trivial. Managing the 'restore' half needs logic to account for conflicts and changed state.

It doesn't change the fact that Undo is an amazingly useful feature but its not always as simple as 'delay the action'.

Re: Undo

#76
post #51
post #25

Interesting write up. Thanks a lot for writing it Sacha. Okay, so I have a question. Isn't this just a property of the internet as a system? If we remember the history of human-computer interaction on 2D displays, we first really remember what led to the desktop GUI (Xerox Alto, all that stuff). This domain had tons of research poured into it (of which Raskin is a member) - including from the military, for usability…

Many things will be impossible unless you delay the initial action. I mean, how do you really undo sending an email? You can't. What you do instead, and I'm guessing this is what gmail does, is to delay the sending for 15 seconds to give the user time to regret. Seems like delaying the action will almost always be possible. Guess i could give the users the misconception that they can undo whenever they want, which is…

If you're both using an Exchange server, you can undo sending an email. https://office.microsoft.com/en-us/outlook-help/how-message-...

Re: Undo

#77
CouchDB supports undo as part of their core storage model. http://guide.couchdb.org/draft/btree.html

The short answer is that because CouchDB uses append-only files, the B-tree root node must be rewritten every time the file is updated. However, old portions of the file will never change, so every old B-tree root, should you happen to have a pointer to it, will also point to a consistent snapshot of the database.

Re: Undo

#78
post #50

Earlier quoted context omitted.

That's interesting. Do you have any "really delete this data" requirements and if so, is it hard to deal with that with Datomic? (sorry if question is dumb, I have near zero knowledge on both HIPAA and Datomic)

Excision is built into Datomic expressly for this purpose. I don't know why people assume those capable of building a database would also fail to anticipate this need. The difference is that you don't use excision except in special cases (like legal obligation to delete data), you use retraction which doesn't lose any history.

Thank you for sharing your experience.

> I don't know why people assume those capable of building a database would also fail to anticipate this need.

Praptak asked if it was hard to deal with and did not imply Datomic's developers failed to anticipate the need.

Excision is a feature that must be prioritized like any other and in fact was not available until Datomic 0.8.3941.

https://groups.google.com/forum/#!topic/datomic/Gk8h6MrnJYs

Re: Undo

#79
post #3

You use Gmail's undo feature as an example, but it doesn't work in the way you prescribe. It's the cheap & easy version of undo that doesn't require building your application around the command pattern: just implement a reasonable delay before making the irreversible change, and show the Undo action during this delay (which is really a "cancel the pending change" action). No, it's not as clean or as good of an experi…

Yeah, it's kind of a simulated undo. I'll update the post to point it out better. But anyway, the end result is (almost) the same for the user, which is what counts at the end of the day.

There are actual undo in Gmail as well, for example when applying a label to a message.

Since send is making the change in an external system it has to be simulated, but that doesn't change the point of the post.

Re: Undo

#80

I felt like I was having déja vu reading this article. Happy to have found why, Aza Raskin in 2007: http://alistapart.com/article/neveruseawarning

Me too! Many thanks for finding and linking it. (Not complaining. Both are good)
Post reply on HN