Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

The Mystery of Unused Methods in Data Explained  RSS feed

Rick Fortier
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been thinking about this assignment, even after I passed. There are alot of you out there wondering about all of the unused methods in Data and who uses the -1 during lock to lock the entire database.
I think that I have solved the mystery, and this is what I think.
In the older version of the assignment, the candidate was not given a binary copy of db.db. They were only given a delimited text file and the Data class. They were required to create a data import utility which would create the database and then import the data from the text file into it.
When I was doing the assignment, I was thinking that the GUI or some admin utility could be written to use these methods. And I think alot of you worry that you are not using all of the methods in Data, and who would be performing the global lock.
So based on this information, here is how I think all of those unused methods, and the global lock were used for:
To import the data you would have to:
1. use the second constructor to create the database.
2. be able to roll back the all of the imported records if any error occurred during the import.
3. Since records might be rolled back, you would have to lock the entire database so that newly imported records could not be booked until all the records were added successfully.
4. Use the add record method to insert them
5. use the delete record method if a roll back was necessary.
I hope that this shines a light on a lot of questions that most of you have out there about the unused methods in Data. They are leftovers from the older version of the assignment when there was a requirement to create an import utility.
I think that for some reason, probably to make the testers job more easy, that they quit requiring you to create this utility. I think that alot of people in the older version of the assignment modified the structure of the database and this allowed the candidate too much latitude on how they came up with their solution. In the current version of the assignment, it explicitly states that you must not alter the database.
If anyone else has any thoughts on this, go ahead.
Just my $.02 :}
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!