Alright, so linked lists. This little concept has had me beaten and bloody since fall term. I remember in Atkins class barely getting the linked lists assignment in on time, like 15 minutes before it was due. I think it stems from a fundamental misconception of some sort. I think when I can write it out on paper my ideas are right. But when it comes time to actually code it, it becomes something completely different. I think if I had a better time relating what I think it lookls like in UML to the diagram we use to show the linkages, I might be alittle better off.
Anyway, I think I understand the very basic most fundamental aspect of linked lists. If I am permitted to use nulls and all that ugly crap, I think I would be able to develop a linked list from scratch. But Zach and I decided to try and use the state pattern in a linked list. The idea initally being that this would remove the need for an empty list object. By having the last element assume the lastState it would take on the value of a node that is last in line. To remove the need to reference null we tried having the node reference itself. We have run into a few awkward problems however, it seems that given the driver code collection provided with us, the first element of a list also references null. Because of this, we felt we needed a firstState, which lead to another interesting problem, what if it’s the only node? then it would be trying to figure out which state to implment. I wrote some quick “if-else” statements, theyr’e ugly but their you are. These if else’s might help the program decide what state to be in. Unfortunately, theirs alot missing I believe that has nothing to do with the state pattern in Zach and mine’s design, because both of us are still lost trying to get this under wraps.
Concerning idea’s with other patterns. The observer pattern would be the one to use to detect broken links. Though if I understand this right, the pattern would be a little wonky, as it would have many observables to one observer. The observer looking for broken links, and any broken link sending a changed() method to call the observers update method. So it’s a backwards many to one relationship. I think it still works. Their also seems to be an issue using the java api, as you cannot extend two classes, list and observable. I think that an object reference to a delegate that extended observable, calling that delegate’s reference variable and having it use methods like add like this:
Delegate delegate
delegate.add(this);
would work fine. put that reference in the abstract and youd be good to go. Concerning the decorator pattern. If seems like it’s a list itself, just you can only really use one object, the head. You also seem to not be able to recover previous objects. I just don’t seem to really like the decorator pattern. Outside that thought I can’t think of anything particullarly useful to work with it. The visitor is fun, it allows you to traverse a list or just find a single object, and then do stuff to it. It seems like the list is swiss army knife and the visitors are the blades. You use them to do different things with the bits of metal in them knife. That’s all for now. I think I will send two chunks of final project. The Initial main project has all the patternes, they work, but I do not think they work together that elegantly. It isin’t even a simulation. The secondary project does have a few patterns, and they work very closely to each other, and is technically a simulation. I hope To show that I can implement all the needed patterns, and given enough time can use them intelligently. I couldn’t finish the secondary project compeletely due to workload from other classes. Busting out logic to make stuff interesting in the secondary project was taking several hours a piece.