| Author |
Need advice on the Data class
|
Eduard Mamedov
Greenhorn
Joined: May 20, 2010
Posts: 23
|
|
Hello, ranchers.
I have some questions about DataFileAccess class.
1) I already release C.R.U.D methods. But i need advice what to do with null in String[] array when we create or update records. I think for create method it's good to throw Exception when array contains null.....and for update method???...it's better ignore or simply rewrite with spaces this record field that have null value...???
2) I'm trying to use Facade pattern for my Data class, where DataFileAccess class is used for C.R.U.D operations and I want separate class for logic locking... design like in Andrew Monkhouse's book. But my lock method looks like:
....and there is a problem, cause I need to check recNo that located in a map of DataFileAccess class. Is this normal design to release lock() and unlock() methods in my DataFileAccess class?
Cheers, Eddie
|
SCJP 6
|
 |
Roel De Nijs
Bartender
Joined: Jul 19, 2004
Posts: 4349
|
|
1/ My approach:
create: runtime exception when having a null element in arrayupdate: ignoring a null element in array (not updating the corresponding field)
2/ I didn't use a facade, just all functionality in the Data class
|
SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
|
 |
Eduard Mamedov
Greenhorn
Joined: May 20, 2010
Posts: 23
|
|
Thanks, Roel
|
 |
Olu Shiyan
Ranch Hand
Joined: Jun 10, 2010
Posts: 56
|
|
Just as an added note to Roel's comments, I also believe you don't necessarily have to design your Data class in the same way as the Denny's DVD example in Andrew's book. I haven't coded my Data class yet but I don't really see the need for a Facade in the Data access layer. As far as the version of the SCJD project I received is concerned, Singleton will do.
Cheers
|
SCJP 6, OCMJD6
|
 |
 |
|
|
subject: Need advice on the Data class
|
|
|