First DBFactoryImpl (implementing DBFactory) will be ininitialized (mutition - single object).
DBFactory provides only one methods: create() which creates an every time a NEW remote object DBAdapterRemote.
DBAdapter is a mutition (single instance), wrapping/adapting DB interface.
Advantage of mutition DBAdapter/Data:
- it's more efficient for the server, because it doesn't have to provide multiple instances (it needs less memory).
- is a BIT simpler for server implementation
What are you return object RecordModel and MetaDataModel?
Does it mean you don't have a Controller-Class at the client-level
Does it mean you have for each client a new remote object but all clients share one Data-Class?
I think for potential scalability, having multiple instances of the class that is doing the work (verifying records may be updated, comparing record values with search criteria, etc.)
Is DBFactory really a database factory? I think it is connection factory. I think the junior programmer might be confused by the name.
but you have 4 different styles - I think this is too many.
Andrew ...having multiple instances of the class that is doing the work...
Vlad Does it mean that you suggest to have DBAdapter object per client [...] or did did you mean Data class?
Vlad Do you mean the eay they are formatted? If so, I agree, I will change it.
I do it to provide a generic framework. RecordModel contains field values and information (name, length). Doing so, the client is very flexibile to changes in database structure. MetaData is the whole database schema (information about each field in database).
Why have you the getMetaData()-method implemented in DBAdapter? What for the client should use informations concerning MetaData?
In your RecordModel you have allready defined the name of the fields
My comment was a bit vague, because it was a bit theoretical.
I presume that the Data.find() method is doing all the hard work of retrieving each record, validating whether it is a match for the criteria, adding it to a collection, then finally returning an array of matching records. By comparison, the DBAdapter is doing comparitively little work - just wrapping that array of records into an array of RecordModels.
And I should be able to continue snorkelling until April next year Gotta love these 8 month long warm spells