I'm doing a bit of editing today, I'll look at cleaning up that section today.
Thanks,
Kent
On Nov 22, 2007 7:47 AM, Lorenzo Gil Sanchez
The previous sentence has a typo which changed complete meaning
of that sentence (I blame Emacs' M-/ ) . Then the following sentence
become clueless
In the previous sentence, I used 'adpater' instead of 'adapted'
(in the second place), it should be like this:
But in the `Motivation` section, GoF says: "Often the
adapter is responsible for functionality the adapted class doesn't
provide". ZCA adapter has more focus on adding functionalities than
new interface for existing functionality of adaptee.
It looks like, it is still not very clear. I will try to re-write it later.
May be:
ZCA adapter has more focus on adding functionalities than
new interface for existing functionality of adapted class/(object?).
Regards,
Baiju M
I re-wrote that section like this, please review:
---------------------------------------------------------------------
Adapter pattern
~~~~~~~~~~~~~~~
The adapter concept in Zope Component Architecture and the classic
`adapter pattern` as described in Design Patterns book are very
similar. But the intent of ZCA adapter usage is more wider than the
`adapter pattern` itself. The intent of `adapter pattern` is to
convert the interface of a class into another interface clients
expect. This allows classes work together that couldn't otherwise
because of incompatible interfaces. But in the `motivation` section
of Degisgn Patterns book, GoF says: "Often the adapter is responsible
for functionality the adapted class doesn't provide". ZCA adapter has
more focus on adding functionalities than creating a new interface for
an adapted object (adaptee). ZCA adapter lets adapter classes extend
functionality by adding methods. (It would be interesting to note
that `Adapter` was known as `Feature` in earlier stage of ZCA
design. ) [#feature]_
The above paragraph has a quote from Gang of Four book, it ends like
this: " ...adapted class doesn't provide". But in the next sentence I
used "adapted object" instead of "adapted class", because GoF
describes about two variants of adapters based on implementations.
The first one is called `class adapter` and the other one is called
`object adapter`. A class adapter uses multiple inheritance to adapt
one interface to another, on the other hand an object adapter relies
on object composition. ZCA adapter is following object adapter
pattern, which use delegation as a mechanism for composition. GoF's
second principle of object-oriented design goes like this: "Favor
object composition over class inheritance". For more details about
this subject please read Design Patterns book.
The major attraction of ZCA adapter are the explicit interface for
components and the component registry. ZCA adapter components are
registered in component registry and looked up by client objects using
interface and name when required.
.. [#feature] Thread discussing renaming of `Feature` to `Adapter`:
http://mail.zope.org/pipermail/zope3-dev/2001-December/000008.html
Regards,
Baiju M