• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

B&S UI & Data.java

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have got B&S problem which basically search contractors(search DB) and book one of them(Update DB). And UI requirement says that I must search data with some conditions or not, book a selected record and update file accordingly.

But in Data.java there are two methods that are not going to be used, I think.
public void delete(int recordNo)
public int create(String [] criteria).
As far as I know, the interface Data.java must be implemented.

Does it means I must implement those methods even if I do not use it?
Or
Shall I implement all expected related DB action in UI like create a record when a new contractor joins this company or delete a record when a contractor doesn't work any more??

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I implemented both create(String[]) and delete(int, long) in Data.java, but my UI does not use them at all.

Your data access class must be called Data.java, must be in a package called "suncertify.db", and MUST implement the following interface...



To me, this means that all the methods in the supplied interface must be implemented.

As far as the UI is concerned, I did not provide the ability to add/remove contractors. It is simply not in the specifications, and going beyond the requirements could be a bad thing.

Also, here is another possible justification for implementing create and delete in Data.java, even though these methods are never used by the UI. Perhaps, in the future, someone will want to write another program for an administrator to use to add and remove contractors from the database. This isn't necessarily something a customer service representative should be allowed to do. By implementing create and delete, this new program could simply use your Data class as it is.

Anyway, that's what I think. Hope this helped.
 
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello,

I recommend to keep the implementation within the scope of the requirement: Let create and delete throw an UnsupportedOperationException. Make sure you document the interface ("optional operation") and the implementating class appropriately.

For me it payed off (no points lost in related areas) as well as for everyone else I heard about (2 or 3 ppl). I had B & S 2.3.2.

Conan
 
reply
    Bookmark Topic Watch Topic
  • New Topic