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 Ric Allinson.


Features

Mojito supports
agile development In software development, agile (sometimes written Agile) practices include requirements discovery and solutions improvement through the collaborative effort of self-organizing and cross-functional teams with their customer(s)/ end user(s), ad ...
of web applications. Mojito has built-in support for
unit testing In computer programming, unit testing is a software testing method by which individual units of source code—sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures&md ...
,
Internationalization In economics, 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 strateg ...
, syntax and coding convention checks. Both server and client components are written in
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
. 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 is application software 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 screen. Browsers are used on ...
s and servers using
Node.js Node.js is an open-source server environment. Node.js is cross-platform and runs on Windows, Linux, Unix, and macOS. Node.js is a back-end JavaScript runtime environment. Node.js runs on the V8 JavaScript Engine and executes JavaScript code ou ...
because they both utilize JavaScript. Mojito applications mainly consist of two components: *
JSON JSON (JavaScript Object Notation, pronounced ; also ) is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and arrays (or other ser ...
Configuration file In computing, configuration files (commonly known simply as config files) are computer file, files used to configure the Parameter (computer programming), parameters and Initialization (programming), initial settings for some computer programs. T ...
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 materials, books or media that are accessible for use and not just for display purposes. A library provides physical (hard copies) or digital access (soft copies) materials, and may be a physical location or a vir ...
,
middleware Middleware is a type of computer software 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 implement co ...
, etc.


Architecture

In Mojito, both server and "client" side scripting is done in
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
, 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 termed as a web address, is a reference to a web resource that specifies its location on a computer network and a mechanism for retrieving it. A URL is a specific type of Uniform Resource Identifie ...
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 Proxy may refer to: * Proxy or agent (law), a substitute authorized to act for another entity or a document which authorizes the agent so to act * Proxy (climate), a measured variable used to infer the value of a variable of interest in climate re ...
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