Re: Code Critique Please :)

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

 



On Nov 21, 2007 2:05 PM, Simeon F. Willbanks <simeon@xxxxxxxxxxx> wrote:
> 3. Object Oriented principles
I see that you tried to implement Singleton pattern in the DB class,
but you have a mistake. $dbConnection attribute is not a static
member, so every time you call the constructor $dbConnection won't be
initialized, so your code will always initialize this attribute.

There is something that i always wonder about Singleton pattern in
PHP, do you really have a benefit using this pattern in PHP? The idea
behind this pattern is that only one instance of the class is created,
it works great in Java because all requests are processed inside a JVM
and this instance created will really be the only one defined. Because
in PHP every request has its own environment, you will have several
instances of this class per request processed.

> 4. Strategy Design Pattern
>         - Interface used for column attribute parsing
I've checked the code in MySQLToXML.phps and i see a lot of
ParseDatabaseColumnAttributeXXX classes that implements
ParseDatabaseColumnAttribute interface. I think that those classes
should be methods of  a DatabaseColumnAttributeParser instead of
defining so many classes. Also the names of those classes suggest me
that they are methods not objects.

-- 
Saludos
Oscar

-- 
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