On 27 juin, 18:09, "John Salerno" <johnj...@NOSPA Mgmail.comwrote :
For which definitions of "content" and "logic" ???
The point of mvc is to keep domain logic separated from presentation
logic, not to remove logic from presentation (which just couldn't
work). Templating systems are for presentation logic. Whether they
work by embedding an existing complete programmation language or by
providing they're own specialised mini-language (or a mix of both) is
not the point here IMHO.
You still have to generate the markup on which css will be applied,
don't you ?
Well... yes and no. The server page approach surely fails to make
clear what belongs to which layer. Now you still can produce "clean"
application using PHP - if you are disciplined enough and know what
you're doing. It's a bit like the "lack" of language-enforced access
restriction in Python - it's only a problem if you don't understand
why it's good to separate interface from implementation.
The real problem is not to avoid having logic in templates, but to
avoid mixing domain logic (which is independant from presentation) and
presentation logic. Using a templating system - whether it embeds
Python or use it's own mini-language - makes clear (well... clearer)
what belongs to presentation and what belongs to domain.
I've been doing some research on web templates, and even though I read that
they help enforce the MVC pattern, I don't really understand how they are
keeping content and logic separated.
they help enforce the MVC pattern, I don't really understand how they are
keeping content and logic separated.
The point of mvc is to keep domain logic separated from presentation
logic, not to remove logic from presentation (which just couldn't
work). Templating systems are for presentation logic. Whether they
work by embedding an existing complete programmation language or by
providing they're own specialised mini-language (or a mix of both) is
not the point here IMHO.
Layout is easy, it's just not there as
far as I can see, and CSS can be used for that.
far as I can see, and CSS can be used for that.
don't you ?
But when you have a templating system that mixes HTML and Python code, how
is this helping to keep things separate? It seems to be the same issue that
some people have with PHP (that it is too integrated with the HTML, rather
than being separate).
is this helping to keep things separate? It seems to be the same issue that
some people have with PHP (that it is too integrated with the HTML, rather
than being separate).
clear what belongs to which layer. Now you still can produce "clean"
application using PHP - if you are disciplined enough and know what
you're doing. It's a bit like the "lack" of language-enforced access
restriction in Python - it's only a problem if you don't understand
why it's good to separate interface from implementation.
Of course, I suppose whether or not any of this matters depends on if you
are a web designer or a programmer, but am I missing something about
templates, or is it really the case that they, more or less by definition,
combine content and logic?
are a web designer or a programmer, but am I missing something about
templates, or is it really the case that they, more or less by definition,
combine content and logic?
avoid mixing domain logic (which is independant from presentation) and
presentation logic. Using a templating system - whether it embeds
Python or use it's own mini-language - makes clear (well... clearer)
what belongs to presentation and what belongs to domain.
Comment