Mojito (framework)
   HOME

TheInfoList



OR:

Mojito is an environment agnostic, Model-View-Controller (MVC)
web application framework A web framework (WF) or web application framework (WAF) is a software framework that is designed to support the development of web applications including web services, web resources, and web APIs. Web frameworks provide a standard way to build and ...
. It was designed by
Yahoo Yahoo (, styled yahoo''!'' in its logo) is an American web portal that provides the search engine Yahoo Search and related services including My Yahoo, Yahoo Mail, Yahoo News, Yahoo Finance, Yahoo Sports, y!entertainment, yahoo!life, an ...
.


Features

Mojito supports
agile development Agile software development is an umbrella term for approaches to developing software that reflect the values and principles agreed upon by ''The Agile Alliance'', a group of 17 software practitioners, in 2001. As documented in their ''Manifesto ...
of web applications. Mojito has built-in support for
unit testing Unit testing, component or module testing, is a form of software testing by which isolated source code is tested to validate expected behavior. Unit testing describes tests that are run at the unit-level to contrast testing at the Integration ...
,
Internationalization Internationalization or Internationalisation is the process of increasing involvement of enterprises in international markets, although there is no agreed definition of internationalization. Internationalization is a crucial strategy not only for ...
, syntax and coding convention checks. Both server and client components are written in
JavaScript JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior. Web browsers have ...
. Mojito allows developers designing web applications to leverage the utilities of both configuration and MVC framework. Mojito is capable of running on both JavaScript-enabled
web browser A web browser, often shortened to browser, is an application for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's scr ...
s and servers using Node.js because they both utilize JavaScript. Mojito applications mainly consist of two components: *
JSON JSON (JavaScript Object Notation, pronounced or ) is an open standard file format and electronic data interchange, data interchange format that uses Human-readable medium and data, human-readable text to store and transmit data objects consi ...
Configuration file A configuration file, a.k.a. config file, is a computer file, file that stores computer data, data used to configure a software system such as an application software, application, a server (computing), server or an operating system. Some applic ...
s: these define relationships between code components, assets, routing paths, and framework defaults and are available at the application and mojit level. *Directories: these reflect MVC architecture and are used to separate resources such as assets,
libraries A library is a collection of Book, books, and possibly other Document, materials and Media (communication), media, that is accessible for use by its members and members of allied institutions. Libraries provide physical (hard copies) or electron ...
,
middleware Middleware is a type of computer software program that provides services to software applications beyond those available from the operating system. It can be described as "software glue". Middleware makes it easier for software developers to imple ...
, etc.


Architecture

In Mojito, both server and "client" side scripting is done in
JavaScript JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior. Web browsers have ...
, allowing it to run on both client and server thereby breaking the "front-end back-end barrier." It has both client and server runtimes.


Server runtime

This block houses operations needed by server side components. Services include: Routing rules, HTTP Server, config loader and disk-based loader.


Client runtime

This block houses operations called upon while running client sides components. Services include local storage/cache access and JSON based /
URL A uniform resource locator (URL), colloquially known as an address on the Web, is a reference to a resource that specifies its location on a computer network and a mechanism for retrieving it. A URL is a specific type of Uniform Resource Identi ...
based loader


Core

Core function can be accessed on client or server. Services include Registry, Dispatcher, Front controller, Resource store.


Container

mojit object comes into the picture. This container also include the services used by mojits. API and Mojito services are the blocks which caters to services needed for execution of mojits.


API (Action Context)

Mojito services are a customizable service block. It offers mojits a range of services which might be needed by mojit to carry out certain actions. These services can be availed at both client and server side. Reusable services can be created and aggregated to the core here.


Mojits

Mojits are the modules of a Mojito application. An application consists of one or more mojits. A mojit encompasses a Model, Views and a Controller defined by JSON configuration files. It includes a View factory where views are created according to the model and a View cache that holds frequently requested views to aid performance.


Application Architecture

A Mojito application is a set of mojits facilitated by configurable JSON files which define the code for model, view and controller. This MVC structure works with API block and Mojito services, and can be deployed at both client and server side. While the application is deployed at client side, it can call server-side modules using binders. Binders are mojit codes that let mojits request services from each other. Mojit Proxy acts as an intermediary between binders and mojit's API (application context) block and other mojits. Controllers are command-issuing units of mojits. Models mirror the core logic and hold data. Applications can have multiple models. They can be centrally accessed from controllers. ''View files'' are created in accordance with controllers and models, and are marked-up before they are sent to users as output.


Application Directory Structure

Directory structure of a Mojito application with one mojit:
 ojito_app

, -- application.json

, -- assets/

,    `-- favicon.icon

, -- yui_modules/

,    `-- *..js

, -- index.js

, -- mojits/

,    `-- [mojit_name

,        , -- assets/

,        , -- yui_modules/

,        ,    `-- *..js

,        , -- binders/

,        ,    `-- .js

,        , -- controller..js

,        , -- defaults.json

,        , -- definition.json

,        , -- lang/

,        ,    `-- _.js

,        , -- models/

,        ,    `-- ..js

,        , -- tests/

,        ,    , -- yui_modules/

,        ,    ,    `-- .-tests.js

,        ,    , -- controller.-tests.js

,        ,    `-- models/

,        ,       `-- .-tests.js

,        `-- views/

,            , -- ..html

,            `-- ...html

, -- package.json

, -- routes.json (deprecated)

, -- server.js


Model, View and Controller

The Model hosts data, which is accessed by the Controller and presented to the View. Controller also handles any client requests for data, in which case controller fetches data from the model and passes the data to the client. All three components are clustered in the mojit. Mojits are physically illustrated by directory structures and an application can have multiple mojits. Every mojit can have one controller, one or more views and zero or more models.


Model

The model it represents the application data and is independent of view or controller. Model contains code to manipulate the data. They are found in the models directory of each mojit. Functions include: * Storing information for access by controller. * Validation and error handling. * Metadata required by the view


Controller

The controller acts like a connecting agent between model and view. It supplies input to Model and after fetching data from model, passes it to View. Functions include * Redirection * Monitors authentication * Web safety * Encoding


View

The view acts as a presentation filter by highlighting some model attributes and suppressing others. A view can be understood as a visual permutation of the model. The view renders data received from controller and displays it to the end user.


References

{{Reflist Web applications