Wednesday, October 24, 2007
Example of the Command Pattern
After first reading about the command pattern, I did not realize that I have used it many times before this. Since the command pattern deals with encapsulating actions as objects, I thought a good place to look for this pattern was a program dealing with user interaction. I pulled up some of my old homework assignments from CMSI 370 (Interaction Design) and noticed that ActionListener was what I was looking for. ActionListener is the same as the Command class that is used in the diagrams in the book, Design Patterns: Elements of Reusable Object-Oriented Software. And the actionPerformed() method is the Execute() method.
Subscribe to:
Post Comments (Atom)
1 comment:
As discussed when you mentioned this to me verbally, ActionListener certainly reflects the core idea behind the Command design pattern, but there is something else that can be viewed as a "full-blown" implementation of the pattern. We eventually got it, long before you typed this blog, so I'm a little surprised that it isn't mentioned in this entry.
Post a Comment