• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

lock on local client

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
When running in local mode should you still
lock the database or should you have different
booking methods for local/remote
//Cecilia
 
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't lock in the local mode and you can check the mode and do it appropriately.
 
Cecilia Anderson
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It doesn�t seem right to check the mode and then decide which "booking" method to use. I mean for every time I want to perform an operation on the database I will have an ugly "if (local)" statement. Isn�t there another way to do it??
I perform all operations on a DataAccessInterface which can be either the Data class (in local mode)
or the remote implementation.
//Cecilia
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did it like the way you have it my submission and I came to know from Mark and others that this one of the reasons why I got low marks in General Considerations.
What you need a Facade which has a bookFlight() method. Only in that code, you have to check for the mode of operation. You may have to add it to the delete method also.
[ May 30, 2002: Message edited by: Sai Prasad ]
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, and even simpler and cleaner, if you have a factory to return either LocalDataAccess, or RemoteDataAccess class in the beginning of your gui code, and pass either one to your facade, your facade doesn't have to have an if statement to check the mode, it just passes it to the reference of a DataAccess implementing class, which is what LocalDataAccess and RemoteDataAccess classes are.
So in my code the only place I have a "If" statement is in the beginning so that the factory class knows which implementation to return.
Mark
 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mark -
There is one word in your post that might throw folks off. When you say

it just passes it to the reference of a DataAccess implementing class

it sounds at first like you are passing the mode to the DataAccess, which doesn't make sense in this context, but what you mean is "it just passes it the reference of a DataAccess implementing class".
Right?
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, it should say it passes the method calls to it. Not the mode.
Thanks
Mark
 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Mark Spritzler:
Yes, and even simpler and cleaner, if you have a factory to return either LocalDataAccess, or RemoteDataAccess class in the beginning of your gui code, and pass either one to your facade, your facade doesn't have to have an if statement to check the mode, it just passes it to the reference of a DataAccess implementing class, which is what LocalDataAccess and RemoteDataAccess classes are.
So in my code the only place I have a "If" statement is in the beginning so that the factory class knows which implementation to return.
Mark


Does this mean that:
1. Facade has only the bookFlight() method.
2. RemoteDataAccess class has the lock/unlock methods implemented?
3.And irrespective of mode the lock/unlock methods will be called, but they will be handled differently based on the local and remoteDataAcess classes, right?
thanks,
sri
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Basically yes to all three of your questions. Although my facade had a few more methods other than bookFlight().
Mark
 
Sri Addanki
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mark,
Thanks alot for the info!
In my design i have a separate class for bookFlight() method, which acts like a facade.
Apart from this there's an other class which has all the rest of the methods. I did this, so that,
if i had to change the bookFlight() method then only one class is changed and not all the classes.
Is this ok?
Should i integrate these two classes into one facade? What kind of design pattern am i using here?
thanks,
sri
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Basically I look at it like this one class to handle all the clients request.
bookFlight()
getDepartureAirlines()
getArrivalAirlines()
getAirlines()
getAvailableSeats()
searchFlight()
there are a few private methods also that help the above methods.
Mark
reply
    Bookmark Topic Watch Topic
  • New Topic