• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX: My implementation so far of Data.java

 
Mark Waldrop
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
I have the URLyBird project, with the version that you need to implement the interface DB using Data.java.
So far, I have successfully been able to read in the contents of the database.

Somethings that I have done that I wanted an opinion on are:
I stored all of the beginning file data (names of the fields and lengths), in an Inner Class called FieldMetadata. Due to the nature of Inner Classes, I have direct access to the created database, and can easily grab the information I need during FieldMetadata's construction. I decided to place my FieldMetadata as an Inner class, because it really only needs to be accessed by my Data.java class. Is my logic ok here?
FieldMetadata also calculates and holds the size of the beginning metadata of the database file and the size of each record so that where to go in the file to get to the record can easily be determined.
My Data::read method (and eventually my Data::write method) will use these values to calculate the location using the following formula:
sizeOfBeginningData + (recordNumber * sizeOfEachRecord)
And currently for the future implementation, I am planning on having the following:
I will have a GUI Client that will make calls to a server/model layer that accesses the database. The server/model layer will be two different classes that implement the same interface, and hence 1 will use RMI to contact the Database interface and the other will directly access the DB interface without using RMI.
Am I thinking too complicated or did somebody else design it this way?
Mark
 
Jacques Bosch
Ranch Hand
Posts: 319
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there.
It all looks fine to me.
Design seems sound. I have finished my Data class, doing some similar things as you, and are about to start on the server/model layer.
And yes, I think many people have taken this general path.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic