This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on Data Class

 
Rajesh Matti
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just started my research on the assignment. Have noted down lots of things to ask. Before that,I need to know if it is okay to modify the Data class, ie, add new methods, remove 'synchonize', change the methid signatures, remove unused variables etc. I do not intend to to harm, but want to know if it is okay to make 'ANY' changes the classes came with the original assignment . Any help is greatly appreciated.
Thanks,
-Rajesh
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do anything you want to any file.
However, you should really consider if that is necessary, and you will have to justify why you did it in your design.txt and in your essay exam.
My recommendation is not to change method signatures, as they are like that for a reason, especially Synchronization.
As far as adding Methods to the Data class, that is what I did. And to be honest, I think that that is one of the reasons why I had 4 points taken off in my Server part of the grade. I still think adding criteriaFind method to the Data class directly is OK, as I take that as part of the requirement. But I added two helper methods for my criteriaFind, that I believe know could have been in a seperate class to handle it.
But, it is your assignment, and all decisions are up to you. Have Fun with the assignment .
Mark
 
Rajesh Matti
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mark. That input will surely help me. I will be posting a bigger list question soon, hope you would provide your valuable input.
Thanks again
-Rajesh
 
Rajesh Matti
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark- About the synchronized methods, some of the methods needs to be synchronized, however, few methods need not be synchronnized at the method level, but should be at the block level, which is a better solution (the current code does some if's in the synchonized method, which is not at all necessary). In addition, though subclassing is preferred by sun (i guess), creating a generic database/access interfce and which the "Data" class itself can implement (requires change to the Data class definition). The client need to know only the interface, does not care if it is flat-file or a relational database. Alsom there is a field which is never referenced, do I need to clean up such code, if yes, this requires changes to the data class ?. I may be wrong in my thinking, please correct me further.
Thanks,
-Rajesh
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In either case of the Method being Synchronized of a block of code, in both cases the class is what is locked. As far as implementing an interface, you can extend the Data class and have it also implement your new interface. Either way is fine, as long as you can defend your choices.
The only clean up of the Data class that you need to do is fix the deprecated methods. As far as methods or fields that are not being used, I'd keep them there. The requirements does not say we need to remove stuff that is no longer in use.
Whichever way you want to go and you feel good about it is the way you should go. Sometimes it is better to go down a particular path, sometimes it works, sometimes it doesn't. But never look at the wrong path as a mistake, but as an opporunity to refactor and learn some more stuff
Mark
 
Rajesh Matti
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mark. I will follow your advise. Thanks again, -Rajesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic