Is the separation of program logic and presentation layer going too far?

Posted by Timwi on Programmers See other posts from Programmers or by Timwi
Published on 2012-12-16T13:07:20Z Indexed on 2012/12/16 17:20 UTC
Read the original article Hit count: 260

In a Drupal programming guide, I noticed this sentence:

The theme hook receives the total number of votes and the number of votes for just that item, but the template wants to display a percentage. That kind of work shouldn't be done in a template; instead, the math is performed here.

The math necessary to calculate a percentage from a total and a number is (number/total)*100. Is this application of two basic arithmetic operators within a presentation layer already too much? Is the maintenance of the entire system severely compromised by this amount of mathematics?

The WPF (Windows Presentation Framework) and its UI mark-up language, XAML, seem to go to similar extremes. If you try to so much as add two numbers in the View (the presentation layer), you have committed a cardinal sin. Consequently, XAML has no operators for any arithmetic whatsoever.

Is this ultra-strict separation really the holy grail of programming? What are the significant gains to be had from taking the separation to such extremes?

© Programmers or respective owner

Related posts about presentation

Related posts about programming-logic