• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need advice on the Data class

 
Eduard Mamedov
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Roel De Nijs
Sheriff
Posts: 10591
140
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1/ My approach:
  • create: runtime exception when having a null element in array
  • update: 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
     
    Eduard Mamedov
    Greenhorn
    Posts: 23
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks, Roel
     
    Olu Shiyan
    Ranch Hand
    Posts: 57
    Java Oracle
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    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
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic