Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Making my data aceesing class reusable.

 
Yucca Nel
Ranch Hand
Posts: 147
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my final approach unless I am advised against it.

I construct my my accessor calling upon 2 private methods inside a try block. The first method is validateDatabase(RandomAccessFile); I would then like this method to call on a helper class that validates the schema information. This SchemaReader class validates the schema with all the expected values that I hardcoded in my Data representation class of a Contractor. The theory here is that each time the database changes if my class is to be reused then logically the schema would differ. Logically my choice of hardcoding values that are expected can be put in the Contractor class as this class is directly tied to the database anyway. Each time the database changes the DTO and the schema would need to change.

After validation I instantiate my List of records.

Does this make sense?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic