Hi, Grorge,
Could you please share your desing pattern here?
I would like to share my experience. In choices.txt, I indicated that I used three design patterns:
1. MVC
The pirpose is to separate the data display from the actual data representation. The view is implemented by the main window in ClientApplication.java, the controller is implemented by GUIController.java, the data model is implemented by
String array, and the data access is implemented by DBMain.
The ClientApplication has a reference to GUIController, and GUIController has a reference to DBMain. Briefly, the structure is :
main window --> controller --> data model
2. Adapter
Adapter pattern is used to handle the problem that DBMain can not be bounded to the RMI registry.(There are many disscussions about this issue and my solution is just one of them).
I used an adapter RemoteDBAdapter to wrap DBMain. RemoteDBAdapter implementes RemoteDBMain. RemoteDBMain extends Remote. RemoteDBMain has all methods defined in DBMain , except each method throws RemoteException. In this way, RemoteDBAdapter can be bounded to RMI registry as the remote object.
At the client side, I used ClientDBAdapter as an adapter to wrap RemoteDBMain to DBMain. Thus, the data access class is always DBMain in both modes.
3. Factory
With the help of Adapter pattern, I defined method getDBAccess to create data access object of type DBMain for both network mode and non-network mode.
public static DBMain getDBAccess ( ) throws IOException {
if local mode:
return local data access;
if remote mode:
return remote data access;
}
Do you use conncetion factory and lock manager?
I used connection factory, as I explained in factory pattern.
No, I did not used lock manager.
Hope these are helpful.
shan