MATE with experience :)

By saumya

As promised, I am penning down my experince till now with MATE framework.
To begin with its an awesome framework. It really is, I mean it. The documentation of the framework is as good as the framework itself.The most and vital thing about MATE is, it completely separates the VIEW from CONTROLLER.Loosely coupled means loosely coupled :) . Everything starts with an event.
Personally till now while creating my own frameworks or while working with a custom framework of any company I have always seen this as the first lines in the VIEW

function onApplicationInit():void{
this.controller=new ApplicationController(this);
}

This is just to initialise the controller. Then CONTROLLER takes charge of everything and controlls the VIEW.But the problem with this is my view and controller are tightly coupled. I have to write the same initialisation code on all my views just to initialise its controller !!
Well on MATE, its the EVENT ecosystem. Upon VIEW creation on Flex, Flex has a sweet ‘creationComplete’ event dispatched. Now, we can directly bind this event to any eventhadler or make a custom event at this point and dispatch it. Now MATE’s event Map can bind this event to any event handler on any class. So what I will get is VIEW dispatches one event and MATE gives this event to my CONTROLLER and CONTROLLER then handles the situation. VIEW does not know really from where it is being controlled :) sweet as very sweet.

How MATE works? Its a three step process.
1. Create a view (dispatch EVENT for every thing you need to controll)
2. Create an EventMap (maps each EVENT to an EVENTHANDLER)
3. Create a controller (Which handles the EVENT)

Thats it?!! YEAH, thats it. Cool, is not it?

Tags: , , ,

6 Responses to “MATE with experience :)”

  1. jurlan Says:

    Hi,

    this looks like a very promissing blog! I will follow it very closely since my main interest has become to rebuild our website using the MATE framework together with WebOrb!

    So keep up the good work and thanks in advance..

  2. saumya Says:

    Thanks Jurlan for your kind words, I will try to live upto your expectations :)

  3. jurlan Says:

    You’re very welcome ..
    Right now I’m working on some kind of very mini cms using mate and weborb ..
    Current situation: I’m struggling to parse my result to the desired label..

    It shows the result object, being [Object object] and not the text value contained in the object..

    I’ll see if I can put my code online anywhere if you like.

    //jurgen

  4. saumya Says:

    Hi Jurlan,
    the return will always return [Object object], you must understand that this Object is actually of type the VO(value object) you would have defined perviously.Suppose you want ‘Person’ data, it will return an Object with all the person data.You can access that with the regular array notion as
    ResultObj['age']
    I have tried to cast the data to ‘Person’, but it throws errors !! While I was expecting that the return type should be ‘Person’ Object itself.Anyway, I am working on, if I found any solution for it, I will put here.
    cheers

  5. jurlan Says:

    Hello ;-)

    Yes .. I was thinking in the same direction, but I’m getting some errors myself .. I will also keep you posted on any advance / success..
    Thanks for your effort!
    This is actually quite fun and makes a blog really come alive ;-)

    cheers
    //jurgen

  6. jurlan Says:

    Any updates on this? ;-)

    cheers
    //jurgen

Leave a Reply