Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

can you say separation of concerns? probably not :)

by metaperl (Curate)
on Feb 25, 2008 at 20:44 UTC ( #670135=note: print w/ replies, xml ) Need Help??


in reply to Re^3: RFC - Template::Empty
in thread RFC - Template::Empty

Paul, I'm enjoying this discussion. i think it is useful for both of us as well as the perl community at large... so dont think I'm making any personal attacks. The more we compare and contrast, the stronger our respective camps can become.

In TT and Template::Alloy - you can call into perl to manipulate your data - but the language has enough flexibility that you don't have to.
In terms of separation of concerns where do you think data manipulation should be done:
  1. model
  2. view
  3. controller

In Seamstress, the answer is clear and my code backs it up. Data manipulation, in any way shape or form belongs in the MODEL

your comments about sticking template code in the database almost gave me a heart attack.. What you call "flexibility" I call "confusion of concerns

Taking a presentation tool and involving it in data manipulation... it is bound to fall short. At one point, TT was released and didnt even have numeric comparison... essential for data manipulation.

I have beheld the tarball of 22.1 on ftp.gnu.org with my own eyes. How can you say that there is no God in the Church of Emacs? -- David Kastrup
[tag://software-engineering,html,templating]
Enforce strict model-view separation in template engines via HTML::Seamstress The car is in the cdr, not the cdr in the car


Comment on can you say separation of concerns? probably not :)
Download Code
Re: can you say separation of concerns? probably not :)
by Rhandom (Curate) on Feb 25, 2008 at 22:05 UTC
    In terms of separation of concerns where do you think data manipulation should be done
    As reiterated in other posts - I think we may be arguing because of semantics here. We keep using the word "manipulate" (my fault). Models are obviously responsible for getting and changing their data. A view should not ever change the underlying data (again there are rare cases when it doesn't hurt - MVC is a design pattern - not an absolute). Controllers are responsible for helping the view and model interact. Beyond this (and possibly even including this) - the handling of the viewing of the data is all a little more fuzzy. Is the model responsible for sorting data? Maybe. Is the view responsible for escaping html? Maybe. Is the view allowed to do different things with the data? Maybe. The big question is "does it matter?" I think the answer is "probably not."

    The different templating systems encourage work flow patterns. Is one better or worse? Well that is entirely subjective to one's work patterns.

    your comments about sticking template code in the database almost gave me a heart attack.. What you call "flexibility" I call "confusion of concerns
    I haven't had a specific case where I have needed to - though I have heard several people even in the last few months on the TT list asking how to do this. I can envision use patterns for it. What is a filesystem afterall if not a database table of files? Confusion may be the right term, but I can't claim to know all of the possible cases that a developer might find useful.
    Taking a presentation tool and involving it in data manipulation... it is bound to fall short
    You are right - it is bound to. And TT does sometimes - which is why it provides hooks for people who really want to abuse the separation of model and view. But letting them abuse the boundary is a good thing for them. I may not want to develop on their systems - but at least they could get their particular job done.

    Forcing the model to be responsible for knowing the myriad ways that its data might be used is certainly a viable option. But it is wrong to enforce it in all situations. In my experience - it has potential to lead to heavier models. Data is just data.

    my @a=qw(random brilliant braindead); print $a[rand(@a)];

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://670135]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (10)
As of 2014-08-20 11:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (110 votes), past polls