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

14. Saving, Loading, and Application Sta... > Model-View-Controller-Store Design P...

Model-View-Controller-Store Design Pattern

In this exercise, we expanded on the BNRItemStore to allow it to save and load BNRItem instances from the filesystem. The controller object asks the BNRItemStore for the model objects it needs, but it doesn’t have to worry about where those objects actually came from. As far as the controller is concerned, if it wants an object, it will get one; the BNRItemStore is responsible for making sure that happens.

The standard Model-View-Controller design pattern calls for the controller to bear the burden of saving and loading model objects. However, in practice, this can become overwhelming – the controller is simply too busy handling the interactions between model and view objects to deal with the details of how objects are fetched and saved. Therefore, it is useful to move the logic that deals with where model objects come from and where they are saved to into another type of object: a


  

You are currently reading a PREVIEW of this book.

                                                                                        

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

  

Start a Free Trial