For example, if I were writing a "Petstore" application I could program both the business layer, and flow layer in JavaScript. For the business layer I might define a business object like this:
function PetStore(poolId) { this.poolId = poolId; }
PetStore.prototype.getProductListByCategory = function(key,
skipResults, maxResults) {
var conn = cocoon.getConnection(this.poolId);
var result = conn.query("select * from PRODUCT where CATEGORY = " + key,
skipResults, maxResults);
conn.close();
return result;
}
// etc...
And for the flow layer I might write code like this:
var petStore = new Petstore(...);
function viewCategory() { var categoryId = cocoon.request.get("categoryId"); var skipResults = 0; var maxResults = 10; do { var productList = petStore.getProductListByCategory(categoryId, skipResults, maxResults); skipResults += productList.rowCount; sendPageAndWait("view/Category.xml", {productList: productList}); } while (productList.limitedByMaxRows); }
// etc ...
I believe if used properly this can still provide the correct SOC. What do you think?
Regards,
Chris
Gianugo Rabellino wrote:
Christopher Oliver wrote:
I've just committed [experimental] changes that provide a simple database API for the Cocoon flow layer modeled after JSTL
[...]
Let me know what you think.
OK, first of all I must confess that I have little or no experience with the flow, so probably I should just shut up and let you guys proceed with your impressive work, eagerly waiting to have some time to catch up and join the party.
This said, I just wanted to share a couple of "belly thoughts", since the recent additions to the flow are ringing a bell in my head, and I start getting a bit puzzled. One of the first concerns we had when we started talking about flow was about people abusing it and how to stop them. The answer has always been that the flow would have played the role of "pure glue", providing, well, flow control and little more: in particular it was take for granted that the business objects would have been outside of the flow scope.