Exforsys

Online Training

Design Patterns - Maze Examples

This is a discussion on Design Patterns - Maze Examples within the Software Patterns forums, part of the Testing category; Hi, I just started reading design patterns (by Gamma, Helm, Johnson, Vlissides ) and looking at the Lexi example. I'm ...


Go Back   Exforsys > Testing > Software Patterns

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-09-2005, 02:51 PM
yb
Guest
 
Posts: n/a
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.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-11-2005, 01:44 PM
iscy
Guest
 
Posts: n/a
Re: Design Patterns - Maze Examples

The example using the Maze is good. May be, it's not the best, but it
makes a lot of sense. However, I don't really see what you mean by the
Maze and the decorator, because they are not used togheter.

If you get troubles with the decorator, try to get information from the
pattern called "Wrapper". It's the same thing. If you want to get a
good example but a bit different, there is the wrapper facade in POSA1,
but it's quite different from the decorator itself

iscy

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-30-2005, 05:59 PM
iscy
Guest
 
Posts: n/a
Re: Design Patterns - Maze Examples

> 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.


This example is closer to a strategy than to a decorator. Don't forget
something. The decorator is a strutural pattern, not a behavioral
pattern as your example describes.

In other words, the decorator allows you to add responsabilities to an
object dynamically. There is a base class that your object will know
that will be called the 'decorator' itself. That will let you inherit
this base class to create child classes having different
responsabilities. The main difference with the strategy, is that you
can attach more than one decorator to an object. That means, you are
using multiple decorators at the same time. In other words, your
dispatching the responsabilites of something through several objects.
The is the job of the object that is using the base class to iterator
through all of them and notify them.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 10:35 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.