View Single Post

  #3 (permalink)  
Old 12-30-2005, 06:59 AM
Simon Smith
Guest
 
Posts: n/a
Re: Design Patterns - Maze Examples


>
>Hi,
>
>I just started reading design patterns (by Gamma, Helm, Johnson,
>Vlissides ) and looking at the Lexi example. I'm very new to this so
>please bear with me.
>
>I understand the Decorator pattern, but a bit confused by the Maze
>example used for creational patterns. Is this example a bit contrived?
> I would have thought a decorator pattern would make more sense instead
>of deriving mazes with different attributes.
>
>Anyway, just seemed to me the example is not good practice but just
>made to illustrate the point on how to apply creational patterns??
>hope my question makes sense.
>


Contrived? Maybe....too many of the examples have GUI uses for my money,
but a bit of thought can find other uses.
For Decorator, think of a file you have to send to possibly many places
via many methods. The basis method is to move file from place A to file
path B. You may also need to email it to someone: make an EmailDecorator.
If you need to FTP it anywhere, add an FtpDecorator.
And so on.


Simon
Simon dot s at ghytred dot com


Reply With Quote