Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

8. Advanced Model Topics > Handling Synchronous Behavior

Handling Synchronous Behavior

In the StoryArchitect application, our Proxy subclasses interacted with the filesystem in a synchronous fashion. That is to say, the result of reading a file is available to the next line of code, and you may begin working with the retrieved data immediately. This is nice because the calling code is usually in the middle of doing something when it makes the call and would probably like to get on with it.

Here is an example from StoryArchitect of a Proxy method and the calling Command using the fetched data immediately as it carries out a use case. The ApplySelectionCommand has to select a Story (a view-related endeavor), but needs to be sure that if the Story is a stub (as it would be from a list), it is fully loaded when placed on the SelectionContext. Notice the ease with which the result is consumed in the Command.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint