You are here: Re: The Command Design Pattern in PHP 5 « PHP Programming Language « IT news, forums, messages
Re: The Command Design Pattern in PHP 5

Posted by Oli Filth on 10/27/65 11:33

FluffyCat wrote:
> New on November 29, 2005 for www.FluffyCat.com PHP 5 Design Pattern
> Examples - the Command Pattern.
>
> Since you all enjoyed the Visitor Pattern so much yesterday, today I
> have the Command Pattern for you. This one is pretty straight
> forward. In the Command Pattern an object encapsulates everything
> needed to execute a method in another object.
>
> http://www.fluffycat.com/SDCMSv2/PHP-Design-Patterns-Command/

Firstly, a typo - you have references to $plainVisitor, which is from
another example!!

Also, I'd recommend changing the name of BookCommandee to Book, because
that's all it is sematically.

Also, it would be more demonstrative if the logic to insert/remove the
stars was in the BookStarsOnCommand and BookStarsOffCommand classes,
i.e. remove BookCommandee::setStarsOn() and
BookCommandee::setStarsOff().

Otherwise, it begs the question "why not just call $book->setStarsOn()
from testCommand.php?".

--
Oli

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация