• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URLyBird 1.1.3: Design reassurance.

 
Gareth Knowles
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Just looking for some confirmation that my design is OK, and that I'm not out to lunch again
I decided to give the client it's own interface which just has getAvailableFiles, open, search, book, and unbook, capability. I've also provided an adapter that takes care of mapping to the DB interface and also locking when in "server" mode. The adapter gets an instance of DB associated with a particular file from a DB factory. Only one instance per file is ever created by the factory (uses a static HashMap). In "alone" mode the GUIController uses the adapter directly but ignores the locking methods on the adapter. However, the adapter still uses the factory to get hold of a DB instance.
Rational: I did this because I didn't want the client to have anything to do with locking (in case it crashed) and also because I wanted to isolate the client from low level public DB methods that it needn't have access to (according to the spec). For administering the the DB (start, save as, create, delete stop etc..) I intend to provide a simple admin GUI.
Am I wandering in the wilderness or am I on the right track?
Cheers
Gareth.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gareth
I am a bit confused by the statement:
I decided to give the client it's own interface which just has getAvailableFiles, open, search, book, and unbook, capability.

To me, this means that the book method is in the client code.
But you later say that you are doing this to avoid the whole issue of clients crashing. To me, this implies that the book method is on the server.

In "alone" mode the GUIController ... ignores the locking methods on the adapter.

Nothing wrong with that. But just wondering what your reasoning for it was?
Regards, Andrew
 
Gareth Knowles
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andrew
I created a new remote DBClient interface for the client. The implementation of this delegates the book request to the DBAdapter, which delegates the book request to Data (which implements the DB interface). In network mode, it's all done on the server, but the DBAdapter handles the locking and translates between the clients view of the world and the database view of the world.
Does this make sense now? Or do I seem to be going off on a tangent? I'm really not sure about this, so please say if it stinks.
Had second thoughts about the avoidance of locking when in standalone mode. No reason to avoid it. Thanks for questioning it.
Cheers
Gareth.
 
Gareth Knowles
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andrew,
Just realised the source of the confusion. I didn't describe the sequence correctly. The DBAdapter calls lock, update, unlock, on the Data object, regardless of server mode or alone mode. I should really take more time on these posts. Sorry.
Cheers
Gareth.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gareth
This high level overview looks workable to me.
Regards, Andrew
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic