Friday, March 14, 2008
Lists and Patterns
For this lab I started by constructing a simple doubly-linked list. Since we did this in Lab, it wasn't particularly hard to recreate on my own. I then tried to get a printVisitor working because while I had gotten it to work in lab, I wasn't really happy with my result and felt that it was slightly hacked together. I had better luck getting the visitor to work on my own and then embarked on getting the decorator pattern to wrap the list class with decorations for Node and Emptylist. This proved to be slightly more difficult than I had initially anticipated because of the fact that the wrappers of the Decorator pattern make it difficult to use the base wrapped classes methods because we change the class of the object to that of the wrapper. I eventually got this working, but don't really think that the decorator is a very good pattern to use with lists. I do think that it was a valid and worthwhile exercise getting it to work though, because in my project I mostly scrapped the decorator after the Lab 7 clean-your-room extravaganza.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment