Skip to content

Docs

Before using Swiz with your Flex applications, you will find it beneficial to first understand where Swiz came from and how it differentiates itself from most traditional micro-architectures and architectural frameworks.

Background

Inversion of Control and Dependency Injection are the two design patterns that differentiate Swiz from many other micro-architectures and allow it to be more conducive to Flex enterprise development. First, Flex is an event-driven framework, which lends itself well to dependency injection. Second, the use of Binding in Flex makes it heavily conducive to the Inversion of Control architecture.

History

Swiz is considered one of several “2nd generation” micro-architectures for Flex. Second generation Flex micro-architectures came in response to the failure of many enterprise level Flex and AIR applications that were built on First generation micro-architectures. In fact, most enterprise Flex and AIR applications never made it to full release because there was not a foundation strong enough to hold up large, enterprise grade applications.

Second generation Flex micro-architectures are almost all built using Inversion of Control and Dependency Injection design patterns, although Swiz is arguably the pioneer that started this evolutionary process. Interestingly, Swiz does not present a new way of doing things from a programmatic standpoint though. Instead, it applies patterns that seamlessly integrates into an event-driven language.

Martin Fowler – who is accredited with doing a large amount of writing on these subjects – states that Inversion of Control and Dependency Injection date back to 1988. However, the use of this methodology was not popular prior to 2000, and even when architects used it, they still often referred to it as the Abstraction by Layering pattern. They were not entirely wrong though, because Inversion of Control and Dependency Injection is thought to have been derived from the Abstraction by Layering pattern, and there are strong similarities between the two architectural patterns.

Benefits to Using the Swiz Framework

There are a number of advantages to using the Swiz micro-architecture. However, some of the more common reasons developers choose to use Swiz are as follows:

  • Swiz Avoids replicating code that already exists in Flex
  • Significantly minimizes dependencies, promoting loose coupling
  • Complements Flex through cohesive architectural principles
  • Focuses on solving real world problems with simple solutions
  • Simplifies development via the Model-View-Controller pattern
  • Implements proper code layering, effectively separating the UI from the business logic
  • Eliminates the improper use of Singletons to solve problems
  • Implements automated object pooling to decrease resource consumption
  • Uses runtime introspection to determine which objects need references to each other at runtime through Dependency Injection