How cairngorm framework works internally - apache-flex

I had gone through many documents, no where mentioned how cairngorm framework works internally, means, how cairngorm Event, frontController, BusinessDelegate,ServiceLocator,Commands works and why we are extending or implementing cairngorm class like ICommand, IResponder and cairngormEvent.
Thanks,
Ravi

For the love of GOD, don't use Cairngorm (2) as a framework. Use either RobotLegs or Parsley. Both of which has awesome documentation and a very active community.

Related

Flex Framework vs. Micro-Architecture

I'm in the process of choosing a framework for my flex development, and one of the questions that was asked about a framework was "is this a framework or a micro-architecture"?
Can someone clarify what's the difference?
What exactly is a framework, and when can we start calling what we have a framework? I work with FlexBuilder3 (now called FlashBuilder4) and have a lot of standard things that I do for almost all projects, and components that I created for easy re-use. Some are very very small, but the benefit of a 1-liner has been immense for me instead of repeating the code over and over. So in the framework/micro-architecture scheme, can I say that these are my internal in-house framework or are they part of a micro-architecture?
Trying to understand this topic better.
a framework is a library. it is the complement of component sets (or component libraries), which are also libraries. while component sets provide functionality (encapsulated in components), a framework provides architecture. so when using a component, you create the architecture, which embeds this component to use its functionality by making explicit calls through its interface. when using a framework, you actually provide the functionality, which is then called by the framework. this is called inversion of control, which basically leads to low coupling through dependency inversion.
Flex is both a framework as well as a component set. There is only little seperation between both in Flex, which is due to the fact that the Flex framework uses a hell lot of inheritance. Also, Flex provides only little framework features to the developer, but more to the Flex components themselves. That's why there is Cairngorm, PureMVC and many other frameworks on top of Flex.
From what you say, I'd call your library a component set. I know the word framework is very hip at the moment, but you shouldn't join the league of the many people totally misusing it.
Oh, and the term "micro-architecture" designates the internal architecture of a processor. I think framework actually is the word you were looking for.

Flex Custom Component Communication

What is the best practice in terms of communication (variable usage ann method calls) between custom components developed using mxml.
You could use Flash's built-in Event mechanism, which has no external dependencies.
http://livedocs.adobe.com/flex/3/html/help.html?content=events_01.html
You might want to implement one of the frameworks mentioned here: Flex MVC Frameworks. A proper architecture will allow you to communicate between components more easily. I use pureMVC in my current project.
Cheers.
PureMVC is pretty solid. It take a bit to get familiar with the design philosophy. But once you are set up it is pretty easy to code against and makes your project easy to grow and extend with solid MVC design principles.
The main thing about PureMVC is its concept is a concept of Notifications. You can pass around various objects in a simplified way throughout the system.
For an overview of PureMVC checkout
http://puremvc.tv
http://puremvc.org/
If you would like some more specific code examples or have specific questions let me know.

Flex Framework that Uses Signals and Slots

Is there a framework for Flex that uses the Qt Signal and Slots paradigm?
I'm getting tired of these event-mapped frameworks.
Robert Penner wrote an AS3 Signals library, to replace flash events.
http://flashblog.robertpenner.com/2009/09/my-new-as3-event-system-signals.html
http://github.com/robertpenner/as3-signals
(it's pretty awesome)
Have you tried PureMVC?

Mate actionscript only version, does it exist?

Hey there, I'm looking into using Mate, but the projects I work on do not require the majority of the functionality of the Flex framework. My workmate said that he heard of an Actionscript version, but I can find no information on the main site about this, only that they have removed some dependencies on the Flex framework.
Does anyone know if their is an effort to move Mate towards a state that it can be used without the Flex framework?
Mate uses tags heavily, therefore it has a dependency on Flex. There are some ways to use tags without the Flex framework, but there are places in Mate where we use framework classes. It would take some effort to try to remove those dependencies, and while it is something that we want to investigate, I don't think it will happen soon, unless somebody else takes over that task :)

Flex MVC Frameworks [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm currently using and enjoying using the Flex MVC framework PureMVC. I have heard some good things about Cairngorm, which is supported by Adobe and has first-to-market momentum. And there is a new player called Mate, which has a good deal of buzz.
Has anyone tried two or three of these frameworks and formed an opinion?
Thanks!
Mate is my pick. The first and foremost reason is that it is completely unobtrusive. My application code has no dependencies on the framework, it is highly decoupled, reusable and testable.
One of the nicest features of Mate is the declarative configuration, essentially you wire up your application in using tags in what is called an event map -- basically a list of events that your application generates, and what actions to take when they occur. The event map gives a good overview of what your application does. Mate uses Flex' own event mechanism, it does not invent its own like most other frameworks. You can dispatch an event from anywhere in the view hierarchy and have it bubble up to the framework automatically, instead of having to have a direct line, like Cairngorms CairngormEventDispatcher or PureMVC's notification system.
Mate also uses a form of dependency injection (leveraging bindings) that makes it possible to connect your models to your views without either one knowing about the other. This is probably the most powerful feature of the framework.
In my view none of the other Flex application frameworks come anywhere near Mate. However, these are the contenders and why I consider them to be less useful:
PureMVC actively denies you many of the benefits of Flex (for example bindings and event bubbling) in order for the framework to be portable -- a doubious goal in my view. It is also over-engineered, and as invasive as they come. Every single part of your application depends on the framework. However, PureMVC isn't terrible, just not a very good fit for Flex. An alternative is FlexMVCS, an effort to make PureMVC more suitable for Flex (unfortunately there's no documentation yet, just source).
Cairngorm is a bundle of anti-patterns that lead to applications that are tightly coupled to global variables. Nuff said (but if you're interested, here are some more of my thoughts, and here too).
Swiz is a framework inspired by the Spring framework for Java and Cairngorm (trying to make up for the worst parts of the latter). It provides a dependency injection container and uses metadata to enable auto-wiring of dependencies. It is interesting, but a little bizzare in that goes to such lengths to avoid the global variables of Cairngorm by using dependency injection but then uses a global variable for central event dispatching.
Those are the ones I've tried or researched. There are a few others that I've heard about, but none that I think are widely used. Mate and Swiz were both presented at the recent 360|Flex conference, and there are videos available (the Mate folks have instructions on how to watch them)
Check out Robotlegs.
"It provides the glue that your application needs to easily function in a decoupled way. Through the use of automated metadata based dependency injection Robotlegs removes boilerplate code in an application. By promoting loose coupling and avoiding the use of Singletons and statics in the framework Robotlegs can help you write code that is highly testable."
I've seen these kinds of discussions many many times. They usually start with WHICH Flex framework do you use. Not many people ask the question WHY do you even need to use any framework on top of Flex framework.
I'm not in favor of using any MVC framework (Cairngorm, PureMVC) in Flex code. Mate is a better candidate. At least it's simple to understand and is non intrusive. I prefer using enhanced components à la carte. We've created and open sourced a bunch of them (see clear.swc in the Clear Toolkit at http://sourceforge.net/projects/cleartoolkit/.
The first chapter of our upcoming O'Reilly book "Enterprise Development with Flex" has a detailed comparison of several Flex frameworks: http://my.safaribooksonline.com/9780596801465 .
We are currently working on a MVCS implementation in the Spring ActionScript framework. It uses the full power of the Inversion of Control container so you have centralized dependency management and are able to swap things easily. It is not very prescriptive in how you do things but provides you with a very flexible infrastructure.
If you are new to Spring ActionScript and MVCS, I have an introductory post at my blog: http://www.herrodius.com/blog/158
I am using (and recommend) Swiz framework. It's not as complex and PureMVC, but it gets the job done. Moreover, it's a IoC container, and I like IoC.
I never used Mate, so I can't comment on that. But I do recommend against Cairngorm. Cairngorm is said to be open source, but it's really not supported well by the community. It's release cycle is also slow. I've been waiting FOREVER for Navigation Library to come out of beta.
Bear in mind that Cairngorm is THE adobe sponsored framework, and now hosted on opensource.adobe.com. Also note that it's by far the most prolific amongst developers at the moment.
If you know Cairngorm and are looking for a job, you won't go far wrong.
Cairngorm is easy to use and well documented:
http://www.cairngormdocs.org/
I recommend the Cairngorm Diagram Explorer and the classic article about Cairngorm.
I was new to Flex when I learned Cairngorm but found it useful and easy to learn with the above.
MATE is the way to go.A framework which does what a framework should do.
De-coupled architecture
Simple
Small foot print
Efficiency
I kinda have my doubts on these MVC frameworks (Mate, Cairgnorm, etc...) with the way they implement event maps and event controllers, it reminds me too much of wxWidgets and other GUI toolkits of that sort.
However, would be really nice is if Flex or one of these MVC frameworks uses the Signal/Slots paradigm that Qt offers.
I recommend to use MATE for developing greats and complicated projects,like other frameworks, Mate addresses the common architectural concerns in Flex such as event handling, data binding, and asynchronous processing, but the most important goal is that it's only tag-based so it's very easy to use it in our Flex Applications.
Yes Mate is the best framework for flex. I have used in one application which had several revisions both in terms of GUI and back-end data service. I only needed to change my event-map every time there was any change.
Mate also has MockService implementation which makes testing easy not a mate's advantage but nice to have one.
You should design you own MVC "framework" based on your own needs. If you know a bit of design patterns, Flex has a lot to offer natively.
Best thing of designing your own MVC is that it can be a light weighted or complex as you need.
My experience with frameworks is that you basically have to write twice as much code than you would without using a framework. The good thing about frameworks is, that it forces you to work in a consistent way, but if you can work in a consistent way by making use of Design Patterns, best practices and common sense, I would suggest to stay away from frameworks.
Its very difficult to come to a conclusion about which framework is better than others. Depending on the nature and complexity of project and team members expertise & preference one may be more suitable than other in a given situation
I have compiled a list of Flex Frameworks with there brief descriptions and pointers to more information about them in this URL.
http://practicalflex.blogspot.com/2011/08/list-of-adobe-flex-tools-frameworks.html
the url may be helpful for anyone looking for evaluating a Flex framework for his/her project.
After evaluating many most of the Flex frameworks I found the Swiz framework most simpler and easy to get started with for a new developer. Hence it ensures easy maintainability & extensiblity of your application.
I have worked on cairngorm and mate frameworks. I started with cairngorm framework. It is good to work but difficult to understand in the beginning. It handles event dispatching cleverly. You can dispatch events from classes itself and it will be taken care of by the framework wired command classes. There is single repository for storing the data, so easy to handle the data. It is a singleton class. Once you get a hold of the framework, work is easier.
Mate on other hand is tag based framework. It is an event driven framework, so all events are handled in the eventmap file. It does event listening, property injection, and many other things from this class itself. You can dispatch events from the classes by passing it the instance of framework event dispatcher. You don't have to use singleton class like cairngorm in this. You can bind property in a class to views using directly using property injection so no need to use any singleton class. In mate all the classes and view are free from framework code, so it is decoupled framework. It is easy to move components from one place to other.

Resources