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

Data class and findCriteria method

 
David Mullens
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Is it okay to create private methods in Data in order to help with the findCriteria method?
Is it also okay, to create a class, that could help with the findCriteria method (I haven't done this, just looking at options)?
Thanks for any insights.
Dave.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right up my alley. Yes it is alright to include private methods, cause I did, however, that is one of the two possible places that I lost my 4 points. The other is in not having a LockManager class.
However, from that I am now in the boat with creating a helper class to handle the criteriaFind, so you don't have to add those private methods.
If you have to add private methods I then lean towards extending Data class rather than modifying.
But again I added the private methods and only modified the Data class, and looking back I would do it different.
Hope that helps
Mark
 
David Mullens
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply Mark.
I guess I don't understand why adding private methods would mean that I should extend the Data class. For some reason, I've been uneasy about extending the Data class. I could see that if I was adding new functionality Iwould want to extend it, but all I'm doing is adding to the Data class, the functionality it is suppose to have.
Thanks for all the insights.
Dave.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I could see that if I was adding new functionality Iwould want to extend it, but all I'm doing is adding to the Data class, the functionality it is suppose to have.

I agree. However, looking back at it. If they were in a CriteriaFinder class then it would be cleaner. Meaning the only thing you would have to touch in the Data class is the two deprectaed methods, implement lock and unlock and maybe just adding the criteriaFind method which instantiates the CriteriaFinder class. Or that could be in the interfaces. Then it would follow the specs to a tee. It's just a thought. And since they never tell you where you lost points. I can only guess that this might have been where I lost my 4 points. It's either here or because I didn't use a LockManager class.
Speaking of which If you had a CriteriaFinder class and a LockManager class, then the only thing you would need to do to the Data class would be fix the 2 deprecated methods.
Mark
Mark
 
Gregory Garrison
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David - I did and passed. I had one private method which did some string parsing for the criteriaFind. I could have put this code just as well in the criteriaFind but though it would be cleaner to have a seperate private method.
 
David Mullens
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys!
Mark, I'm sure the reason Sun doesn't let people know where _exactly_ they lost points is keep people like me guessing on what exactly to do!
Gregory, thanks for the information. I noticed elsewhere that you got a perfect score on the server portion. Great job! I guess putting the private method in the Data class didn't cause any trouble then.....
Dave.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic