Reply to The State Pattern in PHP 5

Your name:

Reply:


Posted by ltruett@fluffycat.com on 08/29/06 00:35

And now, the State Pattern.

http://www.fluffycat.com/PHP-Design-Patterns/State/

In the state pattern a class will change it's behavior based on
circumstances. In my example a subclass of a specific interface may
actually switch the class being used to another subclass of the same
interface.

When I first drew up this example yesterday evening, based on one I did
a few years back in Java, I was pretty enthusiastic about it. Now, I'm
not sure I like it 100%, and may still tinker with it. I guess this
proves that these are perhaps "living examples", just my best try at an
example of a given pattern, are not set in stone, and may change. I
also have a comments section with each pattern, so please feel free to
point out flaws or applaud any examples if you like.




ltruett@fluffycat.com wrote:
> Last week I continued my series of design patterns examples using PHP
> 5 with the Bridge Pattern, Flyweight Pattern, and Proxy Pattern. Here
> now is my 20th PHP 5 design pattern example, the Interpreter Pattern.
>
> http://www.fluffycat.com/PHP-Design-Patterns/Interpreter/
>
> In the Interpreter Design Pattern you define a language syntax, and
> parse requests that use that syntax, and call the correct classes and
> methods to handle the request.
>
> An interesting pattern, although I don't think I've used it much in
> systems I've worked on. It is probably indespensible if you are
> writing a compiler.

[Back to original 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

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