Thursday, December 20, 2007

Semi MVC templating

In the templating-demo, I (believe) I've used the MVC pattern for templating/transforming lookups. If anyone knowledgeable about patterns reads this, please let me know if I'm way off on this.

I'm not sure if this is similar to the technique Chris mentioned in a somewhat cryptic comment on another templating blogpost.

I use a naming convention for three kinds of fields. To do the actual transformation, I use a WebQueryOpen-agent.

Naming convention/description


lup_[label]
Model
Computed for display, allow multiple values. These fields fetches the data (using dblookup/-column). One field can be used by multiple templates.

template_[label]_[description]
Controller
Computed for display. These fields contain the description of how the data should be transformed. The label should correspond with the label of a lookup-field. Example of template.

transformed_[label]_[description]
View
Computed for display. These fields will be filled by the result of the transformation. The label/description should correspond the label/description of a template-field.

WebQueryOpen agent
Controller
This agent contains the transformation logic/fills the transformed-fields.

4 comments:

Dmytro said...

very impressive. Thank you for demo. I'll play with it

Tommy Valand said...

No problem.

If there is something confusing/wrong in the demo, leave a comment, and I'll look into it.

My goal with this is to have a readable/easy to maintain way of presenting data from lookups in webpages. So far, this is the best solution I've found.

I haven't tried it, but with a small rewrite of the agent doing the transformation, you could also use this technique for simple PassThruHTML-reports in the Notes-client.

The Grouse said...

Tommy,

I did a full article on using the MVC design pattern with Domino apps for The View back in 2004. YOu can see it at http://www.eview.com/eview/VOLR6.nsf/2a8bf6b62c61b60585256f2500684630/cd39e584f2fec71d85256f55005d193f?OpenDocument

Might require a View subscription to read the article, however.

Tommy Valand said...

I'll take a look at it, thanks!