0 Replies Latest reply on Nov 12, 2009 12:57 PM by Abram Adams

    ColdFusion AIR Synchronization - Best practices

    Abram Adams Level 1

      I'm a long time ColdFusion developer who has put off learning Flex because I never had a need (not to mention the bad taste Flash left in my mouth in its early stages).  Now I'm jumping in because of its integration with Air+SQLite and Coldfusion9 that allows online/offline support.

       

      Really cool stuff, but to my knowledge there are only two blogs that have a post about how to do this synchronization (Jayesh's blog and Terrance's blog), both of which use the same sample application.  So I'm hoping there are experts on this subject (which is not entirely CF+Air sync related), can shed some light for me.

       

      My questions are from a best practice standpoint, primarily: where should all of this code go?  Let me be a little more specific (and I appologize in advance for my misuse of termonology, and my overall ignorance of OO ):

       

      1. In the example code there are two tables (AS classes): Address.as and Customer.as.  The contents of these files and the ORM concepts in general I understand.  However, the files are lodged in a folder called "onetoone" in the main "src" directory.  In a best practice scenario, should these be in a "model.vo" directory (assuming no other frameworks are being used)
      2. Also in the example code, all of the AS code that handles connecting to the back end, fetching, saving to SQLite and back to the server is in the main application mxml file "CFAIROfflineCustomerManagerApp.mxml".  I'm not a Flex developer yet, but I don't think this is good.  I guess it's fine for a simple 2 table scenario, but in real life this will become a huge beast.  How would this best be broken up into separate files?  I'm relatively new to OO, I get the concepts but haven't used it in a pure form in any production applications.  My initial inclination is to separate the code that deals with the CF back-end and the SQLite database into a "services" directory and all the code that pulls that data into the UI (and stuffs it back) into a "controllers" directory.

       

      Perhaps one of the many frameworks out there may clear things up for me?  I have been reluctant to use a framework at this point because I would like to understand better what they solve before choosing a framework.  Are there any examples of this new sync feature via cfair.swc in any of the popular frameworks?  I've searched, but turned up nothing.

       

      I think this is enough for now.  I like to keep my code really organized, and before I get too far into writing bad code in an unorganized way - I thought I'd ask for some guidance.  At least this way I can write bad code in an organized way!

       

      Thanks in advance for any advice, resources, etc...

       

      --Abram