3 ms·
Javascript MVC- lightweight solution for my heavyweight problem?
Apologies if you're tired of the Javascript framework question for Ajax web apps. But given the direction of things like HTML 5 and Google Chrome OS- I think it's a very important question going forward and the answers I've seen on StackOverflow and elsewhere seem to be lacking.<p>I'm trying to find a 70% solution to my needs so I can moving on to other architectural problems. I've been trying to create a complete stack for "enterprise apps" (think ERP, CRM, or other business processes) based around an Ajax front, simple JSON/REST services, NoSQL DB, and Map/Reduce behind it (feel free to contact me if this makes you curious). I'd also like to keep it OSS, and stick to "standard" solutions so others can hack on it...<p>For apps like these, it seems the "single page aplication" makes sense (like GMail). To me, that means that the Controller in MVC is now primarily on the client. Which means that there is probably more in common with client-side frameworks like Swing than with fully server-side MVC like Rails or Struts. If the DOM (and browser) are the view layer, and the model is provided by JSON/REST on the server (and I'm ignoring the client-side cache at the moment), the missing piece is a controller layer to call services (or respond to comet-style events) and programatically update the view. In my case, I will be programatically building forms, nav elements, etc based on JSON calls from the server.<p>And in looking at JS frameworks, I tend to group them from lightweight to heavy. I've only been kicking the tires for a week or two, but these are my impressions, going from lightweight to heavier:<p>* jQuery- Great framework for keeping simple things simple and growing in adoption. But seemed a little too lightweight truly be a UI framework, where I was loading and creating panels programatically. I haven't used Prototype or MooTools but my guess is that they sit here as well.<p>* Dojo- Felt a little heavier than jQuery, and more of a widget framework around it which is good for me. I wanted to like it but I feel that the documentation was rough for my work (which may be a bit of an edge case) and errors in examples frustrated me.<p>* YUI- Looked promising. YUI seems to have a well thought out Widget model with events, HTML rendering, etc. ExtJS may be in this category although I know the dual license model is a negative to some people.<p>* GWT- Code in Java and compile to optimized JS. I only checked it out a little bit. I'm sure it is a thorough conceptual model, given that Google has driven a lot in the Ajax space. But I'm trying not to do much on the server and don't want to be tied to Java right now. It seemed to be harder to skin and I'm still operating under the fantasy that my app will be easily skinnable by others.<p>* Sproutcore, Cappucino, Javascript MVC, TrimPath Junction, etc- These are relatively heavyweight frameworks. I tried a little of the three mentioned above, and I feel that they seem to impose too much conceptual overhead on top of javascript. Some require code generators or compilation to JS, which to me is a "code smell" indicator of too much framework. I may be being unjustly fair. As far as Cappucino, I have to give props to the 280 North guys for 280slides.com- which I think is the most impressive Ajax app out there. Their framework (with their Objective-J as the language) may be great if you come from an Objective-C background as they seem to. I don't so I didn't explore any further. YMMV...<p>Of the bunch, I think YUI may be the best fit. I'm still hoping for a simple way in jQuery, though I feel it may not have enough of a framework around UI layouts, widgets, etc.<p>I'm certainly no expert on this and would love to hear thoughts from those in the community...<p>Feel free to hit me up if you're curious about my project...<p>Cheers,
Alex
alex at alexlross dot com