wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Searching, index files and other unsolved issues Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Searching, index files and other unsolved issues" Watch "Searching, index files and other unsolved issues" New topic
Author

Searching, index files and other unsolved issues

Joakim Eriksson
Greenhorn

Joined: Sep 13, 2004
Posts: 25
Hi!

I actually have an app already up and running implementing all requirements (URLyBird). But, I have some unsolved issues I wanted to discuss before submitting:

Q1:
Have anyone used Maps or index files when processing a search request.
If so, can you present a list of pros/cons for that approach.

My guess is:
- complexity
- increased boot time
- scalability (if in memory , & even more complexity if on file)
+ fast searches
+ presenting sorted results
+ can use iterators remotely for searches.

Q2:
If you don't use Charsets (nio) is there a simple way to guarantee
that the char-set is US-ASCII 8-bit?
Ie is that the same as the Basic Latin Block, which is the first
unicode block representing codes \u0000 to \u00FF?

Q3:
I read a lot on the command pattern for the sockets solution. But I'm going for RMI, and I feel that for this assignment it might only
decrease readability of the code to use this pattern.
However, I use it for gui actions (=commands).
Any comment on this good or bad?

Q4: Initially I was thinkink of using client-side cache to reduce network-traffic. However I'm going with search-iterators (see Q1) instead to reduce traffic. I could use both, but I feel the performance gain might not be worth the effort. Comments?

Q5: I need file I/O speedup.

How do I best achieve this?

Some strategies I have considered include:
(naive, what I use now
1. Read each record separately. Read each datafield by itself with
readInt, readShort etc...
2. Read the whole data record to a byte array with one read call.
Then somehow transform this to ints and Strings without using bytebuffers
3. Read several records to a byte array, split them up in records, then
split them up in fields without using nio.
4. Read all data in the database at once, with only one read statement.
5. Use nio and bytebuffers.

I've tried 1 and 5, but I really want to use alt. 2 or 3. If you have done this how did you go about it? I'm headed for a trial and error solution and would like to have an educated start instead.

Q6 I was thinking of sorting ahead as indicated in Q1, however there may be other solution ideas out there - like client side sorting. If you did this, please argue your case! Why did you choose clientside sorting?



-------------------------------------

A small advice to readers of Max book and code:

In Max book and code I got confused with the inheritance of his
local and remote interfaces. Ie the remote extends the local. However, my code didn't work mysteriously when I did the same. Tricky, until I realized RemoteException is a sub class of IOException, and my methods didn't throw IOException.
Basically if you extend an interface. the new interface may not throw more exceptions than the interface it extends. Max solution made me think it was the opposite and confused me, until I remembered how inheritance of exceptions worked. I believe that it would be better if both local and remote extends another super interface say "Universal" to avoid confusion.
Universal can be placed in the same package as the controller.

The best advice in his book (for me) was to build a command line client for the database class I was implementing. It was great for testing. I advice everyone to do this in addition to automated testing with JUnit.

Also:
Read "search gui" and "find (db)" specs carefully. In my assignment they are not the same and require different implementations.
--------------------------

That's about it,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Searching, index files and other unsolved issues