Using Flex Code Generator (FCG) with Flex & PureMVC

Recently I’ve been working on a Flex prototype using the PureMVC framework. I will talk at length another time about just how much PureMVC successfully solves a lot of problems that we encounter in interface development and especially about how much this framework is important for all those complex interactions that we expect out of our RIA interfaces.

Starting out with PureMVC is not a particularly easy task. It is a good thing that there are decent documentation and examples, at least for AS3. At first when I read the documentation, it made sense only on a high level, but translating that high level understanding to code right away was out of the question. I solved this initial sticking point by looking at a couple of AS3 examples like CafeTownsend and EmployeeAdmin, where you can see how the framework works on the right size demo app, not too big and not too small.

One of the things that you will first notice is a constant repetition of code when creating your Mediators and Proxies. Nothing bad about it, it’s all for a good cause, but it’s extra time. Flex Code Generator (FCG) by David Deraedt is an excellent tool that saves you time by automatically doing the obvious. And more.

  • It creates Mediators and Proxies.
  • It can create AS3 Value Object out of PHP, Java or C#.
  • It can create AS3 Commands and Business Delegates out of your Remote Service files.
  • It can publish AS3 files you made directly to your development environment.

The greatest thing about it is that it has an extremely easy to use interface. Like any other code generator, it can not do all the work for you. That is your job. But for the part that it does — and it’s the laborious part too — it does it well. I have read comments about bugs but I haven’t experienced them myself yet. The author of the project is not thinking of taking this any further than it is at the moment because Adobe seems to be picking this issue up. You can read about this more at the bottom of this page. Until they do, FCG is a great tool to use to bump up your Flex productivity with PureMVC. Kudos to David for making it available!

  1. Ben Reply

    Great tool, but I personally prefer staying in my IDE; FDT really easily allow doing quite the same things with its templates (

  2. Ansury Reply

    The problem I’ve always had with code generation (and the large amount of files and code it encourages) is that while it may seem great for the initial developers who choose to use verbose frameworks, you’re making your O&M developers’ lives hell with all that bloat.

    I honestly would be interested in hearing what type of UI development problems PureMVC solves, which agile lightweight alternatives like Swiz do not address. (I’m assuming this is one of the points you made above, otherwise you’d be using Swiz instead.)

Leave a Reply


captcha *