ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Three-Tier Development with PHP 5
Subject:   Good article but "magic" code
Date:   2006-06-09 03:31:07
From:   goa103
Thanks for writing such an interesting article. The articles referenced at the beginning were also very enlightening. Here are some comments.


First I wonder what happened to the example database schema, I had to manually create it when we can read in the "Creating the database" section : Don't worry about the schema yet; that will come later. . Here is the database schema exported from PhpMyAdmin :


CREATE TABLE `user` (
`user_Id` int(11) NOT NULL auto_increment,
`first_Name` varchar(30) NOT NULL default '',
`last_Name` varchar(40) NOT NULL default '',
`email` varchar(100) NOT NULL default '',
PRIMARY KEY (`user_Id`)
) TYPE=MyISAM AUTO_INCREMENT=5 ;


Next I found the HTML code a bit messy. Templates should include a global header and footer, and some developers would probably enjoy a cleaner code, without the obsolete tags and tables (even if XHTML/CSS is out of topic). There's even JavaScript code when hyperlinks should be used.


I also think using "magic" variable names is inappropriate : x and data1 instead of first_Name for example. I think explicit names like first_Name should be used all along, from the database table fields and PHP variables to HTML attributes. It's like magic numbers, magic variable names should be avoided at all cost (3.14 instead of PI for example).


Let's just say the article is magic :).