I've seen many forums threads on this site dancing around the topic of modifying or extending the DBMain interface with which I have an issue with, but none actually gave the type of answers I've been looking for, so I emailed firstname.lastname@example.org with my question as specified in the assignment. This is what I got back.
My Email containing the issue: The assignment states 'Your data access class must be called "Data.java", must be in a package called "suncertify.db", and must implement the following interface'. Part of the interface declares a method as follows:
// Reads a record from the file. Returns an array where each // element is a record value. public String  read(int recNo) throws RecordNotFoundException;
The instructions states 'Your project must conform to this specification. Features that deviate from specification will not receive full credit', and 'Automatic failures ... where this document uses the word "must" an absolute requirement is being described. If you fail to adhere to such a requirement, your assignment will be failed automatically'.
It also states 'Provided you do not contravene any specification in this document you will not be marked on the particular choice that you made...'
Even though it states that the supplied interface must be implemented by the Data.java class, it does not state that I am not permitted to modify the interface.
My question is would I be contravening the specification or be penalised in any manner if I modified the interface method previously mentioned method at follows where myRecord is a serialisable class that contains fields previously returned as an array:
public myRecord read(int recNo) throws RecordNotFoundException;
My reason for the modification would be that the method is public and in order to simpily the OO design making it easy for junior developers to understand (part of the clarity and maintainability requirements) I want to apply the Tranfer Object pattern to this area. In fact I want to apply as many design patterns as required through out the application to enable it to conform to globally recognised standards and therefore easier for any java develop to understand.
This is their responce: Thank you for contacting Sun Certification Customer Support.
There are ambiguities to the exam in order to allow you latitude in how you solve the problem. You are being tested not only on your knowledge of Java technology, but also on your problem solving ability. If you are uncertain of how to do something, document your thought process heavily in that section. The main idea is to ensure the project works according to specification and to document the choices you have made.
Since the assignment instructions do not specifically forbid you from modifying the interface, you should not be penalized�providing that the modification still allows the project to work as specified.
So it seems as long as you comply with the following we should not have a problem: 1. don't modify the format of the data file, 2. can insert, update, delete and read the records, 3. have a class called Data that implements an interface called DBMain (heavily document reason why the modifications have been made) 4. make use of techniques to handle database concurrency issues such as locking and making use of threading. 5. use one of the specified networking frameworks (I'm going for RMI), as well as the non-networking solution, 6. have a swing GUI component used by the user that uses a jtable to display the records that match you search, and performs all of the previously mentioned connectivity to execute all all of the stipulated database DML(Data manipulation Language) methods.
Any input and point of views are welcome from anybody out there (especially persons that have successfully completed the SCJD and the moderators) on this topic.
If at first you don't succeed, try, try again. If you don't try you have failed.
Joined: Jul 17, 2006
my advice: -don't modify the given interface -you can add extra methods to an extra interface and have Data implement both interfaces.
(that's what I did)
S�lvio Mori Neto
Joined: Mar 18, 2008
I'm sorry for my poor english. I am learning. But I wait that you understand me.
I have the same doubt exposed here. I have seen many posts in this site, but they don't help me.
In my specification is write: 'Your data access class must be called "Data.java", must be in a package called "suncertify.db", and must implement the following interface: (DBMain).'
People are writing to don't modify the provided interface and create a new interface that extends the DBMain and then to do methods that throw RemoteException. But it is impossible, because RemoteException is a checked exception.
Other suggestion was create a new interface that is similar DBMain, with methods that throw RemoteException and then to do the Data class implements it. I think that this is a bad idea because offends the object oriented programmation, isn't it? Other point is that the specification says: 'alone mode must use the database and GUI from the networked form'. If I have two differents implementations for the data access class (one for the alone mode and other for the networked mode), I am not using the same database for the two cases, I am? Because I think that the database isn't only the file that has the data, I think that the data access class is part of the database system, it isn't?
Sun says: 'Since the assignment instructions do not specifically forbid you from modifying the interface, you should not be penalized�providing that the modification still allows the project to work as specified.' Then the modification is the better way?