I took two weeks to finish the design and implementation. (Exclude night time). I chose Socket implementation over RMI. Here is the design.
MainClient <-> BookManager <-> Data <-> DataFile
MainClient <-> BookManager <-> DataProxy <==n/w==> ClientService <--> Data <-> DataFile
Can anyone help me to identify one or two design patterns used. I am not very good in patterns.
Many thanks. Sorry for incomplete earlier thread.
I don't recall you needing to identify your patterns for the assignment, but here's a couple:
I have implementations using ServerSocket that runs on Win, Linux, Mac and Solaris. I don't understand what you mean? I am referring to java.net.ServerSocket.
Thank you Andrew for pointing out the patterns.
New Question on patterns, I got the Trottier's book which I think it is not very good. The author highlighted he used Decorator patterns to handle the local and networking parts. I could not understand what he is talking about. Maybe I am slow in understanding. Could you post reply on how Decorator is used in this?
Thank you and best regards.
Originally posted by AndrewMonkhouse:
I don't recall you needing to identify your patterns for the assignment
Originally posted by Chris Harris:
I thought this was one of the main points of the choices.txt?
You can certainly add these to your choices.txt file (and I did in my submission), and it may help your examiner understand your submission, but it is not required as far as I know.
The decorator pattern is used to transparently add functionality to a class. It is not meant to be a wrapper, and it is not meant to extend the class.
To give you an example:
I have tried to keep the example to Alain's concept of a seat booking system
In that example, you can see that I can use the basic class or one of the decorator classes interchangeably. However if I use a decorator class I get extra functionality (an extra charge is added). I could just as easily have overridden the basic methods as well if extra functionality was needed in the method itself.
Alain has come close to this concept by specifying the DatabaseInterface interface, and having both Database and DatabaseRMIImpl implement it. This means that the same code can be used on the client side regardless of which type of connection you have:
However this is not a decorator pattern.
You could see in my example that using the decorator pattern meant that if an extra method had to be added, I could add it to the abstract Decorator class, and all the decorations would inherit it automatically. You cannot do this with Alain's classes - you would have to add the new function to the DatabaseInterface, the Database class, and the DatabaseRMIImpl class.
You can see in my example that you can apply multiple decorations to the base class, and that it is done transparently. You cannot do this with Alain's classes. You cannot (to give a wierd example) wrap a serialized socket call inside an RMI call or the other way around.
Alain is using the Proxy pattern to have one class stand in for another class.
Originally posted by Frankie Cha:
I got the Trottier's book which I think it is not very good.
Perhaps you could add your comments on what you liked / disliked about the book in our book review comments page. The one for this book is here. That way others can see what you thought which could help them decide whether to get the book or not.