I agree that web apps are a great place to employ an MVC pattern to the
JavaScript. I've been working on a personal web app, and wanted such
organization. So I made
monstars.js<https://github.com/seanmonstar/monstars.js>.
It might not work for you, but I really enjoy it. It's not well documented
though, since I add to it often. So you'll have to comfortable with reading
the source to understand all the subtleties.

Models take care of all storage, such as  Ajax, local or session Storage,
even SQLite database (though it's currently broken...).
Controllers handle all events fired by the views. I set up controllers to
"watch" various sections of the page, and they handle all the events, as
well as rendering the view with any new data fro models.
Views should be easy to write and understand, and I felt a bunch of DOM
methods suck. So it uses the simple templating parser that Resig shared a
couple years ago. You just write HTML and JavaScript inside <% %> tags.

Some related articles about it:
http://seanmonstar.com/post/1009142033/mvc-in-mootools-models
 <http://seanmonstar.com/post/1009142033/mvc-in-mootools-models>
http://seanmonstar.com/post/1053909313/mvc-in-mootools-views
 <http://seanmonstar.com/post/1053909313/mvc-in-mootools-views>
http://seanmonstar.com/post/1349631987/mvc-in-mootools-controllers



/shameless-plug

On Mon, Nov 8, 2010 at 7:12 AM, André Fiedler
<[email protected]>wrote:

> Hi! Works only with 1.3 in compat mode. See:
> http://jsfiddle.net/SunboX/B6H8f/
>
> 2010/11/8 Maxim Lacrima <[email protected]>
>
> On 8 November 2010 16:17, Olivier El Mekki <[email protected]> wrote:
>> > Hello,
>> >
>> > Do you guys use mvc in your code?
>> >
>>
>> I joined MooTools community several days ago. I am currently exploring
>> Mootools API and searching for tools that can help me in my project.
>> My main language is Python and I have used python port of PureMVC
>> framework for some desktop projects. Now I want to try javascript port
>> of PureMVC, which actually is based on MooTools, but it was released 9
>> months ago and I am not sure that it is compatible with 1.3... If
>> someone more experienced than me could take a look on it to check if
>> it is compatible with 1.3 I would be very thankful!
>> PureMVC JS site: http://trac.puremvc.org/PureMVC_JS/
>>
>>
>>
>>
>> > I used it several times for big js apps, typically putting the ajax
>> > requests and data parsing/transformation in models, the events in
>> > controllers and dom manipulation in views.
>> >
>> > On my current project, I argued we do not need mvc since it was mostly a
>> > collection of widgets, each having a couple of events and dom
>> > manipulation.
>> >
>> > I was said that the application may become way more complex then, and
>> > that I should consider the extendable part of the thing while
>> > implementing it.
>> >
>> > At this point, I remembered there was such debate when backend language
>> > frameworks became popular, with some people saying mvc was a pattern and
>> > as such should only be implemented when the project requires it.
>> >
>> > Clearly (imo), webapps have greatly took advantage of systematic
>> > implementation of mvc, turning it into something that is way more than a
>> > pattern among others.
>> >
>> > In the era of minification, we can afford writing a bit more of code to
>> > have it more organized ( that's quite what moootools is about comparing
>> > to others libs, anyway ).
>> >
>> > Do you think mootools, and javascript in general, could take advantage
>> > of systematic mvc?
>> >
>> > --
>> > Olivier El Mekki.
>> >
>>
>>
>>
>> --
>> with regards,
>> Maxim
>>
>
>

Reply via email to