Swiz vs Mate in a Simple Flex based ViewStack Example

In my previous post, I implemented a ViewStack control using Swiz. You can review my first example of using the Swiz framework to toggle between the views in a ViewStack here. The view source is enabled, so just right click on the flex application to check it out.

After completing the Flex ViewStack example in Swiz, I then massaged it to be rendered using Mate. The ViewStack example can be viewed here. The view source is enabled, so just right click on the flex application to check it out.

I guess the benefit of using Mate, is that you can easily move the project code to another framework since the EventMap centralizes the injection and mediation behavior in a single file.

The migration issue aside, when using Mate I felt like I had to write more code to accomplish the same thing I just wrote in Swiz. The EventMap and Mate framework require more verbosity to link up the models and event mediation than the Swiz bean based framework. Compare the code in the following files in the two examples:

  1. MainResourcesView.mxml
  2. ResourcesAppController.as
  3. ResourcesView.as vs ResourcesViewModel.as
  4. EventMap.mxml vs Beans.mxml

I really like the Swiz implementation even though it is not as centralized as Mate(Event Map usage).

Although you embed the [Autowire] and [Mediate] metadata tags in your code to reference the Bean instances(This embedding may impede your ability to easily transfer code to another framework), the use of these tags lets me know, for example, when I am in a file what model is being referenced and what data is injected immediately and what events are being subscribed to by just looking at the code without having to reference/setup this info in an EventMap or writing extra getters and setters in a view.

I also did not have to think as much about how to use the Swiz framework as I did with the Mate based one. For me, the use of Swiz was more intuitive.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: