Graphics Programs Reference
In-Depth Information
Determining how to deliver results
The final option you must consider for store objects is how they deliver their response,
and the first step to answering this question is determining whether a store will be syn-
chronous (have its results available immediately) or asynchronous (need a little time to
obtain its results). The best example of a synchronous store is an object that accesses the
filesystem. The code may be complicated, but the request will be processed without any
delay. If you have a synchronous store, you should have it deliver its response to the con-
troller simply by returning a value from the request method. No muss, no fuss.
With asynchronous stores, there are more choices. The two big ones are delegation and
blocks. The choice between these two depends partly on the store object's singleton status.
A singleton store should not use delegation because it would limit the store to returning
data to one controller at a time. Instead, a singleton store can return its data in a block sup-
plied by the requesting controller. A store that can be instantiated can use either delegation
or blocks.
Search WWH ::




Custom Search