Cairngen Roadmap

It has been awhile since I initially posted the pre-alpha release of Cairngen in early January. As I had mentioned in the original post, Cairngen was simply a tool which I created to help speed up my own personal development process when building Flex applications with Adobe Cairngorm. My intentions were to share the project “as is”, as I had assumed other developers would certainly benefit from using Cairngen to quickly generate Cairngorm classes and project directories. I have since received numerous E-mails from many developers who are using Cairngen and the feedback has been very positive.

In part, I released Cairngen to demonstrate just how easy it was to build a simple tool to generate Cairngorm projects and templates. From start to finish the pre-release version of Cairngen took around 6 hours or so. Another reason I released Cairngen was in the hopes that other developers with the required time available would take an initiative and build a proper Eclipse based plug in version of Cairngen.

Since Cairngen’s pre-release, there has been many developers building their own versions of Cairngen in other technologies, and I see this is as a very good thing for the community. Originally, I was contemplating releasing Cairngen to the community as an open source project in order to allow developers the ability to extend the APIs to suit their particular needs. This would alleviate much of the need for my continued maintenance and support of the project.

So what is the future of Cairngen moving forward? Ultimately, I have decided to re-develop Cairngen from the ground up as an Apollo application. Building Cairngen in Apollo will give me maximum flexibility and allows Cairngen to run as a stand alone application. I still have some additional research to complete before I can officially confirm, however, it will definitely be possible, and it will also help build interest in the Apollo community as well.

So if you are developing applications with Cairngen you can expect the version 1.0 release to be available as an Apollo application shortly after the alpha release of Apollo is available. If you have any requests for the 1.0 release feel free to comment.

Local Persistence API

There are a number of different ways in which a Flex application can persist data. Typically, in most real-world situations data is persisted on the server, but for specific situations where it is logical to persist data locally on the client in order to reduce unnecessary overhead, flash.net.SharedObject is the preferred solution.

SharedObject is easy to use and provides a relatively simple base API from which developers can utilize in order to persist data locally. However, in order to enforce that local persistence is maintained consistently across applications, a more robust API is needed.

Local Persistence API allows developers to consistently work with session specific data. The data is persisted locally on the clients file-system via SharedObject. Data can be saved and accessed intuitively in accordance with rules governed by the Flash Player Security Model.

Local Persistence API provides a solution which allows developers to create session specific timestamps and genuine unique identifiers (GUID), consistently get / set and delete persisted properties without knowledge of the underlying implementation, specify specific object encoding for persisted SharedObjects as well as SharedObject name validation and invalid charachter substitution.

    Local Persistence API is protected under the MIT license. You can download the LocalPersistenceAPI bundled compiled source, asdoc and uml documentation.

    Managed ResourceBundle API

    The most common methods used to externalize or internationalize an application in Flex 2 are typically either an XML implementation or a ResourceBundle implementation. Both provide their own unique advantages and disadvantages.

    XML requires additional structural data which needs to be parsed in order to retrieve specific values, and, more often than not, results in larger files sizes. ResourceBundles must load each associated .properties file at compile time. Additionally, Flex Builder also contains a bug which causes a random compiler error to occur while attempting to resolve a reference to a .properties file for a specific ResourceBundle. However this error typically can be resolved by cleaning your project.

    IMHO, internationalizing and externalizing an application is much easier to do when working with ResourceBundles. Partially because they are ideal for working with locales and configurations, and also because ResourceBundles open up numerous possibilities in regards to externalizing an application, runtime class loading and so forth.

    The ResourceBundleManager provides an easy to use API which allows access to multiple ResourceBundle instances from a single, centralized location. All ResourceBundle instances for an application can be added, deleted and accessed by ResourceBundleManager. ResourceBundleManager provides methods for working with a typical ResourceBundle which allows all ResourceBundle properties to be accessed as a single, virtual ResourceBundle.

    The ResourceBundle API is published under the MIT License. You can download the ASDoc and swc which contains an example Managed ResourceBundle API Flex Project.

    Configurable ContextMenu API

    The ContextMenu classes in ActionScript 3: ContextMenu, ContextMenuItem, ContextMenuBuiltInItems, provide a good base for working with context menus in Flex 2, however, they do not provide an intuitive API for developing and working with custom context menus.

    Such is the case whereas an application requires the flexibility to dynamically add, remove, enable and disable ContextMenuItems at runtime. To meet the requirements for an application which needs to meet any of the criteria I just mentioned, developers have 2 options; either work with the ContextMenu classes directly or develop a more intuitive API to provide the required functionality. I prefer to roll my own APIs in these situations.

    The ConfigurableContextMenu API allows developers to dynamically create custom context menus in which items can be added, removed, enabled, disabled and cloned dynamically at runtime. This opens up numerous possibilities such as adding individual context menus for each item in a DataGrid, or each node in a Tree, etc.

    The ConfigurableContextMenu API addresses certain issues which fail silently in the ContextMenu class such as ContextMenuItem collision and so forth. Developers can add caption items that do not require a listener or command items which contain both a caption and a listener to handle the item when selected. Items can be removed, added, cloned, enabled and disabled dynamically at runtime. ContextMenus can be created with a listener which is invoked when the contextmenu is selected (right-click). ConfigurableContextMenus can be added to any InteractiveObject or sub-class of InteractiveObject.

    The ConfigurableContextMenu API is published under the MIT license.

    Release version API

    I have published a software release version API which allows developers to set valid software release versions for a Flex 2 application. Release versions can be utilized for specifying additional meta data within a Flex application.

    The release version API contains a main entry point, ReleaseManager; a Singleton containing a reference to the ResourceBundle instance which comprises each valid release code.

    A release is set by specifying a valid release code which is defined as a constant in the ReleaseCodes class as follows:

    Each release code is mapped to a corresponding value in release.properties as follows:

    • SR00PA=Pre-Alpha: {0}.{1}.{2}
    • SR00AV=Alpha Version: {0}.{1}.{2}
    • SR00BR=Beta Release: {0}.{1}.{2}
    • SR00RC=Release Candidate: {0}.{1}.{2}
    • SR00GA=General Availability Release: {0}.{1}.{2}
    • SR00UR=Unstable Release: {0}.{1}.{2}
    • SR00SR=Stable Release: {0}.{1}.{2}

    The tokens in each release code are substituted by the developer according to a projects current release version; major, minor, revision/build.

    You can download source as well as view the ASDocs

    Label statement in AS3

    In ActionScript 3 a label statement is used to associate a statement with an identifier which can be referenced by both the break and continue statements to exit a block of code. Basically, a label statement is the equivalent of goto in C – yes, I know what you’re thinking!

    For instance, in a nested loop, a break or continue statement will only break out of the immediate loop and will not skip the entire series of loops (the end of the outer most loop) as one might expect. Labels are used as identifiers for an entire block of code from which a break or continue statement can reference in order to skip the entire series of loops or a specific loop from within a series of nested loops.

    An example of how a label statement can be used to break out of an outer loop is as follows:

    A label may also be referenced by a break statement to exit a block statement as follows:

    Typically, it is rare that you would need to use the label statement, however, in certain situations if it is necessary and can be justified, the label statement provides a convenient way to exit code.