• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Data class and findCriteria method

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic