[Twisted-Python] grokking Cacheable

Glyph Lefkowitz glyph at twistedmatrix.com
Fri Oct 25 17:35:55 EDT 2002

On Fri, 25 Oct 2002 09:16:08 -0600, Bruce Mitchener <bruce at cubik.org> wrote:

> That's why I tend to not use the default implementation of
> getStateToCacheAndObserveFor and now explicitly list out which attributes I
> want to transmit.  (Although in some cases, I'm also transforming the data
> into a different format for the client-side representation as well.)

Just thought I'd chime in and explain why this is an especially good idea ;-).

For both Copyables and Cacheables, it's good to be nice and explicit about what
you want sent vs. what you don't; so not accepting the default is definitely a
good idea.  By transforming the data for client-side representation you not
only save potentially unnecessary space and prevent errors that result from
copying unknown types, you also make your application easier to interface to
from other programming languages, because it's obvious what that language
should expect in a copied structure from you.

In Cacheables this is even more true because you typically don't want to lose
the "observer" object, which is ignored by the default implementation.

 |    <`'>    |  Glyph Lefkowitz: Travelling Sorcerer  |
 |   < _/ >   |  Lead Developer,  the Twisted project  |
 |  < ___/ >  |      http://www.twistedmatrix.com      |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20021025/3b9721d4/attachment.pgp 

More information about the Twisted-Python mailing list