Review: Yahoo Mojito gives server-side JavaScript a lift

11.04.2012

 

 

Each mojit has its own M, V, and C, which are written, more or less, in JSON, HTML/CSS, and JavaScript respectively. The biggest difference from other MVC approaches is that the model and controller are split into three parts. One part has code for the server, one part has code for the client, and the third has code for both. All three parts live next to each other, not in different stacks maintained by different people. I think this will be a great improvement for development teams because it breaks down the silos and frees us from the need to maintain people with different focuses.

The documentation suggests that Mojito is quite smart about this: "If your application is configured to deploy code to the client, Mojito will determine whether the client can execute JavaScript before deployment. If the client cannot execute JavaScript, your application code will instead execute on the server."

There aren't many details on how to exploit this, but structure is there for you to separate the code as you need. You have to be careful how you use the structure, and in the spirit of Node, you do the work on your own -- it's up to you to avoid any traps. A mojit on the server won't be able to manipulate a DIV on the client, for instance. It's worth noting that one recent project, Opa, promises to use the compiler to make automated decisions about where the code will run, but that level of hand-holding isn't provided here.

Zur Startseite