Chapter 7. Applying Business Logic
With the actors of our Model and View tiers now defined, we are ready to stitch them together and get things done. That is certainly the speciality of the Controller tier. But what kind of things do we want to do here?
Two Shades of Logic
Domain Logic
All of that code in ValueObject
, AbstractProxy
, and their subclasses is
Domain Logic. It deals strictly with
representing and persisting the data structures of our domain
model.
The VOs encapsulate any logic necessary to represent data as typed
objects and properties for manipulation by the rest of the program (in
this case, marshaling data into and out of an XML structure). Often
there is no logic, only properties on the VOs, or XML parsing logic
might end up in your Proxy
s, if it is
relatively simple, or in some form of delegate or helper used by the
Proxy
s if there is a lot of
it.
The Proxy
s and VOs take care of
persisting and retrieving the data in a reliable way. We do not want to
rely on Command
s in the application
to ensure the integrity of our data or be directly responsible for its
persistence.
Business Logic
By contrast, Business Logic has
to do with the aims, or business, of the application itself, fulfilling
its use cases. For example, opening a Story for editing by taking the
StoryVO
and making the appropriate
calls on the SelectionContext
to select the current Draft of the very last Scene in the Story, however its Scenes are grouped. This code works with the domain model data, but for the purpose ...
Get ActionScript Developer's Guide to PureMVC now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.