aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes FBNS: criteriaFind() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "FBNS: criteriaFind()" Watch "FBNS: criteriaFind()" New topic
Author

FBNS: criteriaFind()

Youji Tanaka
Greenhorn

Joined: Jul 12, 2005
Posts: 6
Hi, all.

i read a thread(http://www.coderanch.com/t/183989/java-developer-SCJD/certification/FBN-criteriaFind-String-criteria-method)

In that thread, below solutions is written.

1. SOME PEOPLE DON'T CACHE ALL RECORDS IN MEMORY BECAUSE OF POSSIBLE MEMORY ISSUES IF THE DATABASE GETS HUGE
2. OTHER PEOLE DO IT, FOR THE PERFORMANCE ADVANTAGE
3. AND OTHER PEOPLE (LIKE ME) IMPLEMENT A CACHE WITH AN OPTIONAL MAXIMUM CACHE SIZE.

i selected 1.

my implementation is as follows. is this ok?



Thanks
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11479
    
  94

Hi Youji,
In that thread, below solutions is written.

1. SOME PEOPLE DON'T CACHE ALL RECORDS IN MEMORY BECAUSE OF POSSIBLE MEMORY ISSUES IF THE DATABASE GETS HUGE
2. OTHER PEOLE DO IT, FOR THE PERFORMANCE ADVANTAGE
3. AND OTHER PEOPLE (LIKE ME) IMPLEMENT A CACHE WITH AN OPTIONAL MAXIMUM CACHE SIZE.

i selected 1.
Just being pedantic here - that was a comment by Phil, not a solution.

Having said that, have you tried to determine how big a record would be if stored in memory / how many records you would need to store in memory before you ran out of memory / whether you could still address that many records given the API limitations?

There are lots of reasons for implementing a cache, and there are lots of reasons for not implementing a cache. There is nothing wrong with you choosing to go with Phil's option 1.

my implementation is as follows. is this ok?
Have you considered using the Sun Code Conventions for the Java Programming Language? Personally I find:easier to read than

Why not validate each field name as you extract it from the criteria string? Why are you doing this as a seperate step?

At rough glance this all appears to work - have you tested it to confirm that it does work?

Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Youji Tanaka
Greenhorn

Joined: Jul 12, 2005
Posts: 6
Thanks Andrew


Have you considered using the Sun Code Conventions for the Java Programming Language? Personally I find...


I was not looking in detail.
Thanks you for the point.


Why not validate each field name as you extract it from the criteria string? Why are you doing this as a seperate step?


I made a point of readability. But is this bad way?
if bad way, i will modify.
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11479
    
  94

Hi Youji
But is this bad way?
if bad way, i will modify.
If you read enough of my posts, you will find that I rarely give a direct answer - I usually ask a lot of questions . The main reason for this is because there is no "one" right way to complete this assignment. Everything is correct, for a given value of correct.

So what you are doing is not bad in itself. And you have been able to justify it. You might want to put an implementation comment in your code stating that you have chosen readability over performance - or a similar comment in your design decisions document.

Regards, Andrew
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: FBNS: criteriaFind()