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

NX: question on the design of the data classes

 
Hugh Johns
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have decided to make the database layer of my program as modular as possible, trying to ensure reusable code modules and good OO principles.
I have a record class implementing Serializable, containing all record fields and record number, with getter/setter methods for everything. These serializable record objects will be passed over the network to the client.
I also have a similiar database class, holding all database schema details and database file location, with only getter methods for most except a setter method also for the file location.
The intention being to have a database member in the Data class (main access class) and reading individual records into record objects, maybe even storing the full set of records objects in a collection (is this "caching the database records into memory" ?)
I originaly coded all the above into the one Data class, reading the records directly from the database file each read/update etc, but this did not seem to comply with any OO principles.
Am I on the right track with this??? advice welcome.
Regards
Hugh
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11854
185
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Hugh
Sounds like a good plan. It sounds like you are using the Value Object design pattern and I don't think you can go wrong using patterns (unless you try and force a pattern where it doesnt fit).
Regards, Andrew
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic