Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: This is Display logic, not business logic

by jplindstrom (Monsignor)
on Jan 08, 2009 at 15:29 UTC ( [id://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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-03-29 09:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found