• 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

NX: refreshing/updating "old data"

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(Hotel booking assignment)
Is anyone implementing something where the server will notify clients when data has changed? In other words, a client has performed a search and has a list of hotel dates available. Over time, this data becomes old. If the client sits for ten minutes, it's possible that many of the dates in the list are no longer available because other clients have reserved them. So the server could send a message to the client whenever a reservation is made, allowing the list to stay accurate.
Another variation to the server-notification would be something like a timed refresh on the client end. Or the client could be required to press a button called "refresh" to obtain the latest data.
Any comments?
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Perry,
What do your requirements say about dated data?
The old assignment had the following:

It is not necessary to provide for live updates on multiple clients when new bookings are made at other clients.


Under these guidelines you could implement your solution, but remember two things:
You Arent Gonna Need It (YAGNI). Trying to implement what you think might be a future requirement can be a wasted effort.
The more you go out of scope, the more the examiner has to pick at (and could therefore cost you marks).
Regards, Andrew
 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While my question is, is it ok to book the already booked room? I am wondering about that.
regards!
Frank
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Frank,
You said: is it ok to book the already booked room?
I guess if it is not explicitly disallowed then you could do it, as long as you give a message that you are now bed sharing
Seriously though, this is where the record locking comes in: at the time you want to book the room, you should lock the record, confirm that it is still vacant, book it, then unlock it.
This is what happens in real life - normally clients do not get live updates when data changes.
Think about a normal hotel offering rooms for the night. Now think about how many travel agents there are in your town who may be able to offer those rooms to you, Multiply that through all the towns and all the cities in the world, and you quickly realise that sending all updates to all the agents would be impossible. Likewise tracking which agents are inquiring about certain numbers of rooms over certain numbers of nights would be a nightmare.
Regards, Andrew
 
Perry Board
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for responding, Andrew. My Sun assignment makes no mention of live updates. I am probably not going to include such a feature. I'll probably just do a check before the record is booked and if someone happened to jump ahead of another client, I'll display a message to the user saying something to the effect that the room is no longer available.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic