Graphics Programs Reference
In-Depth Information
The possibility of multiple controllers interfacing with an external source leads to another
complication. Often, you need keep track of the application's exchanges with an external
source. For example, a web service might require you to pass authentication credentials
each time you make a service call. If multiple controllers need to make calls to this web
service, then each one has to know about these credentials and know how to send them to
the server ( Figure 28.3 ) . Caching data is another example of a problem here. If you are
caching responses from a web server, each controller needs to make decisions on when to
cache, when to load from the cache, and where the cache is stored.
Model-View-Controller-Store puts request logic into a separate object, and we call this
object a store ( Figure 28.4 ). Using a store object minimizes redundant code and simplifies
the code that fetches and saves data. Most importantly, it moves the logic for dealing with
an external source into a tidy class with a clear and focused goal. This makes code easier
Search WWH ::




Custom Search