Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: This is Display logic, not business logic

by jplindstrom (Monsignor)
on Jan 08, 2009 at 15:29 UTC ( #734924=note: print w/ replies, xml ) Need Help??


in reply to This is Display logic, not business logic
in thread Display logic is driven by business rules IMHO

Yes, and it has no (well, little) to do in the presentation layer.

Business logic concepts will always leak out to the presentation layer. Otherwise, how would it know what to display?

But the details, the implementation, of those concepts should stay in the model layer (if we talk MVC) or wherever the business logic is implemented.

In your example, it's suitable for the presentation layer to know that there are three levels of access, because it needs to display different things for the three cases.

But what are those hard coded age comparisons doing in a template??? That's the business logic which should be in the model layer. And those should be exposed as abstractions on a higher level than age comparisons.

That way other presentation modes can make use of these abstractions as well, so you don't repeat "age < 18" when you display this on a phone or in an email.

/J


Comment on Re: This is Display logic, not business logic

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2014-07-14 07:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (255 votes), past polls