develooper Front page | perl.advocacy | Postings from August 2001

Re: My list of PHP's shortcomings

Thread Previous | Thread Next
From:
Dan Brian
Date:
August 22, 2001 13:33
Subject:
Re: My list of PHP's shortcomings
Message ID:
Pine.BSF.4.10.10108221412150.79776-100000@brians.org
The n-tier descriptions can get fuzzy, though. To add to what Andy said, I
have found a good explanation to be that most applications, web or
otherwise, have 3 basic logic types:

  1. Content logic      - the information you give to the user
  2. Presentation logic - the way you display the information 
  3. Application logic  - the way you determine both of the above, 
                        and the functionality the presentation represents

In a typical PHP configuration, either all three are mixed within the
document, or elements of the content are put in a database.

<?php        
  print "<table>\n";                                     // display logic
  while($line = mysql_fetch_array($result)){             // app logic
      print "\t<tr>\n";                                  // display logic
      while(list($col_name, $col_value) = each($line)){  // content logic
        print "\t\t<td>$col_value</td>\n";          // display & content
      }                                             // app logic
      print "\t</tr>\n";                            // display logic
  }                                                 // app logic
  print "</table>\n";                               // display logic
?>

Granted that Mason and HTML templates encourage a similar markup, there
are other ways to do it in Perl. Part of what makes XSLT and
AxKit solutions attractive to at least a segment of our population (of
which I count myself part of) is the ability to completely separate all
three of the stated logic types. When you have content XML, display
XSLT/XHTML, and separate app logic that generates the content, you have
total separation of that logic.

One reason I think that "lack of n-tier" may not be the best description
of PHP's downfall is because you *can* do n-tier in PHP. Add a query to
the above which will get the display elements from a database, too. Kinda
defeats the purpose of PHP in my mind, but PHP now does XSLT (?) and GTK
(??), so what do I know.

Dan



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About