Live data from Hacker News

Undo

sachagreif.com

11–20 of 100 posts

Re: Undo

#11

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…

An undo feature for updating a blog post would probably be better described as a roll-back. Wordpress implements this buy saving each revision as a new row, with the most recent indicated by a flag.

Re: Undo

#12
I was thinking about how memory must work to allow "Undo" on desktop apps earlier today, and realizing how different that is as it pertains to the web. Undo is amazing, it's a life saver - it's probably literally saved me days of my life when I've accidentally deleted entire projects before.

Re: Undo

#13
My philosophy is that of all the things that are important for a business or a web service - keeping your data is the very highest priority. Just about anything else can be fixed, but if your data is lost with no backup then no amount of programming or time or sweat is going to get it back.

It's a good idea to just keep this in mind when you're working anywhere near a production database. backup, backup, backup.

Re: Undo

#14
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…

That may or may not be legal. IANAL but telling a user that his/her data has been deleted when in fact it still sits on the server could be regulation violating or downright illegal depending on where you are. Of course it would probably also depend on what your product ToS says and the nature of the data being deleted.

Re: Undo

#15
post #14
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…

That may or may not be legal. IANAL but telling a user that his/her data has been deleted when in fact it still sits on the server could be regulation violating or downright illegal depending on where you are. Of course it would probably also depend on what your product ToS says and the nature of the data being deleted.

Isn't that exactly what Facebook and every other social network does though?

Re: Undo

#16
post #14

Earlier quoted context omitted.

That may or may not be legal. IANAL but telling a user that his/her data has been deleted when in fact it still sits on the server could be regulation violating or downright illegal depending on where you are. Of course it would probably also depend on what your product ToS says and the nature of the data being deleted.

Isn't that exactly what Facebook and every other social network does though?

Yes, and they keep getting flack from various regulatory authorities for things like that. Facebook or anyone doing something that isn't legal doesn't make it legal.

Re: Undo

#17
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…

In a traditional 'desktop style' app simply ported to the web this may be possible. But in a multi-user app that may not be the case.

What if the record you deleted was subject to some kind of uniqueness constraint. If another user has added a record that has the same data, then flipping the delete flag off again would not violate that constraint.

Sure, it could be handled by checking if the constraint is violated. but you rapidly run into a lot of code to implement that one feature and dealing with thinking of and testing all the edge conditions makes it much easier (& cheaper) to focus on other features.

Re: Undo

#18
post #14
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…

That may or may not be legal. IANAL but telling a user that his/her data has been deleted when in fact it still sits on the server could be regulation violating or downright illegal depending on where you are. Of course it would probably also depend on what your product ToS says and the nature of the data being deleted.

I'm not sure about the legal implications either, but it would be interesting to know. From a totally different angle it might cause backlash from users if they felt betrayed by an action not actually doing what they thought it would do. You'd have to balance the conflicting desires to be able to undo things and have actions do what they say they will do. Maybe a 'trash can' or 'archive' system is the way to go.

Re: Undo

#19
Implementing bug free undo is difficult, in my experience. I have a gut feeling that functional programming has a lot to offer here.

Re: Undo

#20
post #14

Earlier quoted context omitted.

That may or may not be legal. IANAL but telling a user that his/her data has been deleted when in fact it still sits on the server could be regulation violating or downright illegal depending on where you are. Of course it would probably also depend on what your product ToS says and the nature of the data being deleted.

Isn't that exactly what Facebook and every other social network does though?

They don't even do a good job of hiding it :/ the URL of the image stays the same and it is still accessible through the URL. All they do is remove its link from their interfaces...
Post reply on HN