This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX:deleteRecord() in my DBAccess interface

 
Nick Lee
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
I'm wondering that what is the use of deleteRecord() in my DBAccess interface.As the description,this method will delete a record form the db file,but when will this method be invoked?
cos I got only two button "Search" and "Order" in my JTable gui,haven't any deletion function supported.
thanks for all ur suggestions
Nick
 
Thomas Kijftenbelt
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
The delete method (and the create method) are not used; just throw a UnsupportedOperationException.
TK
 
Nick Lee
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Thomas,
As u mentioned,they're no use,so why should we implement these methods in our App?
 
Ta Ri Ki Sun
Ranch Hand
Posts: 442
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nick Lee:
hi Thomas,
As u mentioned,they're no use,so why should we implement these methods in our App?

we shouldn't implement it, thats what Thomas said
just throw a UnsupportedOperationException.

so from the compilers point of view the interface has been implemented, from the Sun assessor's point of view you've achieved all the goals set out in the assignment, and from my point of view , you haven't wasted any time doing things not asked of you
 
Perry Board
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm new here, and don't know Thomas. Are you considered an expert around here? If so, that's cool. I just want to clarify why one wouldn't implement all of the methods from the supplied interface.
It's true that the specification does not ask for features in the GUI that will delete or create records, but it does say that "your Data class must implement the following interface...", then the interface is listed and includes methods to create/delete/etc.
So wouldn't it be considered incomplete if only some of the methods were implemented and others were empty?
For that matter, can anyone explain to a newbie such as myself, why an interface would be provided in an assignment like this? It seems to imply that there is an existing interface that is already in use and could conceivably be used to refer to your data object in a context that is outside the scope of the assignment. If that's the case, leaving methods unimplemented would be a mistake. Am I making any sense, or am I way off here?
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Perry and welcome,
You asked: can anyone explain to a newbie such as myself, why an interface would be provided in an assignment like this?
There are several possible reasons, some of which might be:
It gives the examiner a common area that has to be coded in a fairly common way - everybody has to implement the same interface which does the same limited bit of functionality. There is a little room for variation, but not much. Contrast this with designing the client application - there is far more room for one coder's solution to look totally different to anothers.
It might allow the examiners to have a common set of test programs that they can use to test your database: since you are implementing an interface that needs to meet certain critreria, it would be easy to have test programs set up to test whether the search, modification, and locking routines work as expected.
It gives the examiner a chance to see how well you cope with fairly strict requirements - contrast this with the client application which has fairly fuzzy requirements.
You mentioned an "existing interface" (which also fits in with the idea of a test suite above). Again this could be no more sinister than Sun wanting to give programmer's a feel for writing an application that has to work along side a legacy application - I know some programmers are coming out of college and their answer to every difficulty is to redesign it, which you cannot often do with legacy products in the mix. So you cant change the format of the datafile to make it more efficient or to add a field you feel is required, or (name your own change).
There are probably other reasons ...
Regards, Andrew
 
Thomas Kijftenbelt
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I agree with Andrew... the main reason is probably that they want to test our submissions (at least partially) automatically; in that case it helps to provide an interface which we must implement.
I'm new here, and don't know Thomas. Are you considered an expert around here? If so, that's cool. I just want to clarify why one wouldn't implement all of the methods from the supplied interface.

I downloaded my SCJD assignment about a month ago and am busy working on the assignment... so I came across the same issue.
Greetings,
TK
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic