Here we are defining MVCS from Flex and Parsley perspective.Following MVCS, there can be various kind of layers and interaction.
Layers and Flow of control
- View
- MXML and View Logic
- Interacts with Presentation Model for data
- May Interact with Commands for action implementation
- Presentation Model
- Contains data state for view, may contains data transfer object from Service
- May interact directly with services for data related operations
- Or can have interaction channel with Commands to have update for data
- Injected in View as stateless object
- Commands
- Contains view logic to act upon various user action from UI
- Helps to break the UI logic in various objects which acts based on the action
- Interact with Services for data related operations or Business Logic
- May update the presentation model for data state
- Can act as singleton stateless objects and linked with event mechanism
- Or view can have their reference as per architecture preference
- Service
- Contains business logic and data related operations
- Can be on server side and may be implemented in various language like PHP or Java etc
- Can be on client side in case of desktop application, can use assql like MySQL connector to interact with database
- Service Delegates generally injected in Commands or Presentation Model using DI
Now there are many interaction models between these four layers depending upon overall application architecture or architect preference.