Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

My Design too Complex ?

 
Tony Collins
Ranch Hand
Posts: 435
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My GUIController on the Client side either returns a BBLocalAccess Object or a DatabaseRemote Object. The DBRemoteAccess Object is returned by the ConnectionFactory on the Server.
This is the basic class heiarachy


ServerGUI (Singelton)--------------------
|
|
|
DatabaseRemote---->DBRemoteAccess---->DataAdapter---->Data

DBLocalAccess----->DataAdapter---->Data
The DatabaseAdapter contains BookRecord and findByCriterias it all so contains the static method cacheDB, which calls cacheDB in the Data Object. DBRemoteAccess and DBLocalAccess contains logic to map the exceptions thrown by DataAdapter to exceptions and actions specific to each mode.
Two questions

1) is this too complex ? It's just I've got 17 classes/Exceptions/Interfaces in my db package( 3 interfaces,7 Exceptions, 10 classes( including record and MetaData Classes)).
2) My method cacheDatabase in Data called via DataAdapter, is called in the constructor of DBLocalAccess after DataAdapter is created, and when a Server is created it is called through DataAdapter by the ServerGUI. Does this sound OK it just seems a bit wrong to me. Should I just call cacheDatabase in Data Directly ?
I can't call cachedDB when a DBRemoteAccess is called as this object is created per connection.

Tony
[ September 06, 2003: Message edited by: Tony Collins ]
[ September 06, 2003: Message edited by: Tony Collins ]
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12012
218
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tony,
I dont think this is too complex. In fact it looks like a good separation of responsibilities.
What does your cacheDatabase() method do?
Regards, Andrew
 
Tony Collins
Ranch Hand
Posts: 435
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
cacheDB/cacheDatabse reads the DB file and and caches the contents.
My Data class is a bit of a mess really, maybe there's room for a design based on the facade pattern there.
Tony
[ September 07, 2003: Message edited by: Tony Collins ]
 
Leo Tien
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Tony:
I want to cache the records read from the db.db file, I think this is similar with your design.
But I don't know how you do the locking mechanism, it in Date or in DateAdapter?
At last, I ask you introduce your design detailly, especially DataAdapter, if you can? Thanks !
Leo.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic