|laziness, impatience, and hubris|
Re: This is Display logic, not business logicby jplindstrom (Monsignor)
|on Jan 08, 2009 at 15:29 UTC||Need Help??|
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.