cs2103aug2014-f10-1j / main

CS2103 Project Group F10-1J
0 stars 0 forks source link

As a user, I can undo the last action done... #16

Closed wkurniawan07 closed 10 years ago

wkurniawan07 commented 10 years ago

so that I can obtain the information stored before in case anything goes wrong.

stevenkhong commented 10 years ago

We might need to rethink our architecture and add an executor component, so that we can track modifications for implementation of this undo feature. I'm not sure if there's any other way, please enlighten me...

wkurniawan07 commented 10 years ago

My thought: maintain a stack of inputs. For every action done, add the opposite action to the stack (e.g "add task a" => "delete task a", "update_desc some_description" => "update_desc old_description", "mark as done" => "mark as not done", ...). To undo just pop the stack and run the input.

stevenkhong commented 10 years ago

You are right. But how does the stck know if the input is carried out successfully? Or valid...

wkurniawan07 commented 10 years ago

we can always tweak it in such a way that the opposite command is only added upon successful action. I don't think it's hard to do, hope I'm not wrong. then again, for undo commands to work, all commands need to be well-defined and finalized first. I think this can be left for now, until we're more ready.

stevenkhong commented 10 years ago

Alright then. Cool. I'll look into it once the main commands are done. Thanks

jkt001 commented 10 years ago

It seems this issue will never be close as long as we add new commands which need an inverse command.

however, considering the undo framework is working smoothly, this issue can be closed.