Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Choosing MooTools over Google closure?

I am in a process to select javascript library for our new web application. This app is not very UI heavy but has forms, reports, search, calendars, tabs and target multiple countries like most web apps.

We are a tiny team. Biggest concern is maintainability and readability of the code.

We are Python programmers. After evaluating many other javascript frameworks we have narrowed down to mootools and google-closure. We loved mootools syntax. It took us no time to learn. It's like Python. On other hand we were stumped seeing private/public in google closure.

It's tempting to go for mootools however, I would love to hear from you about specific advantages these frameworks offer over each other.

like image 848
Shekhar Avatar asked Dec 24 '10 14:12

Shekhar


2 Answers

This shouldn't be the accepted answer, but it may help a little. I've had to make a similar choice recently -- but for me it was between YUI3 and JQuery. My main priority was agility and modularity, which tipped me toward YUI3. Though a few things make me think a little every day about my choice:

  1. Code Assist in Eclipse. I got so used to it with Python, and have not gotten it to work with YUI3. It seems to be available for MooTools, but I didn't see it for Google Closure.
  2. Stack Overflow Support. There are >55000 questions tagged for JQuery, >700 for MooTools, but <50 for Google Closure and YUI3 (~600 for YUI).
  3. Distance from vanilla JavaScript. YUI3 seems to wrap almost everything away from vanilla DOM/JavaScript. This takes some getting used to, and I have the feeling that it is doing a good job of insulating me from lots of cross browser, optimization issues that I would like to not even think about. However it does diminish the value of more vanilla JavaScript tutorials and examples. I'm not sure how this weighs between MooTools and Google Closure.

(BTW. All in all, I still really dig YUI3.)

like image 86
mjhm Avatar answered Nov 06 '22 22:11

mjhm


Well, its the whole argument between jQuery and MooTools. There is no true advantage of one over the other. From looking at the Hello World code for google-closure, Mootools seems to have a cleaner and quicker syntax. You also have to look at support. Sure, google-closure is supported by Google, but Mootools has a lot more searchable questions and answers and plugins as @mjhm said.

For maintainability and readability of the code, I would personally choose Mootools over google-closure. To me, Mootools is cleaner than google-closure

Mootools

window.addEvent('domready', function(){
    var myAnchor = new Element('h1', {
        html: 'Hello World',
        styles: {
            background-color: #EEE'
        },
    });
});

Google-Closure

goog.require('goog.dom');
function sayHi() {
    var newHeader = goog.dom.createDom('h1', {'style': 'background-color:#EEE'},
    'Hello world!');
    goog.dom.appendChild(document.body, newHeader);
}
like image 30
Colum Avatar answered Nov 06 '22 20:11

Colum