Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Design Review Needed...  RSS feed

Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Guys,
I finally, got to the point where I am comfortable enough with my design and decisions, to post em up and see what your thoughts are, I have one outstanding question, but I'll post that in a seperate thread... Ok, so here's my design.
Patterns Used
MVC - Overall control for look and actions
Facade - Hide's the complexity of booking from the client, as local client has no need for locking.
Singleton - Server side data class and keygenerator.
GUI Components
FlyByNightClient - Contains main method and start up logic for local and remote mode, based on arguments given at the cmd line.
Contains -
FlyByNightView - The main view for look and feel witch contains a gui class as a helper to build the look and feel. the view informs the controller when events occur and is responsible for updating the data displayed.
FlyByNightCtrl - Controls the view and informs what views to show. Also responsible for booking flights and return the results to the view.
dataMgr ( local or remote ) - Facade act's as the model for the MVC design hiding the complexity of booking from the view. The remote version implemts locking.
Data - I choose to modify the data class, and my definition to justify this is that the data class is a way of retrieving, adding and protecting the file. Lock and unlock not implemented as they are not needed.
RemoteData - This class is a singleton that extends UnicastRemoteObject etc. and it implements all methods of the data class ( thanks for the tip Peter ) The difference is the lock and unlock methods have been implemented.
KeyGenerator - This generates a Unique timestamp which is used as my key for locking and unlocking.
FlyByNightServer - Creates a remote data object and binds it to the registry.
Ok, all classes are coded to interfaces which should allow for easy upgradability.
Design Decisions
I choose to modify the existing data class.
Ok, here is what I did, I changed the signatures of the lock and unlock methods and used a Hashtable for keys/records and it works as follows:
public String lock( int recNo )
When you call this method you place a lock on the recNo and are returned a timestamp key for the lock.
Submitting -1 places -1 in the registry and locks down the RemoteData class.
public void unlock( String key )
You submit your valid key and the record will be unlocked. I don't need the recNo because a key is unique.
RMI vs. Sockets
I chose RMI has it has a good implementation of sockets already and it allows for rapid develop of a robust threaded server.
Please fire away with thoughts and critisms. I am still working on the "proper verbage" in my read file, but this should give you guys an idea of my thoughts and allow you to give feedback on my design.
thank's in advance!!
Matt Ghiold
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone? Someone must think something, if you need additional information, please feel free to ask.
No, tomorrow we rule the world! With this tiny ad:
how do I do my own kindle-like thing - without amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!