Originally posted by Peter Gates:
Why do you create an interface that have all the public methods of Data class? I didn't do that but extended the Data class. It works fine.
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Originally posted by Andras Nemeth:
I spent a lot of time with design and I am even not sure, that it is quite a good one.
My Data class implements DataInterface (with all the public methods of Data class).
I have an RemoteDataInterface which contains the public methods of Data class, but these throw RemoteException (or more). My RemoteDataImpl implemets RemoteDataInterface and adapt Data class methods to the interface methods.
I did not listed here, but I plan to use Singleton for locking, also, but it fits to the adapter pattern.
I saw an another design, which has an RemoteDataIf (extends Remote and all public methods of Data). The LocalDataIf extends RemoteDataIf... What annoying me in this design that the local Data implements LocalDataIf and for this reason implements Remote...
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
You could, if you think you've got a good reason for it. I didn't personally.Originally posted by ShankarS:
The various methods in the Data class throws DatabaseException. But, the Data class constructor alone does not throw DatabaseEXception, instead it throws IOException. Shall we change it to throw DatabaseException.
Well, locking calls for wait()/notify(). Whether that's in Data or somewhere else, that's up to you to decide.And, We will be using wait() method somewhere in our Data class, mostly in lock() method.
You can make a case both for ignoring the InterruptedException ("don't support interrupting") and for propagating it back to the client as a DatabaseException ("something interrupted the lock, maybe a db shutdown process").How are you guys handling the InterruptedException. Are you peoples handling it and throwing it as DatabaseException. And, what message are you guys placing as message string.
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
A 1:1 relationship isn't all that difficult to do. An instance variable would do the trick:Originally posted by Andras Nemeth:
How do you ensure that you have only one lock object for that
table? (I mean without Singleton pattern - it means it can be
several instances, but only one for every single table.)
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Generally, yes, that'd be fine, although you would want to make exceptions. The locking code is the most obvious example, but you may also decide that, for example, if a networked client wants to write to a record but hasn't got a lock, you throw an exception or acquire a temporary lock behind the scenes.Originally posted by Jon Trussler:
is that to say that the implementation of the public methods of DatabaseInterface in RemoteDatabase can be of the form :
public publicMethodOfData() { return dta.publicMethodOfData(); }
where dta is a local private instance variable of type Data
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Never be satisfied with anything less than the best and you will surely pass the test...
Originally posted by Peter den Haan:
The Data class would implement this interface:
Note that there is no reason for the getFieldInfo() implementation in Data to throw the full range of exceptions defined in the interface. It should not. After all, it's not a remote object, it shouldn't throw RemoteException. Then, if you're using RMI, you need a remote interface like:
sunglasses are a type of coolness prosthetic. Check out the sunglasses on this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|