This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Data class lock testing - is it necessary to test create and delete implementations? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Data class lock testing - is it necessary to test create and delete implementations?" Watch "Data class lock testing - is it necessary to test create and delete implementations?" New topic
Author

Data class lock testing - is it necessary to test create and delete implementations?

Leah Knowles
Greenhorn

Joined: Sep 25, 2009
Posts: 8
Hi

I have been looking at Roberto's Data class locking program and notice it includes tests of create and delete as well as update and read when checking for deadlock etc.

In my assigment URLyBIRD and most peoples it seems we are only required to supply find and booking functionality to the user. Although I did include an implemenetaion for create and delete it is not actuallly used by the GUI at all.

So I am wondering would the assignment assessors test our create and delete implementation when assessing out locking.

Anyone got some opinions about this?

Thanks
Leah
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5154
    
  12

Hi Leah,

I think they will do a full test of the interface they provided (and you must implement). Of course this is just speculation, because I don't really know. I used JUnit test to have a full coverage test of all my methods. So i was pretty sure they would work as expected.

Kind regards,
Roel


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2258
    
    3

Howdy, Leah!

Champion... even though we are not required to provide the functionalities of creating and deleting records, I'd say we must provide valid implementations for these methods. I know that we can't really confirm that, but thinking of reuse, let's say that there's a method somewhere in a class that expects the same interface that we are required to implement... and in this method, records are created and deleted, and they want to use our implementation... if we do not provide valid implementations, this wouldn't be possible... and of course, this would be just a scenario where the assessors could verify if you thought about reuse when developing your assignment.


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Leah Knowles
Greenhorn

Joined: Sep 25, 2009
Posts: 8
Thanks for the advice Roel and Roberto

I have supplied implementations for both create and delete and will test them out. One other thing I had doubts about was the update method. The interface reads

public void update(int recNo, String [] data)

But I have only implemented an update of owner field - to update customerID upon a booking.

Do you think that is enough or should supply update implementation for all fields even though the GUI does not support update them?

Thanks again
Leah

Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2258
    
    3

I think it is necessary to cover all fields, having in mind the idea of reuse and compatibility with other systems that may use your implementation of the Data class.
Nicolas Kal
Ranch Hand

Joined: Sep 09, 2009
Posts: 69
Hi Leah,

I agree with Roberto that you should provide update for all fields. It may not mention it directly but i think that it is better to implement it, at least i did in my approach. Since you are able to create a new record I don't see why the user will not be able to update that record. Regarding the implementation its faire simple, since the mechanisme is the same, the only difference would be to change the location of the file you are updating instead of create where appends data on the end of the file

Regards,
Nicolas


SCJP 6.0 , SBCD (Preparing..),
MSc Enterprise Systems Development, BSc Computer Science
Nicolas Zozol
Ranch Hand

Joined: Oct 13, 2009
Posts: 33
Hi,
it's quite clear that :
Your data access class must be called "Data.java"(...), and must implement the following interface

Even if the GUI does not provide access to full interface.

Then when you look at the javadoc of the update method :
//Modifies the fields of a record. The new value for field n appears in data[n]


Robusta Web Library : Open Source for REST & Java
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Data class lock testing - is it necessary to test create and delete implementations?
 
Similar Threads
NX: URLyBird 1.3.2. Question about the process of booking.
Why I lost points in locking, pls comment on my code
locking
Certain Points to ponder
'synchronize all methods' strategy