Section 3.36. A synchronous test drive


3.36. A synchronous test drive

When you run the synchronous version of the coffee maker application, you should notice quite a big difference. As soon as you click on "Order Coffee", you're stuck. The button stays highlighted, and if you try to enter another order, you get the spinning beach ball (on Macs) or the hourglass (on Windows), meaning "You'll have to waitI'm busy!"

As soon as you click on "Order Coffee", you're stuck.

Nothing else can happen until the response comes back from the server. You won't even see the status of the coffee maker change, because that code can't run!

If you try to do something else, like start a new order, you won't see anything happen, because everything is frozen until that response comes back. You just get your system's "wait" icon.

...time passes...

The coffee is finished brewing, the status of the first coffee maker is set to "Idle" (because it's done brewing again), and you never actually see the "Brewing" status.

All that work to add another request object, and now you can't even use it. Synchrony sucks when it comes to coffee makers!




Head Rush Ajax
Head Rush Ajax (Head First)
ISBN: 0596102259
EAN: 2147483647
Year: 2004
Pages: 241

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net