Graeme Geldenhuys wrote:
> On 12/3/06, Al Boldi <[EMAIL PROTECTED]> wrote:
> > Design Patterns won't help you introduce flexibility, they only help you
> > put structure into your design.  So the key here is abstraction rather
> > than patterns.  TObject is a great example of abstraction to yield
> > flexibility.
>
> Not that this is the mailing list to discuss design patterns, but I
> totally disagree with you statement about flexibility!  Design
> Patterns add flexibility and structure - obviously dependent on what
> design patterns you use.
>
> A few simple examples (only looking at Behavioral Patterns):
>
> Iterator and Visitor:
> The Visitor lets you apply some action to a object, combined with the
> Iterator, you can run through  a hierarchy of objects applying that
> action.  No need for the Visitor to know the inner details of the
> hierarchy. That's flexible!  For excellent examples of that, have a
> look at the tiOPF Framework.  tiOPF is built on this principal.
>
> Mediator and Observer:
> Combine those as I have done in the Model-GUI-Mediator and you can
> make any Standard GUI component object-aware.  Those mediator can be
> reused on multiple forms without rewriting any code, compared to the
> standard Delphi way one event handlers are writting inside forms and
> have to be duplicated on every other form.
>
> State pattern:
> Write a CSV or XML parser using a State Machine.  It is very flexible
> and allows you to extend it, hook up event handlers while the parser
> is in different states, etc.  Again very flexible.  I have posted my
> CSV State Machine a few months back in the FPC mailing list.
>
> The list goes on, but I think you get my point...  :-)  And again, I
> haven't even touched on Creational or Structural Patterns.

Thanks for the superb examples, and I agree with you somewhat, but Design 
Patterns don't implement anything, they only invoke code in some structured 
way.  So the flexibility/ reusability/ maintainability is really dependent 
on the underlying code.  Once this is sufficiently abstracted, you could 
just plug-and-play any Design Pattern.

But still, your examples are great; can you give some links?


Thanks!

--
Al

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to