Application Building Blocks part 1 - Sections
The Sections are the base logical and application building blocks in an application based on the GUGGAFF. Sections implementation follows the Page Controller design pattern. Each section is responsible for displaying and controlling one logical part of the application. The scope and content of this part can be defined depending of the needs in every single application. Each section should follow the rule for logical encapsulation, and should have a consistent lifecycle.
Sections Lifecycle
The lifecycle of a Section is comprised of five sequences – Initialization, Activation, Opening, Closing and Destroying. They are actually referenced as Tasks but thanks to the Composite pattern used, we can have complex sequences at this places. Each of those Sequences will be executed when that cycle step is due.
Initialization
Section initialization sequence is triggered when the section is instantiated and should initialize itself to become fit for work. This can include components creation, essential data loading and other tasks that ensure the workability of the section.
Activation
Activation sequence is triggered in the very first moments when the section is about to be opened. The opening of a section is triggered only when the closing sequence of the previous section is complete. This way the Activation sequence starts with the previous section’s Closing sequence. During the Activation sequence the section can prepare itself for the upcoming Opening sequence. It can for example perform lazy loading by loading its data here but not in the initialization sequence.
In a common scenario the Initialization and Activation sequences are time consuming tasks. They must also complete prior to the Opening of the section and we have to entertain the end user during that time period. That’s why each section provides its controller a way to monitor the progress of the tasks which precede the Opening. These tasks are not coupled with the initialization and activation sequence sequences. They can contain subparts of them, but its programmer’s choice what to put in the pre open progress monitor.
Opening and Closing
One of the key aspects that is used in every web site is the ability of the sections to open and close. Those sequences common use is to play animations. Closing tasks can also be used for freeing some temporary allocated resources.
Destroying
The destroying sequence of the lifecycle is not as common scenario. Its usage appears when dealing with sections that feature large amounts of content in them which should be destroyed to free the flash player resources.
The common functionality for controlling the section’s lifecycle is implemented in the gugga.application.Section class. All the sections in a GUGGAFF application should extend this class.
Nesting Sections
Sections can be nested. They follow the Composite design pattern to implement this functionality. A group of nested sections is controlled by a Sections Controller (gugga.application.SectionsController), which is a Section it self. In addition the Sections controller is responsible for switching between its child sections which must be registered with him.
There are three types of sections that can be registered with a Sections Controller. Sections that are already instantiated on the scene and you can reference their instance names.
Lazy attach sections which exist in the library, but are still not instantiated.
Sections that will be loaded as external Swf files.
Navigating between Sections
When a command is issued to navigate from one Section to another, the Section Controller instantiates a Sections Transition (gugga.application.SectionTransition) object which handles the transition. This object does all the work to ensure the correct lifecycle of the sections involved in the transition.
Sections Lifecycle
The lifecycle of a Section is comprised of five sequences – Initialization, Activation, Opening, Closing and Destroying. They are actually referenced as Tasks but thanks to the Composite pattern used, we can have complex sequences at this places. Each of those Sequences will be executed when that cycle step is due.
Initialization
Section initialization sequence is triggered when the section is instantiated and should initialize itself to become fit for work. This can include components creation, essential data loading and other tasks that ensure the workability of the section.
Activation
Activation sequence is triggered in the very first moments when the section is about to be opened. The opening of a section is triggered only when the closing sequence of the previous section is complete. This way the Activation sequence starts with the previous section’s Closing sequence. During the Activation sequence the section can prepare itself for the upcoming Opening sequence. It can for example perform lazy loading by loading its data here but not in the initialization sequence.
In a common scenario the Initialization and Activation sequences are time consuming tasks. They must also complete prior to the Opening of the section and we have to entertain the end user during that time period. That’s why each section provides its controller a way to monitor the progress of the tasks which precede the Opening. These tasks are not coupled with the initialization and activation sequence sequences. They can contain subparts of them, but its programmer’s choice what to put in the pre open progress monitor.
Opening and Closing
One of the key aspects that is used in every web site is the ability of the sections to open and close. Those sequences common use is to play animations. Closing tasks can also be used for freeing some temporary allocated resources.
Destroying
The destroying sequence of the lifecycle is not as common scenario. Its usage appears when dealing with sections that feature large amounts of content in them which should be destroyed to free the flash player resources.
The common functionality for controlling the section’s lifecycle is implemented in the gugga.application.Section class. All the sections in a GUGGAFF application should extend this class.
Nesting Sections
Sections can be nested. They follow the Composite design pattern to implement this functionality. A group of nested sections is controlled by a Sections Controller (gugga.application.SectionsController), which is a Section it self. In addition the Sections controller is responsible for switching between its child sections which must be registered with him.
Navigating between Sections
When a command is issued to navigate from one Section to another, the Section Controller instantiates a Sections Transition (gugga.application.SectionTransition) object which handles the transition. This object does all the work to ensure the correct lifecycle of the sections involved in the transition.

0 Comments:
Post a Comment
Links to this post:
Create a Link
<< Home