After a long week I have finished my SCJD assignment (URLyBird 1.3.2) and have fulfilled all the must requirements as far as I know. In addition I've done basic testing to check that my database class implementation works - I can read records from the database, delete them (and subsequently reuse the record number and disk space), create new records, search them, and the locking/unlocking appears to work as well from my simple tests in which I try locking records from different threads and sleeping a few seconds before unlocking - if the record numbers are the same, then the runtime is approximately sleepTime * numThreads, but when the record numbers to lock are different the runtime is about sleepTime so clearly parallelism is at work.
In fact, I do not see how they can automatically test my database implementation because they don't know what the constructor signature of my Data class looks like. In fact, it takes in a custom type (DatabaseIO) so I doubt they can automate this. My spec says only
Your data access class must be called "Data.java", must be in a package called "suncertify.db", and must implement the following interface...
My guess is that they just run a reflection test to make sure that the provided interface hasn't been modified and that the checked exceptions have the required constructors and are in suncertify.db.
So functionality-wise, I feel safe. My GUI is minimalistic but supports the very basic find and book operations requested by the spec. I have generated an RMI stub for my class that implements Remote, and my JavaDoc is sufficient + has a nice class diagram. The majority of my thoughts and dilemmas are in choices.txt as well as reasons why I did not implement some extra features (for example, unbooking a reservation). I'll try some testing on other platforms as well just to make sure.
Have you tested for concurrency problems in networking mode.
By example, when you perform a search on the GUI, you will use the DbAccess#find(), and then some DbAccess#read() to obtain the records corresponding to the record numbers found.
Do you ensure that, when you read the records, none have been updated by another network client since the time you found the record numbers corresponding to your search criterias. In case you have not checked that, it is possible that some records you read do not anymore correspond to your search criteria.
My GUI allows the user to search for "exact matches" or for "prefix matches." It's true that in the former case, I do extra checking so that only exact matches are returned, but in the latter case I do no checking. However, I don't think that is too much of a concern in this case since the delay between find() and read() already presents a concurrency problem that we can't solve without implementing some atomic findAndRead() function at the database level. Either way, I don't see that as being an automatic failure.
On the topic of the suncertify.properties file, my program works fine if it does not exist, and regardless of whether it is found or not, the program prompts for the database file/server address/port (depending on the mode that the application's running in) and will save that to the suncertify.properties file so that it may be read in the future. The Properties class is very nice for this. Also, I am sure to re-prompt the user every time the program is started, and if the properties file exists, then I pre-populate the form fields but still display the prompt.
Hm.. my update() and delete() methods throw IllegalStateExceptions if the records aren't locked by the current thread, which seems good to me since the only other options are to acquire the lock inside of update() and delete(), which is bad because of the possibility of a long waiting time, or to return without doing anything, which is also bad since the user should be notified of a failure.
The rest is just packaging it as a JAR, which I will read very carefully.
posted 11 years ago
Well, I have 4-6 weeks to wait but I submitted my assignment and completed the essay exam today. The exam was easy in that I was able to write three to five paragraphs for each question and finished an hour early, but it was difficult because I had forgotten how I had written a lot of the code. So be sure to read over your code the night before! But overall I treated the exam as another choices.txt.
Thank you for the help and I will post my results to the Results forum when I get a reply from Sun!
Watchya got in that poodle gun? Anything for me? Or this tiny ad?
Devious Experiments for a Truly Passive Greenhouse!