LoaderQueue with strategies

Posted: August 25th, 2008 | Categories: Actionscript 3.0, Design Patterns | No Comments

With the loader queue it is easy to load data (f.e images or xml) application wide in a priority queue. This version uses encapsulated ILoader implementations and is therefore easy to extend.

The loader queue has the following tokens:

  • priority
  • stop/pause/resume services
  • remove services
  • In addition it is possible to parametrize the loaded data with an anchor that could be of any type. This is very useful when images belong to specific objects (see code example).

    For a new need of a loader implementation a programmer just had to write a new specific loader strategy that implements ILoader.

    Basic implementations like a Loader and a URLLoader for loading Loader and URLLoader specific data can be found in the addicted2flash library.


    How to use AS3-Collection-Framework

    Posted: August 17th, 2008 | Categories: AS3-Collection-Framework, Actionscript 3.0 | 1 Comment

    There are different types of data-structure present in the AS3-Collection-Framework. Each of it has it's advantages and disadvantages. So before using it, it's recommended to first think about the requirement.


    Lazy is not always bad…

    Posted: August 5th, 2008 | Categories: Actionscript 3.0, Design Patterns | No Comments

    Lazy data-structures are structures that could be requested and are therefore not necessary loaded at request time.

    Besides "lazy" data retrieval another important aspect of these data-structures are often the possibility to cache executed requests. To reduce http-requests on server-side it's necessary to cache the results of former requests on client-side.

    To solve this problem a data-structure must be created on which specific ranges can be requested. Configured with a specific page size, data can be loaded with a constant size and requests therefore easily be cached.


    Advantages of collection based data-structures

    Posted: August 5th, 2008 | Categories: AS3-Collection-Framework, Actionscript 3.0 | 1 Comment

    In many situations programmers are forced to manipulate data structures.
    These could be indexed based retrieval of data as well as sequential followed traversing. These structures are coded at least a hundret times in different projects.

    To follow the fundamental thoughts of object oriented programming, there necessary has to be a common data-structure that ensure the maintainability and reusability of software.
    Collection classes such as sets and lists are ideal candidates for software reuse and can therefore play an important role in object-oriented class libraries[EMKS98].


    Extended Observer-Pattern

    Posted: August 3rd, 2008 | Categories: Actionscript 3.0, Design Patterns | 3 Comments

    The following post discusses an "extended" version of the Observer-Pattern.

    The intent of the observer pattern is often described as an one-to-many dependency.
    The key fact is that when one object changes its state, all listeners are notified about that change [GHJV95].

    There are only two relevant kinds of objects in this pattern, observers and an observable.

    An observable is basically an object that holds information on which other objects (observer) could be interested in.
    When the data-state of the observable has changed the observers are notified about the change.
    This kind of interaction is called publish-subscribe. The observable is the publisher of notifications. It sends out these notifications without having to know who its observers are[GHJV95].


    Actionscript 3.0 Collection Framework almost finished

    Posted: August 3rd, 2008 | Categories: AS3-Collection-Framework, Actionscript 3.0 | 1 Comment

    About 2 weeks ago, I started to rebuild JAVA's-Collection-Framework to Actionscript 3.0 requirements in my free time.

    To my mind, there were some overengineered interfaces like the IDeque-Interface, which I decided to kick it out.

    I think there are a few classes, which provide interesting and useful functionality and so there is still a way to go. But I think that the base classes in util-package are almost finished and ready to use.

    Check out the the source-code.

    If anyone is finding bugs or has good tasks about performance issues, I would be very pleased to hear from you.