Enterprise Flex Model – v0.3
Version 0.3 of my new Flex enterprise development model got quite an overhaul. For those who are not familiar with the background of this posting, I am on an endeavor to create an alternative to Cairngorm and PureMVC for enterprise Flex/AS3 application architectures; particularly one which caters specifically to the Flex framework and is not based purely on J2EE best practices. A few points worth noting that I have yet to point out with this architecture:
The UIController
The UIController is meant to be a singleton class that provides access to the central event dispatcher (the event bus), as well as the model, which would likely be a getter for a centralized model class in the business library, which then has getters and setters for all the value objects contained in the model package. The UIController would be instantiated by the LifeCycleManager class, which would also have the responsibility of determining the application’s initial state (for example, if credentials are already in the encrypted local store and can be validated, go straight into the app without asking for credentials). The lifecycle manager also waits for a “MODEL_INITIALIZED” type of event, letting it know that any of the necessary client-server communications required prior to display of the initial application state are completed, at which point it instantiates the UIController. The UIController would also contain a command called something like “setBindings”, which would iterate through the bindingDictionaries package and set the bindings accordingly. With regard to this method of setting bindings, I still haven’t figured out how to handle non-instantiated view components with regard to this process yet. My objective here is to somehow centralize all of the bindings so that the developer can see how everything is “mapped” so to speak between view components and the data model. Technically, this is where the controller logic in the MVC pattern lies in this architecture.
Obviously there are some inherent issues that come with this. My concern is that when an architecture has a substantial use of registries, the design patterns within the architecture become suspect. However, it seems that it is most logical right now to use internal registries for services, commands, and events (although this may change).
Demarcation of the Business Layer
In the diagram, the demarcation of the business layer is quite clear, as I have now separated the architecture into two primary layers, one for business logic, and one for the actual GUI. For example, client-server communication and the construction of the model in the form of value objects happens within the business layer. Say for example that we have an AIR application that must ask the server if there are any tasks that have been created on the server side for it since the last time it ran. The server responds with a task to remind the user that their subscription is about to expire. That is then stored in the applications local sqllite db, and the task is sent to a task handler queue to be handled in the background while the application is running. When its time to handle the task, a notification event is fired, which goes through the event bus and displays the message in the UI.
If you have any questions and/or feedback, please do not hesitate to comment. Questions and comments are critical for identifying weaknesses with this architecture.
Possibly Related Posts:
- Second Generation Micro-architectures, Part 1: The Swiz Framework
- Using the Zend Framework to take some wind out of AIR
- Thinking Outside the IDE: Ideas for Flex Architects
- Micro-architectures for Flex Enterprise Development
- Understanding Flex Communication Protocols
Posted by Dan Orlando on February 12th, 2009 :: Filed under Enterprise Flex
Tags :: AS3 Design Patterns, Enterprise Flex, OOP


