This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hello everyone! After about 10 days hard work, I finally implement almost all the requirements of my B&S assignment. Without the great help in this forum, especially the useful advices from Andrew, whose excellent enlightening work makes people�s lives more interesting and better, I would never do it so quickly and perfectly, so I need to thank all the people here again. According to other friends� proposals, I divided all the requirements into several small parts in order to achieve them separately and it works perfect! Here are some uncertain questions, which I don�t find similar answers to resolve now, I strongly desire to hear from you to set up my final submission:
1)About the Server IP. I think the process should be when the examiner tests the program in network client mode, he/she would input the right IP address of the server machine (using GUI ) which had already started by him/her. In other words, we don�t need to hardcode a common IP address in our programs, like 127.0.0.1 , localhost or something like this. I don�t know if I understand the process correctly.
2)About implementing delete and create methods in the DBMain interface. My instruction says, �Your data access must implement the following interface:�. There are two methods, delete and create, in the interface, but in the user interface section of this instruction which only requires the functionality of booking and searching, thus it makes those methods useless. My way is to implement them using some concrete sentences in the Data.java (which implements DBMain) and don�t invoke them in the client GUI at all. But how the examiner knows exactly to add right clauses testing the implementation of those methods in Client side? I don�t know whether the approach is right.
3)About null terminated text values. In the instruction, it told me that "All text values, and all fields(which are text only), contain only 8 bit characters, null terminated if less than the maximum length for the field". I have read the data in my JTable component already, but I don�t know how to test whether all the text values are null-terminated or not(maybe space-padding?).
4)About the class of reading db file. In the instruction, it says "all numeric values are stored in the header information use the formats of the DataInputStream and DataOutputStream classes". Should I be docked if I only use RandomAccessFile class to access the db file?
5)About SDK version. Following the instruction, "the platform must not have been superseded by a new production version for more than 18 months by the time you make your submission". Does this allow me to choose either SDK 1.4 or SDK 1.5 to compile the program if I upload the assignment next month?
6)Another locking manner in standalone mode. I know in standalone mode file level locking should be no needed. But what if a user opens several windows to run the same program? Do we need to ensure only one program should be run at one time in this mode? And if so, how to implement this?
7)About Owner field format. In the instruction� sDatabase schema, it describes Owner field as "The id value (an 8 digit number) of the customer who has booked this". I think the field contains number like 0,1,2�etc. So I decided to use JformattedTextField component to restrain users� input, only numbers can be accepted. Is that assumption right?
Any advice will be appreciated! Best Regards, WarrenII Pan [ July 30, 2005: Message edited by: WarrenII Pan ]
Originally posted by WarrenII Pan especially the useful advices from Andrew
OK, flattery does help getting responses . Seriously - glad my advice helps.
I agree with allowing the assessor to enter an IP address / hostname.
Don't worry about how the create/delete methods will be tested (I don't believe they are tested ). The assessor will certainly be looking at your code, but as long as you have implemented the interface then the examiner will know how to test them - they will just need to instantiate an instance of your Data class (or get the one and only instance if you are using a Singleton) - and your JavaDoc for the Data class should explain how to instantiate / get an instance of the Data class - and then they can just call the create/delete methods as per the interface API.
It seems that a great many of this forum members choose to use RandomAccessFile, and I have never heard of any of them being penalized for it. RandomAccesssFile implements DataInput and DataOutput, as do DataInputStream and DataOutputStream, and it is the interface that specifies the formats for the primitives and Strings. So the formats are guaranteed to be the same.
No problems. The J2SE Code Names page shows that JDK 5 was only released in Sept 29, 2004, so you have until March 29, 2006 before JDK 1.4 will have been superseeded - you can still use either.
In your instructions, do you have the sentence "You may assume that at any moment, at most one program is accessing the database file..."? If so, you do not need to worry about two standalone clients running simultaneously - Sun have said it won't happen.
Thanks Andrew for so fast response! Your answers make all my confused questions clear enough. By the way, I don't mean to flatter you, but we candidates are luck enough to meet a moderator like you, you indeed do an excellent job for all of us and you deserve the praise!
Best Regards, WarrenII Pan [ July 30, 2005: Message edited by: WarrenII Pan ]