wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes scheme changes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "scheme changes" Watch "scheme changes" New topic
Author

scheme changes

Beny Na
Ranch Hand

Joined: May 26, 2004
Posts: 159
HI all,

i am thinking on how to make this assignment easy to maintain if there was any changes with the file structure .db(database scheme)

and it is right to use magic cookie value as a valid .db file??

can you share with me if you have any idea about this, thks
Eric Chang
Ranch Hand

Joined: Jan 27, 2004
Posts: 113
What I did was provide a method to read in all the schema information from the database file including things like field lengths, and store that information to be used when reading in the actual data.
This makes it so that one does not have to further modify the server code when reading or writing the data. However, I do not provide a "dymamic" way of generating the client GUI, which I feel is a bit out of scope. If one desires to add a new field to the database schema, they would still have to manually add the new field to the client GUI, which I think it perfectly fine...even a "junior programmer" could do it.
Eric Chang
Ranch Hand

Joined: Jan 27, 2004
Posts: 113
As for the magic cookie thing, there is a nice discussion about it here:

http://www.coderanch.com/t/186578/java-developer-SCJD/certification/Verify-database-format

As I have not done anything with the cookie, I found it useful and think I will just hardcode in the magic cookie value and verify the database file using the value.
Beny Na
Ranch Hand

Joined: May 26, 2004
Posts: 159
Thks for ur reply Eric.

What I did was provide a method to read in all the schema information from the database file including things like field lengths, and store that information to be used when reading in the actual data.
This makes it so that one does not have to further modify the server code when reading or writing the data.
b: did you put that method in Data.java or in another class that implement an interface(e.g Scheme interface) in which it would be easy to change if there was any change with the scheme(using strategy pattern).
But i still worried if it is required, i don;t want to make it complicated but i still have to think for a maintanance in the future that will not take a lot of modification.


However, I do not provide a "dymamic" way of generating the client GUI, which I feel is a bit out of scope. If one desires to add a new field to the database schema, they would still have to manually add the new field to the client GUI, which I think it perfectly fine...even a "junior programmer" could do it.
b: does't the client GUI will get an array[] of fieldName, and array[][] that consist of records???
therefore we don't need to add the new field to the client GUI?
please correct me if i am wrong.

thanks
Eric Chang
Ranch Hand

Joined: Jan 27, 2004
Posts: 113
I put the method for reading in the schema and all the data in a separate class for reading in data.
As for the Client GUI thing, what I meant is that if there was a new field added to the database (such as Zip Code or something), then in order to add a new field to input or search on the Zip Code data, I would have to add it manually to the Client GUI (for example, a new JTextField to hold the Zip Code data).
 
Don't get me started about those stupid light bulbs.
 
subject: scheme changes