aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Data class method implementation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Data class method implementation" Watch "Data class method implementation" New topic
Author

Data class method implementation

Tony Bouer
Greenhorn

Joined: Mar 06, 2006
Posts: 29
I look at spec but I didn't find any information telling I must implement (I mean write code) all methods of Data interface my Data class implement. Could I simple overload the methods I want use and write code just for them. For example I don 't want to write code to find provided I want to provide a specific find method just for name and location fields. What do you think about it ?

Tks,
Tony
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
Welcome to Java Ranch, Tony.

I made myself that same question a couple of weeks ago when I started to implement the DBAccess interface.

My specification states clearly that the GUI must provide functionality to search and display records, and let the user book an available room.

Therefore I concluded that it was not necessary to offer implementations to create or delete records.

This is what I am doing, although I cannot guarantee it is the correct thing to do. I implemented the DBAccess interface in a class that I call DBAccessImpl. I just implemented the method to read, search and update records following the specification provided by Sun within the instructions file and DBAccess interface comments.

After that I created my own wrapper class over this DBAccessImpl. This one is main Remote Object, and it offers the services that I, ultimately, will provide to the client application.

So, my recommendation is that you actually implement the methods the interface require, develop code for those you really need, the ones you do not need can throw UnsupportedOperationException and if you want to offer simpler functionality to the clien applications, create wrapper class over this implementation, offering all the nice features you want to provide.

Regards,
Edwin Dalorzo
Jason Moors
Ranch Hand

Joined: Dec 04, 2001
Posts: 188
I would recommend that you implement the delete and create methods, I believe some people have thrown a Runtime Exception stating that the method is unsupported, however I don't know if they were marked down for this approach, and for the sake of a few lines I think it's better to be safe than sorry! and at least proves your not a lazy programmer

The assignment also mentions that the user interface should be designed with the expectation of future functionality enchancements.

I have implemented the methods and have found them very useful during testing, as it enabled me to create a simple utility to generate new records.

Jason
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Data class method implementation
 
Similar Threads
provide alle the public methods
Contained Class Implementing the Same Interface as the Container - UrlyBird 1.1.1
why i need interface and abstract class ?
Container & Contained Interface Question
Database Designs