Posted: October 26th, 2008 | Categories: AS3-Layout-Framework, Actionscript 3.0, Design Patterns | 1 Comment
The new AS3-Layout-Framework is now available in the addicted2flash library.
The architecture is straight forward and easy to understand (hopefully). It is basically constructed on top of two abstract interfaces named IComponent and IContainer. The main difference between them is the possiblity to add components.
Posted: August 26th, 2008 | Categories: Actionscript 3.0, Design Patterns | 2 Comments
Very often it is necessary to use an obervable-pattern in its basic structure, which means that the observable notifies registered observers after its internal state has changed.
This implementation concept is very static and has the side effect that the observers are notified every time the model has changed regardless of which change they are interested in.
In this case it is recommended to use a more dynamic approach like an specific observable.
But if you only have one value in the model which changes, the MicroObservable structure could be very useful.
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.
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.
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].