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 MVCThe 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.
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.
The Mojito framework is also designed to be smart about devices; to be more precise, it's designed to help you deliver different code to different devices. If your website visitor is using a smartphone, for example, the framework can dispense a different View built with a different template and a different set of local functions. This device sensitivity is essential these days, and the Mojito team was smart to build it into the framework itself.
Your Web application's events and much of its structure are defined by JSON files. I guess these are a step up from the endless opening and closing tags in frameworks like Struts that were built when XML was hip, but I quickly grew tired of hitting those quotation keys all of the time. Someone is bound to write a nice Web interface to these files so that we don't have to add so much glue punctuation. One version of my code crashed until I counted the curly brackets correctly, a task made easier by a parser that issued intelligent complaints about the mismatching.
Your affection for Mojito will depend on your affection for YUI. It's much simpler to use YUI widgets in the layout of your Web page because YUI is baked into all of the layers. This is largely a stylistic decision because the YUI has most of the functionality you might desire. It's fully formed and ready to go. The look and feel, though, may or may not be what you like. Some people assert that Yahoo Mail is the best out there, but others disagree. If you like Yahoo Mail, you'll probably be happy with what you create with Mojito.
The Mojito framework is also a good way for Yahoo to extend the reach of its APIs. It only takes a few lines of code to issue a call written in the Yahoo Query Language (YQL), the lingua franca for accessing Web databases like Flickr. The other parts of the Yahoo empire, including Yahoo Maps and Yahoo News, take the same style query. If you rely on any of these APIs, you'll be even more interested in Mojito.
There are still some limitations. I wish Mojito had some coupling with databases because that's what many developers are going to want to do. Node frameworks such as RailwayJS and Locomotive offer Rails-like connections to traditional databases. If you want a quick CRUD scaffolding to create, update, or delete rows in the database, one command can build them for you.
Web apps without SQLThe Mojito documentation on data access talks about cookies and Yahoo Query Language, not SQL or NoSQL. The counter-SQL argument is that the data should live in its own realm in a JSON-compatible server that takes RESTful queries. The Rails-like integration is too much, and it shackles the developer. Leaving the database connection out of Mojito frees it.
Read more about application development in InfoWorld's Application Development Channel.
Researchers at the University of California have discovered a way to use nanowires to allow lithium-ion...
Half a year with Google's multinetwork service teaches you a lot about what you want from a wireless...
Cortana, Windows 10’s built-in virtual assistant, is both really cool and really creepy.
Elon Musk, the CEO of SpaceX, envisions the day when there is a working, thriving, self-sustaining...
Many factors can affect a website’s ability to load quickly — and many of them can be adjusted to...
In this edition: Get ready for the bot revolution, a better way to survey your IT employees, in-house...
Handling both security and IT duties involves a daily balancing act for the resource-constrained IT...