On Sunday, April 14, 2013 11:37:39 PM UTC+2, Brian Craft wrote:
In the examples I've seen, view functions directly reference model functions, which directly reference databases. I expect this makes it difficult to test the view functions, or to operate on multiple databases. Are there any common patterns for isolating these things, especially the db access? If view functions took a context, for example, they could be pure functions. But I'm not sure how the context would be passed.
Hi,
- Widget is a function, returning part of the DOM tree, referenceable by an id attribute. Whole page can be built from standard content (e.g. menubar) and widgets, which hold the presentation logic.
- Action is a standard Ring handler, which returns JSON operations. The action is a place to communicate with business services or persistence layers and can be be referenced from Widgets or even JavaScript code.
- Operation is a JSON object, which is interpreted by browser-side JavaScript plugins.
I am not saying, that you have to use Ganelon with your app to test it properly - but that approach might inspire you for some kind of separation between logic and presentation.
The micro-framework is not Noir based itself - although it was in first versions, before Noir was discontinued :).
Best regards,
Tomek Lipski