1. The front controller
2. The action and the model
3. The persitence framework
So, how does the Mocha environment compare?
The "front controller" in Helma would look for a stored object whos
parent node structure matches the name hierarchy of the requested URL.
Unless the next element in the requested URL specifies an alternative
action method, the "main" action method of that object's prototype
would then be called. The URL might look something like...
http://localhost/orders/4/delete/
...where "4" would be a child object of "orders" and "delete" would be
an action method of its prototype. Similar to Rails, the file structure
can be used to define this prototype structure...
app/Order/delete.hac
...but that method can also be set anywhere else in the code, even
during runtime:
Order.prototype.delete_action = function(){
var parent = this._parent;
parent.removeChild(this);
res.redirect(parent.href());
}
While the 'list' action could be specified as a parameter of the
parent.href() call, this would most likely not be necessary. In
OpenMocha, the main action of the parent object will generate that
list.
So, we already covered steps 1 and 2, the front controller and the
action and model. Now, what about step 3? There is no step 3. The
objects are automatically stored in the embedded db.
Alternatively, the objects can also be mapped against a relational db,
controlled through a type.properties file [2].
[1] http://www.ibm.com/developerworks/linux/library/wa-rubyonrails/
[2] http://helma.org/docs/mapping/basic/
For a version of the stack diagram including Mocha:
http://czv.com/Konsensfabrik/Rails+vs+Struts+vs+Mocha/