All the examples and tutorials I found online so far deal with commands that either add or subtract or some other operation on a value - Calculator is the common example.
However What if you have commands that don't behave like those in a calculator?
Imagine a drawing program like Microsoft Visio, where user places and moves objects on the screen to an x, and y position. Or adding and removing an object. These commands are unrelated, so keeping track of a current x, y position, has no meaning if the next command in the stack is a create object command that you need to undo.
Any suggestions how to handle this?