Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Better to implement all functions or keep it simple? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Better to implement all functions or keep it simple? " Watch "Better to implement all functions or keep it simple? " New topic
Author

Better to implement all functions or keep it simple?

Philip Smith
Greenhorn

Joined: Feb 26, 2004
Posts: 3
Hi everyone, I am working on the Bodgitt and Scarper Project and I�m at the point where I could use some of your kindly advice.

Mainly for the purposes of testing my code I have implemented fully functioning methods for all methods listed in interface DB.

public String[] read(int recNo) throws RecordNotFoundException;

public void update(int recNo, String[] data, long lockCookie)
throws RecordNotFoundException, SecurityException;

public void delete(int recNo, long lockCookie)
throws RecordNotFoundException, SecurityException;

public int[] find(String[] criteria);

public int create(String[] data) throws DuplicateKeyException;

public long lock(int recNo) throws RecordNotFoundException;

public long lock(int recNo) throws RecordNotFoundException;

I also have a lot of extras, such as sorting and filtering of data in the Jtable, data validation methods for updating and creation as well as other functions designed for user friendliness and making the application somewhat robust.


While my understanding is, at a bare minimum the functions for searching and booking along with the need for locking and unlocking are the only functions that truly need to be fully implemented.

My question is this, is it better to summit my project with all methods fully implemented or would it be wiser to only implement what is truly required. My fear is that there may be errors in the non required methods that would result in points be taken off.

Would it be acceptable to comment out the code in the non required methods and document that these methods may by serve the purposes of future functionality by uncommenting the code at some point in the future.

I would appreciate any comments you could pass along to me.

Thank you.
Phil
Philippe Maquet
Bartender

Joined: Jun 02, 2003
Posts: 1872
Hi Phil,

My question is this, is it better to summit my project with all methods fully implemented or would it be wiser to only implement what is truly required. My fear is that there may be errors in the non required methods that would result in points be taken off.


Good question. Till very recently, anybody on this forum would have replied something like: "All methods defined in the Data interface *must* be implemented, even those not used by the business layer". Because the instructions are clear enough: you must *implement* a provided interface.

But a first "guinea pig" submitted an assignment with an UnsupportedOperationException thrown as the only "implementation" of the create and delete methods and he ... passed. I even think that another "guinea pig" dared the no-implementation-at-all solution and passed too.

But does it really help? Each assignment is graded by one particular grader, and the fact that a given candidate passed with a given solution will never be a good argument to defend yourself in case of failure.

So you must make your *own* decision, but I wouldn't take the risk, personnally.

Regards,

Phil.
 
jQuery in Action, 2nd edition
 
subject: Better to implement all functions or keep it simple?
 
Similar Threads
NX: Should I call lock method before searching records?
NX: Some question about DBAccess
MetaData framework
add new method in Interface DB
B&S Data exceptions