The GEMVC ActionScript framework is used for developing Flex applications in Johnson Space Center's Altair Lunar Lander project. Christopher Dean, the solution architect who created GEMVC, is also the chief scientist for the extensible information model (XIM) program for the Altair Lunar Lander project. InfoQ spoke with Dean to learn more about GEMVC.
According to Dean, GEMVC is a set of ActionScript classes that support a model-view-controller pattern (MVC). It is not a full-blown framework, because you can pick and choose which parts you want to use. It is composed of a model, a controller framework, and a service/gateway layer. The views are the Flex MXML files themselves.
When asked why he didn’t use one of the already available frameworks, Dean answers:
I initially looked at Cairngorm by Adobe Labs after I had already created my own service layer. I didn't really want to have to change it, because I liked how it worked and decided to make an MVC framework around it. Furthermore, I didn't like the way Cairngorm had only one main controller and everything was accessed through singletons, allowing only one model and one controller. I like to modularize my code, so I allow separate controllers for different parts of the application. Each Flex component could theoretically have its own controller. In the end, this is just a question of style.
Dean explains the major difference between GEMVC and the well established frameworks like Cairngorm:
The framework GEMVC uses Flex's dispatch mechanism instead of its own. I like this, because it allows a hybrid approach to executing events. In Cairngorm, all changes must be made via the model. This is fine in most cases. However, there are cases where you want to control the application as a result of an event and this may even involve calling ActionScript methods on existing components. With GEMVC you can do it easily without having to know the full dot path (which is brittle) to a component. You only need to know the identification of the component that handles the event.
Dean says that, in addition to the Altair Lunar Lander program mentioned above, GEMVC is being used in the Stardust project for the Astromaterials Research and Exploration Science Directorate. The program manages all the samples coming back from the Stardust probe.
With respect to the future, Dean says:
There have been some ideas bashed around on the riaforge blog about possible future uses, but I can say for a fact that there are three things coming soon for GEMVC.
- Support for Producer and Consumer functions in the service layer. This is already complete and the distribution will be updated any day now
- Support for using MXML tags to specify controllers in MXML files instead of a separate ActionScript file. This is a style issue, since some people are more comfortable with MXML than ActionScript
- Improvement of hierarchical controllers. Currently there is no way for a component controller to process part of an event and then propagate it up to a higher controller for further processing. This has come up in the XIM project and while it can be worked around, it is much cleaner to be able to do this. Having controllers handle events themselves instead of the events has also been discussed.