BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

Flex Development with the Swiz Framework

| by Jon Rose Follow 0 Followers on Feb 17, 2009. Estimated reading time: 1 minute |

The Adobe Flex and AIR community continues to mirror many of the trends of the early Java community, with numerous individuals offering frameworks that aim to simplify or improve Flex development.  This post reviews the Swiz Framework, which models itself after many of the principles found in the SpringFramework for Java.  The Swiz framework was developed by Chris Scott, and is offered under the Apache License 2.0.

Christophe Coenraets, an Adobe Technical Evangelist, discussed the Swiz Framework and detailed its usage in a recent blog post.  Christophe began by describing the Swiz Framework:

At his core, Swiz is a simple inversion of control framework. Using an IoC framework, the components of your application (for example, Views) don’t instantiate or even look up their dependencies (the objects they work with). The framework injects those dependencies when the components are created (hence the term “Dependency Injection” also used to describe this approach). The result is looser coupling and more reusable components. The components managed by the Swiz IoC framework are called beans.

In Christophe's sample application he shows the Spring like syntax for injection:

Swiz uses the [Autowire] custom metadata to inject beans into other beans and views.
In inSync, the contactService RemoteObject is injected into ContactController.as as follows: 
1
2
[Autowire(bean="contactService")]
public var contactService:RemoteObject;

… and contactController is injected in the Views. For example, in ContactForm.mxml:

1
2
[Autowire(bean="contactController")]
public var controller:IContactController;

In a recent review of the Swiz Framework, Tony Hillerson discussed the Autowiring features:

In case you didn’t notice, this Autowire thing is sweet. We don’t have to worry about where this model comes from. We don’t have to think about if it’s a Singleton or not. All we know is that we want a model, and the framework will make sure we have one when we need it. One note of caution: the property has to be marked public or Swiz won’t be able to assign to it.

Both Tony and Christophe concluded that Swiz is a framework that is easy to use, Christophe saying:

Swiz was easy and enjoyable to work with. It is also non intrusive and definitely introduces some interesting ideas.

To learn more about Swiz and its features check out the project tutorial.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

New Swiz Framework 1.0 by Sohil Rupani

Hi ,
This is a link to old Swiz 0.6 . Check out the Tutorial for new Swiz Framework 1.0
xebee.xebia.in/2011/01/12/swiz-framework-1-0/

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

1 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT