Graphics Programs Reference
In-Depth Information
Other Benefits of Store Objects
Now that you've changed Nerdfeed to use a store and added new features involving extern-
al sources of data, let's return to the general concept of store objects and the benefits of us-
ing them.
The main selling point of store objects is that we move the burden of dealing with external
sources of data away from controllers and put all the request logic in one place. This is
reason enough to use MVCS, but we've found other benefits of using store objects that
we'd like to share.
We can write the controller logic of an application independently of its store logic. This
really carries two benefits because the controller and store logic are independent in time
and in space.
When beginning a project, sometimes the external sources aren't ready for primetime, and
the store logic can't be finalized until the sources are ready. For example, if the external
source is a web server, the web service calls may not be able to be written until the project
is nearly complete.
Using stores prevents this situation from becoming a scheduling bottleneck. A store object
can expose all of its methods to controller objects so that the rest of the application knows
what to expect. In addition, the store's actual implementation can provide interim fake data
to controllers that make requests.
Once the external source is finalized, the store's implementation can be updated to handle
the final details. The good news for the project is, at this point, only the store object must
be changed; the rest of the application will work as-is.
Independent store and controller logic also means you can have programmers working in-
dependently on each. As long as the interface between them is simple and (ideally) remains
unchanged, the programmers that write the store and the programmers that write the con-
troller can work in parallel. This can speed up your project's development.
Typically, the code in a store object is more difficult to write than the code in the controller.
Most developers can wire up a controller and its XIB file, but it takes experience to write a
good store object. You have to know how to write flexible and robust code. (It also helps to
have been through the wringer a few times and seen how things go wrong and how to fix
them.) At Big Nerd Ranch, we typically have our senior-level people write store objects
Search WWH ::




Custom Search