November 17, 2010

Beyond IoC: Advanced Experiments with Swiz (RIA Unleashed: Boston 2010)

Beyond IoC: Advanced Experiments with Swiz by Ben Clinkinbeard

Swiz is all about custom meta-data parsing as returned from describeType(). Recent changes have exposed that meta-data processing to anyone. General switch from autowire to inject.

Swiz is all about defining a list of beans that it knows about. Swiz watches for views to be added and then manages them (i.e. set beans on the view).

In general most of what you can do with a meta-data tag you could also do with an interface, but it isn't as cool.

IProcessor (root of it all)
init() - reference to Swiz instance one is operating in
priority - determine what order processors are run in

IBeanProcessor (extensions) any object that Swiz manages
setUpBean() and tearDownBean()

SwizInterfaceProcessor: checks for common interface types (backwards compatibility)

Bean is wrapper that Swiz puts around your object. It has source property and type descriptors that handles meta-data. Support for class, property, and method meta-data.

IMetadataProcessor (parse custom metadata tags)
metadataNames() - associate with more than one metadata tag
setUpMetadataTags() - metadata tags found and the bean
tearDownMetadataTags()

PostConstruct run after all injections satisfied
MetadataTag allow additional properties like "order"

var f:Function = bean.source[metadataTag.host.name];

Bad things might happen if two register the same meta-data tag. Might be good to add a mapping report to let you know what was injected where.

Unit testing custom meta-data tags is possible.

When an event is dispatched, to check permissions or security constraints, may prevent method from running.

Growing collection of third party custom meta-data processors.

New feature is event chains and command chains. Determine flow by returning AsyncToken or AsynchronousIOOperation.

Tags: as3 flex riaunleashedboston2010 swiz

November 22, 2009

Building Flex Applications with the Swiz Framework (RIA Unleashed: Boston 2009)

Chris Scott

What is Swiz:
* Simple IoC for Flex / AS Development
* MVC Architecture
* Simple tools for common tasks: remote methods, event handling, modules

What Swiz is not:
* Excessive JEE patterns
* Boilerplate code
* Verbose XML configuration
* Overly prescriptive

Swiz uses dependency injection to satisfy component requirements.

Common dependencies:
* Remote services
* Data
* Logic
* Views

Other approaches:
* Wire ourselves
* Use Service Locators
* Verbose XML configuration

Swiz application:
* Define application it needs to use: remote objects, controllers, presentation models
* SwizConfig component in top level application
* [Autowire] metadata for dependency injection, two flavors (type reflection) or by bean name
* [Mediate(event="", properties="")]
* Swiz class called AbstractBaseController: executeServiceCall(async token, result, fault, arguments)
* Immediate run-time checking of event names
* Swiz:Prototype using class reference or name
* Module specific scope for Swiz config

Tags: flex framework riaunleashedboston2009 swiz