Page 2 of 2
Posted: Thu May 17, 2007 1:22 pm
by Christopher
kyberfabrikken wrote:A template is not the only technique, for rendering output (Depending of course on, what you put in the name 'Template').
My thought was that while a View may use a Template for rendering, a Template does not use or know anything about Views. I think of the Template pattern as being more primitive than the View. A Template does some kind of transform, whereas a View is a higher level assembler of all or part of the presentation.
Posted: Thu May 17, 2007 5:16 pm
by kyberfabrikken
arborint wrote:My thought was that while a View may use a Template for rendering, a Template does not use or know anything about Views. I think of the Template pattern as being more primitive than the View. A Template does some kind of transform, whereas a View is a higher level assembler of all or part of the presentation.
I suppose it depends on, what you mean by "a view". In my mind, a view component, is some sort of command object, which returns a string value. There are different implementations, but they all share the same interface; Primitive templates are views, as are reusable implementations (aka widgets). Then you have application specific implementations, which would normally handle a specific request (What you call "a view") -- These would normally be composites of the primitive kinds of views. While the latter kinds are more specific, I don't see any reason to treat them as being different from the primitive ones.
Posted: Thu May 17, 2007 6:58 pm
by Christopher
I think of "a View' as being part of "the View", by which I mean the part of the Presentation layer responsible for creating the ouput/response. A View can return a string, but it could also return a Value Object for the Response to use, or it could simply echo its output. I think of a a View as having a different interface that a Template. Views may need to do things like load Models or access the Request. A Template's interface is pretty much set, render and transform controls. Sometimes all the View needs to do is a transform -- those are the cases where the View can be a Template.