Hi everyone,
I am working on urlyBird project
here are some of method defined in the interface
public
String [] read(int recNo) throws RecordNotFoundException;
public void update(int recNo, String [] data) throws RecordNotFoundException;
public void delete(int recNo) throws RecordNotFoundException;
public void lock(int recNo) throws RecordNotFoundException;
public void unlock(int recNo) throws RecordNotFoundException;
public boolean isLocked(int recNo) throws RecordNotFoundException;
In the implementation class.
is it good design if i do the following?
public void update(int recNo, String [] data) throws RecordNotFoundException{
//calling read(recNo), so it can check if the RecordNotFoundException is thrown
read(recNo) ;
....
}
same for other methods with RecordNotFoundException.
Or, it is better to write a separate piece of code for checking the record valid for each method that throws RecordNotFoundException
Which way will be better ?
thanks for the time reading my question