Reply to Re: Learning patterns... Decorator

Your name:

Reply:


Posted by Willem Bogaerts on 09/28/07 08:03

> I'm trying to learn patterns, which I hope to use in my PHP code,
> although I'm finding it hard to get any real impression of how patterns
> fit in properly, I've done the following test code for Decorator pattern
> and want to know:
>
> a) is it correct, this is decorator pattern?
> b) how would i use this in practice with a database, eg. how would i
> store the 'attributes' in tables, and how would the 'pattern' be used in
> conjunction?
>
> Any hints, tips, pointers to examples would be appreciated:
The GOF book ("Design Patterns") is quite clear, I think.

<snipped example>

A decorator is a class that adds functionality at runtime. Functionality
you could add to your objects in that way are things like spread
payment, discount conditions, etc. The point of the pattern is that you
can add responsibility to specific objects instead of whole classes. It
is an alternative to subclassing (your example was subclassing).

Best regards,
--
Willem Bogaerts

Application smith
Kratz B.V.
http://www.kratz.nl/

[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

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