• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

NX: question on the design of the data classes

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Won't you please? Please won't you be my neighbor? - Fred Rogers. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic