• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question concerning modifying method signature of lock, unlock

 
Greg Georges
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I am ready to upload my assignment and now I am going through the reviewing process of my design decisions. I have read many discussions on how it is not advised to change the method signature of the lock, unlock methods to accept a parameter of a client ID
ie: lock(int record, long clientID)
I would like to make a little survey of the people who submitted their assignments with the modified signature versions of the methods, and if they believe they lost any points because of the decision. I too have modified the signature and have documented the subject in my design decisions document. I do not see any reason why an apllicant should lose points for changing the signature even though I am a strict follower of ALL other directives in Sun's guidelines of how to complete the assignment. I believe that points should be lost if the client ID is NOT followed, but losing points for modifying the signature of a method ,I believe, is not very wise. I have not come across people in my career as a Java developer where my code is sent back because I modified a method signature of a person's class diagram, sometimes this is necessary.
Mark Spritzler and Peter Den Haan, your feedback is always welcome, and I thank you for your wonderful discussions in the past, very informative and thought provoking.
 
Rajesh Matti
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow, I finally got a company there. Greg. I too believe in whetever you said. However, the only reason I wanted to stay somewhat close to the winners here is the statement "You have been given strict guidelines about the way the work is to be performed. These guidelines are to ensure consistency of marking and to ensure each candidate's workload is comparable". Though the issue you brought did not qualify to deviate from the above statement, I decided so just to be safe.
That means, I would not change the signatures of those methods in questions.
-Rajesh
[ February 26, 2002: Message edited by: Rajesh Matti ]
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I could give an argument on overloading the method if you extend the Data class, but to go into a class and modify it directly, well I wouldn't do that, almost sounds like DLL Hell there.
Here's what I mean. The data class was defined some time back, other applications also use the class. They use the lock methowith that signature, you go and change the signature and now those older apps don't work, but your new one sure does
I know that in the assignment case we have two things. 1. the lock/unlock methods where never implemented before, and 2. We have to curb our thoughts of the "Real World" in many of our decisions.
So, basically there are 6 reasons for, and a half dozen against. I know I didn't lose points for not modifying the signature.
Mark
 
Greg Georges
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, in my case I did not modify the method signature of the Data class since I use the adapter pattern and composition to incorporate an instance of the Data class into my RemoteDataAdapter. I have the lock method (record, clientID) in the adapter but never call the lock method of the data class. So, in essence I am not really changing the method signature of the Data class, just provide an alternative lock, unlock structure for the adapter. Should have been more clear on that point.
 
Eduardo Resende
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
People,
Look at the definition of the java.rmi.dgc.VMID class:
"A VMID is a identifier that is unique across all Java virtual machines. VMIDs are used by the distributed garbage collector to identify client VMs."
Wouldn't it be the solution for the client id problem?
[Eduz]
 
amit ahuja
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But how to get hold of VMID in ur code programitically and on the fly ??
amit
 
amit ahuja
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By the way, even i used Adapter pattern but, in my approach internally I still use lock and unlock methods (with original signature) which, i implemented in my extended data Class.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic