Thanks for the helpful comments and suggestions. Here is what I have already
looked at.

We looked at PureMVC for the project that I am on but stayed with Cairngorm
because of the applications already written in Cairngorm that are also part
of the project. However, we have written a version of notifier and
notification that are similar to PureMVC. After all that is simply an
implementation of the observer pattern.

The other programmer on the project doesn't believe that automated tests are
worth having and doesn't understand how to write code that improves the
ability to test so there is a bit of a challenge.

We are also using Maven for the build. The build incorporates Java host
modules as well as the Flex code. Our directory structure reflects the Maven
naming conventions src/main/flex and src/test/flex. The Flex Mojo builds its
own test runner for FlexUnit tests so I have created a test application in
the src/flex/main directory alongside the actual application file. This
allows me to run either the tests or the application from with in Flex
Builder.

My thoughts on getting around Cairngorm are to create an application
controller which holds a reference to the model, services, and front
controller. All other modules reference the application controller to obtain
a reference to these. Cairngorm doesn't really care whether the model is a
singleton but does require the front controller and may be services to be a
singleton. However, using the application controller, I am able to mock out
the front controller and services. This allows me to trap the command calls
for events and the calls to get services.

The other thing that I tried to put in place was what Martin Fowler calls a
Supervising Controller for each view (this is similar to PureMVC's
mediator). This has been removed for some views by the other programmer but
for the view that I am currently working on, it appears to be working well,
and the mxml view has no ActionScript in it. All events and status variables
are in the supervising controller. The view binds to the model and status
values. So far this seems to be working well and although I haven't written
tests for it yet, I believe that it shouldn't be too difficult.

Using the notifier and notifications, we are able to have the supervising
controller receive notification of events that update the status variables
thus eliminating the need for a view locator. These status variables could
easily be considered part of the model except that we have multiple views
within the application and that would mean creating special model elements
for each view to help make it clear what each of the status variables are
associated with. My thinking is that this makes the supervising controller
even of more value since it is clear where status values for the view are
held.

I hope to blog on this later once I have conducted more experiments and also
on comparisons between Cairngorm and PureMVC. I have already done some
comparison of Flex based testing frameworks (http://kiwi-et.blogspot.com/).

---------------------------------
Errol Thompson
Kiwi-ET Computing Education Research
Wellington, New Zealand
Phone: +64 21 210 1662
E-Mail: kiwiet (at) acm.org
        kiwiet (at) computer.org
Web: www.teach.thompsonz.net
---------------------------------

Reply via email to