you’re on your way 4
197
asynchronous applications
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 wait—I’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.
The coffee is nished brewing,
the status of the rst 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!
...time passes...