• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

lock(), unlock() and Factory Pattern

 
Sameer Amte
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my server design, I am planning, to implement a Factory Object , which will be registered as a remote object and another RemoteData object, which will implement Remote. This will provide access to all the methods to the Data class.
The LockManager and the Data will be member variables in the Factory object. This way there will be only one instance of Data and LockManager.
Does anyone see any problems with this design?
I want to avoid creating multiple instances of Data.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sameer, I think it is a beautiful design. I like it very much.
Mark
[ July 01, 2003: Message edited by: Mark Spritzler ]
 
Sameer Amte
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark,
Thanks a lot for your feedback.
Thanks
Sameer
SCJP
IBM XML
TIBCO R
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This way there will be only one instance of Data and LockManager.
One instance of Data and LockManager per client, per request, or per database table? That is, if you have 5 database tables and 10 remote clients, and each of the 10 clients have requested a connection to each of the 5 database tables, how many instances of Data and LockManager will you have?
 
Sameer Amte
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One instance of Data per instance of the Factory i.e; one instance of Data and LockManager per table.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eugene, you know that your question is beyond the scope of the assignment, and beyond the requirements.
Mark
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sameer Amte: One instance of Data per instance of the Factory i.e; one instance of Data and LockManager per table.
Excellent!
Mark Spritzler: Eugene, you know that your question is beyond the scope of the assignment, and beyond the requirements.
Well, we have many discussions regarding this, and I still think that this is within the scope of the assignmnet and the requirements. As I (and other participants here) argued, it is extremely likely that additional table(s) may be added to the project to support additional functionality. If the design has to change because of that, I don't think it is a good design. With the approach that I chose to take (and Sameer seems to favor, too), not a single line of code needs to change in the server code, no matter how many database tables need to be supported. The preference for such a design seems very obvious to me.
Eugene.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eugene, yes I see what your point is. But for the assignement you will not gain points for your design. And if you don't do as your design, you will not lose points. I did not have a design that could add multiple tables and I didn't lose a single point because of it.
Mark
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eugene, yes I see what your point is. But for the assignement you will not gain points for your design. And if you don't do as your design, you will not lose points. I did not have a design that could add multiple tables and I didn't lose a single point because of it.
You may be right. I guess what I am saying is that if I were the grader, I would penalize the design that requires a major change in case of a very obvious additional functionality. And I think it is quite probable that a particular Sun Microsystems grader may have the same notion of what constitutes a good design.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic