I just read " Ruby on Rails and J2EE: Is there room for both? " where Aaron Rustad compares Rails and Struts in three steps:
- The front controller
- The action and the model
- The persitence framework
So, how does our 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 .
18.07.2005, 22:55