Saturday, February 18, 2012

Language candy and Mongo

Finished the implementation for MongoDB. Most Gyro features working with SQL are now working with MongoDB. Just faster. As a down side: no transactions, and different "cancel" behavior. For example, if we have an entity called "Post" and another one called "Comment" (related, one-to-any), on SQL, if the user modifies a comment and saves it, and the presses cancel on the parent object (Post), this causes a rollback for all the modified data in that transaction.

On NoSQL, same scenario, if a comment is modified, and then the parent is not saved, this will cause commit for the comment and rollback (emulated) for the post. Is not really a drawback, just a thing to keep in mind when designing your application.

I've introduced a new language core element: static key specification:
Something you used to do like this:

var arr0=new [];
arr0["key"]="some value";
arr0[3]="some index value";

// you can now do it like this:
var arr=["key" => "some value", 3 => "some index value"];
// or
// => and : are synonyms
var arr2=["key" : "some value", 3 : "some index value"];


Also, a new function (defined in standard.lang.serialize and Serializable.con): ToArray(object). This converts an object into an array, very useful for debugging, because you can now say:

echo ToArray(this);

GyroGears relations on MongoDB are now available using a mixed redundant relation/schema design. The related model is needed for maintaining Gyro-generated framework API compatibility with SQL design. The schema design is used for optimizing relation search. Yes, it is a little redundant, but it works very fast.

While implementing MongoDB driver, I've managed to identify a series of unreported bugs in GyroGears: revisions didn't work as expected for relations, some minor bugs in web search when searching by owner.

A new feature in GyroGears: View option for objects. All objects where opened in edit mode, this causing a locking of the record. Some times, the user just wanted to review the data, so the "View" menu option (when right clicking a record) opens a record in read only mode without locking.

I've made some preventive bug-fixing in Concept Server (automated tests), and MongoDB and MySQL driver.

No comments: