From Implementation Idioms and Best Practices 1
The first distinction to make about the logic in your application is that of Business Logic and Domain Logic.
Commands house the Business Logic of our application; the technical implementation of the use cases our application is expected to carry out against the Domain Model. This involves coordination of the Model and View states.
The Model maintains its integrity through the use of Proxies, which house Domain Logic, and expose an API for manipulation of Data Objects. They encapsulate all access to the data model whether it is in the client or the server, so that to the rest of the application all that is relevant is whether the data can be accessed synchronously or asynchronously.
The key thing to keep in mind here is that the Model classes (Proxies, VOs, Enums, and the like) may often be reused in more than one application; say, an AIR desktop client and a Flex web client that have different use cases but carry them out against the same Domain Model. Therefore, the Model tier classes should know nothing about the business needs of the application it is a part of 2
and should only be concerned with the data, how to get it, and how to make sure it's clean.
Keep in mind also that the responsibility of maintaining integrity can be spread across the Proxy and data objects (such as a VO or Enum). Using an Enum, for instance gives you a built in list of valid settings, which can fill a combo and restrict the user to the correct input 3
. And any property on a VO can easily be turned into a set of accessors (implicit getter/setter pair) which can ensure that the data is set properly, provide defaults, derive settings, etc)4
This includes not referencing constants or classes defined in the Facade or the View and Controller 5
tiers. Consider writing your Model classes from the start in a separate library project, imported into the application. This will put up a physical barrier to code dependencies in the Model which will have no access to the application classes. 3
See an example of an Enum in the model package of the Employee Admin demo: http://puremvc.org/pages/demos/AS3/Demo_AS3_Flex_EmployeeAdmin/srcview/4
See an example of a 'Smart VO' here: http://forums.puremvc.org/index.php?topic=1293.msg5973#msg59735 From the 'exceptions to every rule dept:
While Commands are generally registered by the application's Facade and used to execute Business Logic
for keeping the View in sync with the Model, it is possible to create Commands that are packaged separately with Model classes and that are registered by the Proxies themselves rather than by the application. Then the Proxies can send Notifications to these Commands, confident that they will be registered to the note names they know, and use them to offload Domain Logic
tasks that would otherwise make for a cumbersome Proxy.