This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I'd like to ask your opinion of the design of two of those packages:
The functionality in suncertify.db.io is such:
DBSchemaBuilder builds a valid DBSchema object. It throws DBSchemaBuilderException if it cannot build a valid schema.
DBSchema is then handed off to a DBParser. The DBParser knows how to read the db file based on the schema. It throws a DBParserException for error conditions, and uses exception chaining.
Classes in suncertify.db.io package take care of my db access functionality.
The functionality in suncertify.db is such:
DBCache is the database data class. It loads up the database into memory and knows how to manipulate the information. It is built using a DBCacheBuilder, which throws a DBCacheBuilderException.
Data gets a copy of DBCache and DBParser. It is responsible for ensuring thread safety and synchronization of data in the DBCache and the db file. Before it changes the data in DBCache, it requires a true return from an appropriate DBParser method, indicating the data were written to disk. It also gets a copy of DBLocker, which contains locked records. Data class throws required exceptions, which are chained.
DataAdapter implemets a DBClient interface, which contains more understandable methods for application logic - book instead of lock, change record, unlock, for example. It throws chained exceptions such as BookingException, DeleteRecordException, CreateRecordException, etc.
DataImpl class implements the DBRemote interface, which extends DBClient and remote interfaces; and it extends the UnicastRemoteObject. It is the remote class.
It throws the same exceptions as the DBAdapter class since it also implements the DBClient Interface. [ August 13, 2004: Message edited by: Anton Golovin ]
Anton Golovin (firstname.lastname@example.org) SCJP, SCJD, SCBCD, SCWCD, OCEJWSD, SCEA/OCMJEA [JEE certs from Sun/Oracle]