Undo() function... need advice

Hi. in couple of days I have to start writing program in which has to be Undo() function (and it's service functions), that function as my lecturer says, have to be able do all undo operations from the start of the program. One of suggestions was to save all data to files after any change. maybe it is a little more human way to do that?

Or it is the only way to save all informacion after any act in program and with undo() function only to load that data back?

[477 byte] By [bronze-starDukes] at [2007-11-26 12:15:01]
# 1

Please explain what your program does and how many data is involved... If you operate on large files, you'll waste a lot of disk- or memory space. You could save only the parts that change.

You could also just push the sequence of your actions onto a stack and when you undo, just pop the topmost action. You should then define a separate undo for every operation...

bronzestar at 2007-7-7 14:18:23 > top of Java-index,Archived Forums,Socket Programming...
# 2

in case of runing out of disc is necessary, really data will be up to 1Mb(but I don't think it would reach these 1Mb), and programn is only for showing to the lecturer what and how you done program.

main program purpose is to do it with variable socketed list, use it(write data in/out, from/to file and to show it in program window and else), do some operations with that list, make and use undo() function

bronzestar at 2007-7-7 14:18:23 > top of Java-index,Archived Forums,Socket Programming...