Re: Code Critique Please :)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Simeon F. Willbanks wrote:
> Hello,
> 
> I am trying to increase my knowledge and understanding of OO and OO
> Design Patterns.  I'd like to request a critique of a program that
> extracts MySQL table information and translates it into XML.  In the
> program, I tried to accomplish a few things:
> 
> 1. Correct use of ADOdb
> 2. Closely match the PEAR coding standards
>     - I encode my scripts in UTF-8
>     - Not all indents are 4 spaces, but I have switched my IDE to treat
> tabs as four spaces
>     - My phpDoc comments could probably use some tweaking
> 3. Object Oriented principles
> 4. Strategy Design Pattern
>     - Interface used for column attribute parsing
> 
> My overall goal is to use these xml files as a starting point to write a
> DAO with the Data Mapper Pattern.
> 
> Here are the related files to peruse:
> http://simeons.net/code/datamapper/sql/photo_portfolio.sql
>     - SQL dump
> http://simeons.net/code/datamapper/mysql_to_xml_oo.phps
>     - Calling script
> http://simeons.net/code/datamapper/helpers/autoload.phps
>     - Auto load classes

does the preg_replace() need to be run for every call to __autoload(),
I think it would speed it up a little if you stored the class path in a static
variable so that you only have to determine it once.

> http://simeons.net/code/datamapper/classes/DB.phps
>     - ADOdb connection
> http://simeons.net/code/datamapper/classes/MySQLToXML.phps
>     - MySQL extraction and parsing
>     - XML writing
> 

I'd drop the trailing '?>' in all your files - it's not required and it will
save you hunting through stacks of files trying to find errant blank lines
(which are output to the browser and will break subsequent calls to header())

> Here are the outputted xml files:
> http://simeons.net/code/datamapper/xmldatamaps/album.xml
> http://simeons.net/code/datamapper/xmldatamaps/photo.xml
> http://simeons.net/code/datamapper/xmldatamaps/comment.xml
> 
> Any comments are appreciated.
> 
> Thanks,
> Simeon
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux