The Command History Object pattern implies that the object acts just as a holder for all the commands that can modify its state, and always delegate the queries to the last command used. If the last command is unable to calculate the value of the query by itself, it will delegate the query to the second oldest command and so on.
So, the holder object must know the last command that has modified its state, and each command must know the last command that has modified the state of the holder object before itself.
Besides that, the command must implement the query part of the holder object's interface.
With this kind of implementation, you can have the value of the queries of the object relative to any time of your system. And by just removing the last commands from the holder, you can have a undo-feature or a rollback-feature.
I will put here the Bank example with this concept implemented, without the undo-feature or the rollback-feature. I will try to alter the GUI to allow changes in the time of the Bank for making queries.
HumbertoSoares
Humberto, I am very interested in this topic, and would like to take a look at a simple implementation, without all the complexities of the Bank demo. Can you help me with it? @:) --
CarlosVillela