Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

This is Display logic, not business logic

by metaperl (Curate)
on Jan 08, 2009 at 14:54 UTC ( [id://734914]=note: print w/replies, xml ) Need Help??


in reply to Display logic is driven by business rules IMHO

this tt code is an example of a business requirement that is not business logic:
[% IF age < 10 %] Hello [% name %], does your mother know you're using her AOL account? [% ELSIF age < 18 %] Sorry, you're not old enough to enter (and too dumb to lie about your age) [% ELSE %] Welcome [% name %]. [% END %]
I always considered that business logic because deciding on how to deal with potential consumers based on age would certainly be decided by the business department.

But I think Corion clarified this already.

Replies are listed 'Best First'.
Re: This is Display logic, not business logic
by jplindstrom (Monsignor) on Jan 08, 2009 at 15:29 UTC

    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://734914]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2024-04-19 05:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found