In order for the examiners to test the data class they should be able to get an instance of it in a way that it documented, right? After reading the instructions carefully, I assume there's no need of a default constructor.
The issue I'm having is that I have a database class which has the data class as a variable (no setters or getters though, it's a kind of delegate) and it passes itself (during instantiation) to the data class as a parameter so that the data class knows how it should read/write data since the database class knows the schema etc.
There is a way to test the data class separately, but it requires to also create an instance of the database class (which has the schema, remember)and thus we will end up with two instances of the data class (one which the tester has an instance of and one which is in the database class).
If the examiners only test the methods through the data instance they get directly and not indirectly (delegation) through the database instance, I should be ok. However, if they test the two instances of the data class with different threads, I don't know how things will work. The data class uses an instance of RandomAccessFile to read/write the data file. Is this a bad design?
I don't want the database class to expose the data class via getters. Can anyone give me a hint on how I should continue? It seems to me that I'm running in circles.
Why are you creating the schema in your Database class? In my application the schema is read from the header section of the db file in the Data class using RandomAccessFile.
Well, I think the schema should belong in the database class so it is possible to create a flexible gui which is based on the constraints of it. Also, I'm not allowed to add a getSchema method in the data class because then I would break the DB interface :-/
Now I have two more questions: 1) What is the benefit other than developing on cocrete class(if it is really a benefit)in case of a) over b): a)DBMain data = new Data(); b)Data data = new Data();
My second question is which I have a bit idea from your reply: If we can define more methods in the data class then why is the need to extend it and declare other methods in the second interface . The answer again is ,I think, developing on interface not on concrete class.
Please explain I might be lacking in some of my concepts.
Not so fast naughty spawn! I want you to know about