Skip to Content.
Sympa Menu

patterns-discussion - RE: [patterns-discussion] Which patterns are more frequently used?

patterns-discussion AT lists.siebelschool.illinois.edu

Subject: General talk about software patterns

List archive

RE: [patterns-discussion] Which patterns are more frequently used?


Chronological Thread 
  • From: Ekárt László <Ekart.Laszlo AT evosoft.hu>
  • To: "Christophe Addinquy" <Christophe.Addinquy AT valtech.fr>, <patterns-discussion AT cs.uiuc.edu>
  • Cc:
  • Subject: RE: [patterns-discussion] Which patterns are more frequently used?
  • Date: Wed, 6 Jul 2005 17:35:37 +0200
  • List-archive: <http://mail.cs.uiuc.edu/pipermail/patterns-discussion>
  • List-id: General talk about software patterns <patterns-discussion.cs.uiuc.edu>


Hi, there

> An original point of view, probably. But it's not always bad to be
> original :) I understand your point of view about inheritance abuse.
> However, I still think that Template Method is probably the most useful
> pattern: 1) it's the cornerstone of many patterns, including the Observer
> you put on the top ! 2) Template Method in fact doesn't requires
> inheritance,you can use it even within the same class, and it does still
> make sense.
I agree. I made a mistake. The template method is useful just do not abuse it
trough inheritance. It can be used I have used it, but I have seen systems
that abused inheritance and template method was present in this systems very
heavily.

> >Other pattern that I use extremely often is the decorator. This is
> because I tend to work in a bottom up XP style sometimes. If >you work in
> top to bottom way you shall have strategy patterns instead.
>
> Can you explain ? I've always assumed that through refactoring, the XP
> design still leads to "normal" design. In my point of view, it's the TDD
> which leads to design specifics, including strong classes insulation with
> interfaces, in order to make the system testable piece by piece ...

Here is how I proceed: Write a class that fulfils a specific functionality.
It is good for the moment or for that iteration. Later on I want to add
functionality but I do not want to break the cohesion of the first class. So
I add the functionality as a decorator class. I use aggregation instead of
inheritance so it is like adaptor. I "delegate" the methods that I need from
the first class.
You can use Mixins instead of Decorator when you add the new functionality
and refactor later in a better way. I do not know which is better, time will
tell. :-)

When you are thinking from the other way, than you will add new specific
functionality to a more generic class by strategy. (Top-down)

That is all.

Best regards,
Ekart Laszlo





Archive powered by MHonArc 2.6.16.

Top of Page