Reply to Re: the Visitor Design Pattern

Your name:

Reply:


Posted by Oli Filth on 11/29/05 14:43

Chung Leong wrote:
> FluffyCat wrote:
> > New on November 28, 2005 for www.FluffyCat.com PHP 5 Design Pattern
> > Examples - the Visitor Pattern.
> >
> > In the Visitor pattern, one class calls a function in another class
> > and passes an instance of itself. The called class has special
> > functions for each class that can call it.
> >
> > With the visitor pattern, the calling class can have new operations
> > added without being changed itself.
> >
> > http://www.fluffycat.com/SDCMSv2/PHP-Design-Patterns-Visitor/
>
> A class that passes an instance of itself to another class means you
> don't freaking know what you're doing. What's next? The spaghetti
> design pattern?

I think the OP has phrased this badly. He actually has an object
passing this ($this) to a method in another object, which is hardly
uncommon practice in most OO languages (e.g. registering a callback
interface with a child object).

However, the OP's example is not particularly great, as it's all being
driven from outside the objects in question.

--
Oli

[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

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