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

Implementation of create() method

 
Olena Golub
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I see two possibility to implement the create method:

The first case: The first one is to assume that there is no any unique combination of fields or the unique field to throw the DuplicateKeyException.
In this case the create method should to find the first deleted record and rewrite it.

The second case: Assume that the combination of all fields in the record are unique. And if this combination exists and if this record
is not deleted than throw the DuplicateKeyException. Otherwise to find the first deleted record and rewrite it.

How do you think what the case is correct? I preffer the first one. But I am not sure.
Could you help me?
Thanks a lot for your help!
sincerely,
Olena
 
Paul Bourdeaux
Ranch Hand
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Olena. You can do either one and still pass. Search this forum for threads realting to "DuplicateKeyException" and you will find many topics debating which is better. There is actually one dealing with this smae subject started yesterday by Dan Murphy.

For what it is worth, I did something similar to your second option, but I actually identified a PK in my assignment. I had the B&S - If you have the URLyBrid, the only possible PK is the combination of all fields, as you stated.

I believe Frans Janssen did his assignment via option 1. Both of us passed with similar scores, therefore it does not matter which option you choose... as long as you document it in your choices.txt.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic