Review: Yahoo Mojito gives server-side JavaScript a lift

Yahoo's open source framework combines YUI on the client, Node.js on the server, and excellent use of MVC design pattern

From the beginning, programming for the Web has been divided into different camps. In the browser, there was always just one language -- JavaScript -- that dominated. But on the server, there have been dozens of candidates: Java, C#, Perl, Python, and countless others invented by people who weren't happy with the other choices. If you toss databases into the mix, there are several variants of SQL running the major platforms. It's a mess that drives programmers nuts.

The confusion may be ending, and Yahoo's Mojito may be part of the solution. Yahoo built Mojito by taking the best ideas from the various server stacks and creating a framework in JavaScript on top of Node.js, a server-side tool that might be called a cult. You write your code for both the server and the client in JavaScript, and Mojito keeps it working smoothly. (If you use some of the NoSQL databases, you can program them in JavaScript too.)

[ Also on InfoWorld: Node.js tools: Server-side JavaScript comes of age | First look: Google Dart vs. JavaScript | Keep up with application development developments with the Fatal Exception blog and Developer World newsletter. ]

Node can be incredibly fast, but it achieves much of this speed by operating without a safety net. If your code locks up, the entire server locks up with it. The most cultish devotees feel that this can be dodged with careful coding. Mojito encourages this care by offering the well-understood paradigm of Model-View-Controller, or MVC. Splitting the code into small distinct parts that serve predetermined roles makes it less likely that you'll lock up the server. That's the theory, but of course nothing can stop a determined programmer.

Mojito's MVC structure emulates the ideas and design paradigms that emerged from other Web programming worlds. The Java server-side programmers are so devoted to frameworks like Struts that you could get yourself stabbed in a Java bar if you even hinted that MVC is not right for all things. The paradigm succeeded because it brought some order and roughly approximated the way that development teams are organized. The people who are good with visual design end up in charge of the View; the people who organize the data (often DBAs) create the Model; and the programmers handle the Controller that makes decisions about what the data can do (the business rules).

Mojits and MVC

The Mojito framework makes excellent use of the MVC paradigm. Each Web application is broken up into mojits -- shorthand for Mojito widgets. Mojits are rectangular areas of the page that are meant to be fairly independent. You should be able to mix and match mojits if you're careful in your coding; you may also want to get them talking with each other.

12355113546811.png
12355792397556.png
12376689766719.png
12651472504465.png
12355113543399.png
Test Center Scorecard
 
 40%25%25%10% 
Yahoo Mojito8999

8.6

Very Good

1 2 3 Page
Mobile Security Insider: iOS vs. Android vs. BlackBerry vs. Windows Phone
Recommended
Join the discussion
Be the first to comment on this article. Our Commenting Policies