Hi all, My first thought after reading the specs is that I should avoid adding additional public members to my data class. I thought that Sun may exchange the data.java through a self written one in order to test whether the server only relies on the DBMain interface. But now I not shure anymore about that. What do you think about that? Is Sun doing such things at all? Thanks for all responses.
Best way to make sure is to look in your assignment. Is there a section called "How The Assignment is Marked"? If so, read that and then see what the answer is.
SCJP 1.4 (91%)<br />SCJD 1.4 (376/400, 94%)
Joined: Jun 16, 2004
Hi Robert, Is this the sentence "software checks that overall structure and nomenclature conform to specification". This I don't understand totaly. Perhaps it's my english... Well, it doesn't give me an aswer to my question "Can I add additionaly public members to data.java". Can you reply one again? Thanks for your answer. Stef
If you want to add methods to the Data class and the only requirement you have been given is that you 'must' implement a certain interface you wouldn't be breaking this rule. Obviously document your decision.
If you are adding public methods that other classes may access then you could add a second interface to spell out the contract that the implemented class will follow.
BUT.... What exactly do you plan to add? If you want to add private helper methods that help the read, find, update etc. methods to work then no problem.
If, on the other hand, you are adding something that has other classes dependent on it then beware!. A simple test of switching of the Data class (as you mentioned) could fail.
The "software checks structure and nomenclature" means that your submitted .jar file will be checked to see that all requirements are met. That you have a Data class and a design decisions documents etc..
SCJP, SCJD, SCWCD.
Joined: Jun 16, 2004
Thanks very much for your answer. The reason I'd like to add more methode is that in my design the data.java implements the DBMain interface but also extends File. This way it's easy to open the db file like this "raf = new RandomAccessFile(this, "rw");". And I need for example a public close() methode which closes the Database file. Does I have a general design flaw here? Thanks for more hints...
Joined: Jun 23, 2004
Steven, maybe it's just my assignment, but it seems to be that the DB interface, for instance, does not provide any mechanism for opening the resource. So of course, you need an open(String) method. Of course your Data class might be able to get around it, but that just seems poor.
I think it is alright to add additional methods in the Data class. If you take a look at the methods of the DBAccess interface, there are methods that are redundant and there are some functions that your program needs but are not specified by the interface. The specification does not say anything like you must not create new methods in the Data class. I had four additional methods that I feel is neccessary to meet the must requirements at my user interface section.
I implemented all the methods in the DBAccess method but only use the unlock and lockRecord method in a class I call DataManipulator that provide access to the Data class. I believe that if you feel that there is a need for additional methods, you can just add it in, and be sure that you justify why you do that. I think that is how the General Considerations points come from.
I hope my humble opinion helps. Anyone who had passed SCJD can help in this topic? Thanks.