|
Tuesday, June 26, 2012 |
A software concern that I recently investigated was Undo/Redo. An OOP programmer tries to use design patterns as a tool for recognizing software patterns that repeat themselves from project to project. As an engineer or programmer we all come to recognize these recurring design patterns. These patterns are abstract. They help us to see seemingly different projects as having common threads. Once we recognize them they help us to do our job quicker and possibly more thoroughly.
There are two design patterns I looked at for implementing an Undo/Redo facility for a software project. Both require an Undo stack and a Redo stack. As the user executes commands in the target program the commands are put on the Undo stack. If the user un-does an operation, that operation is then put on the redo stack.
The first method I investigated was to use something like the command pattern to create a central mechanism for each user operation. The problem is that each command would need its opposite command for the undo operation. Not many operations are reversible. This would mean the operations presented to the user would necessarily be limited to reversible operations.
The second method, the method I chose to implement, was to save the state of the software at each step. A design pattern that can implement this functionality is the Memento design pattern.
The Undo/Redo software concern can be demonstrated to be a cross-cutting concern. That is this concern is highly coupled with the other aspects of the target program. As such I additionally demonstrated an Aspect Oriented (AOP) approach to modularization of this concern.
Link to report |
damon at 8:35 PM |
(0) Comments |
Add a comment |
Permalink
|
|
|
|