wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes NX: question on the design of the data classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "NX: question on the design of the data classes" Watch "NX: question on the design of the data classes" New topic
Author

NX: question on the design of the data classes

Hugh Johns
Ranch Hand

Joined: Jul 28, 2003
Posts: 36
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

Joined: Mar 28, 2003
Posts: 11404
    
  81

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


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
 
wood burning stoves
 
subject: NX: question on the design of the data classes
 
Similar Threads
Starting OCMJD
Data Class Doing Too Much?
Looking for some nice advice
Value Objects
record cache