Saturday, 1 August 2009

Parsley 2.0

On my last 2 projects I have been using Parsley 2.0. An IOC framework for Flex.

It is an alternative to Cairngorm and does a lot more on top. I have used Cairngorm for a long time and did like it but when you get used to Parsley you really start to appreciate the benefits.

Tom Sugden who I worked with on my last project has written a good blog post about IOC in general here and has some specifics about parsley.

I’ve implemented a sample project that demonstrates dependency injection, managed events and modules. The sample is here and a zip of the project is here. This is a Flex 4 project so you’ll need to download Parsley from SVN and patch it.

The sample project has 2 views in the root with a different instance of the same PM injected into them. The PMs both have the same global domain object injected into them that has a string in. This string is displayed in the text area and you can see that any changes are reflected in both views.

You can also load Module 1 and then load Module 2 inside Module 1. Parsley creates a child context for each of these modules but messages still flow to and from the modules as does the injecting of the global domain object.

The area at the bottom of the screen is a custom log target that displays logs from parsley so we can see what’s going on.

If you want to find out more about parsley the spice factory home page is here. There is some great documentation and a really good forum with excellent support from the creator Jans Halm.


  1. Link to the sample seems to point to your hard drive.

  2. Thanks for letting me know, link now fixed.