Rapid client/server Flex application prototyping with fxDao

// July 1st, 2009 // fxDao

fxdaosmallAdobe Flex is a well known and widespread technology with a great and appreciated attitude to make development of software prototypes almost a joke (if you ever developed with Java Swing you perfectly know what I mean).

I refer to prototypes because when things become serious and you have to put code on the server side, basically to wipe out fake data and access real one, the development velocity begins to decrease.

Independently from the server side technologies and protocols you have chosen, you’ll have to write the code which will expose web services and data models. Generally this means that a boring, repetitive and, depending on the complexity of the application, not a really fast coding session is about to begin. Not to forget unit tests.

As a result of these considerations I developed fxDao.

The idea behind it is that Flex prototyped apps could use real data by defining ActionScript DAO classes which encapsulate data access logic, which means, SQL queries.

fxdaoclientOnce your prototyped (but really working) application will pass the POC phase, you can decide to rewrite ActionScript DAO classes in order to access server side web services. Since DAO classes communicate within the application by exchanging Value Objects (VO) and lists of VOs (the so called model), you don’t have to change a single line of code in the rest of the application.

Put in other and few words, fxDao is a simple PHP gateway used to execute queries on the server specifying them directly in your ActionScript code.

Query result is XML data packed with a REST approach but nobody prevent you to implement any other format. The format should possibly be the same of your web services, in orded to keep as much code reusable because VOs instantiation takes this data as its input.

I’m still in the POC phase of the project itself, which means that:

  • there is still some work to do on the server side, in order to make the gateway sound and secure and enable it to the use of transactions;
  • there is still some work to do on the client side, in order to provide ActionScript helper classes to facilitate the creation of query statements (think to the Active Record or Prepared Statement approach);
  • fxDao is open source and comes with a GNU General Puplic License so, if you like, you can contribute to its development. Any help will be very appreciated.

That said, you can download the first version of fxDao from the following URL: http://code.google.com/p/fxdao/

In this version fxDao is bundled with a simple Flex client which has the only purpose of testing installation. In the very next post I will show more details about how to write a very quick and simple Flex client which interacts with fxDao exploiting DAO classes.

See you soon.

2 Responses to “Rapid client/server Flex application prototyping with fxDao”

  1. Alan says:

    As to Ghalex’s AS3FlexDB, thank you for the great effort on fxDao.

    The serious thing i concern about this approach is not only the security but also the pain of callback function delay. The returned VO is not immediate but the result of an asynchronous process causing hardly to code in a coherence. For example:

    function A(): void
    {
    arrCollection = xyz.getRecord();
    arr:Array = arrCollection.toArray();
    …..
    …..
    }

    An error is surely thrown because arrCollection still null until the whole function A() finishes. So far, I cannot escape from this.

  2. Hi Alan, remote data access is always asynchronous in Flex, it’s not a problem of AS3FlexDB or fxDao.

    To escape from this you have to split your data access logic between call and callback functions, it’s not that complex if you get used to it.

    Regards, Alessandro

Leave a Reply