• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Data class method implementation

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Today you are you, that is turer than true. There is no one alive who is youer than you! - Seuss. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic