<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 6/5/09 7:29 PM, Steve Schmechel wrote:
<blockquote cite="mid:807604.62101.qm@web50806.mail.re2.yahoo.com"
 type="cite">
  <pre wrap="">--- On Fri, 6/5/09, Wichert Akkerman <a class="moz-txt-link-rfc2396E" href="mailto:wichert@wiggy.net">&lt;wichert@wiggy.net&gt;</a> wrote:

  </pre>
  <blockquote type="cite">
    <pre wrap="">From: Wichert Akkerman <a class="moz-txt-link-rfc2396E" href="mailto:wichert@wiggy.net">&lt;wichert@wiggy.net&gt;</a>
Subject: Re: [Grok-dev] Annotations Usage Pattern
To: "Paul Wilson" <a class="moz-txt-link-rfc2396E" href="mailto:paulalexwilson@gmail.com">&lt;paulalexwilson@gmail.com&gt;</a>
Cc: "Grok" <a class="moz-txt-link-rfc2396E" href="mailto:grok-dev@zope.org">&lt;grok-dev@zope.org&gt;</a>
Date: Friday, June 5, 2009, 8:53 AM
Previously Paul Wilson wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">Hi Grokkers,

I'm writing a system that uses annotations to store
      </pre>
    </blockquote>
    <pre wrap="">metadata about my
    </pre>
    <blockquote type="cite">
      <pre wrap="">objects. I'm using the annotations concept as a way of
      </pre>
    </blockquote>
    <pre wrap="">providing an
    </pre>
    <blockquote type="cite">
      <pre wrap="">extensible metadata facility. However as I continue to
      </pre>
    </blockquote>
    <pre wrap="">read and learn about
    </pre>
    <blockquote type="cite">
      <pre wrap="">Zope/Grok - I'm not sure about whether I'm taking the
      </pre>
    </blockquote>
    <pre wrap="">right approach.
    </pre>
    <blockquote type="cite">
      <pre wrap="">Looking at code/commentries written by a prominent
      </pre>
    </blockquote>
    <pre wrap="">Grok/Zope member, they
    </pre>
    <blockquote type="cite">
      <pre wrap="">advocate only non-extensive usage of annotations, and
      </pre>
    </blockquote>
    <pre wrap="">in their code write a
    </pre>
    <blockquote type="cite">
      <pre wrap="">meta-data facility which uses containment rather than
      </pre>
    </blockquote>
    <pre wrap="">annotations to solve
    </pre>
    <blockquote type="cite">
      <pre wrap="">the problem.

What wisdom on this topic do you have?
      </pre>
    </blockquote>
    <pre wrap="">It depends a bit on your application. Annotations are very
convenient,
but they have one downside: annotations are not stored
directly on
the object being annotated but in a BTree on that object.
That means
they are not in the same ZODB object. So instead of loading
one object
from the ZODB you might need to load several objects, which
will
increase latency and cache pressure. Most of the time that
is not
problematic. If you need to scale up to large or high
performance
systems this can become an important factor.

A rule of thumb: data that is accessed often should be
stored in the
ZODB object, for example via an attribute on the python
object.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
So, to clarify the rule against some examples I was considering:

If I have several types of content objects for which I want to add a "comment" feature, and the comments will generally be viewed every time the content objected is viewed, placing the collection of comments on an attribute of the content object would be the way to go.
  </pre>
</blockquote>
<br>
Yes.<br>
<br>
<blockquote cite="mid:807604.62101.qm@web50806.mail.re2.yahoo.com"
 type="cite">
  <pre wrap="">If I want to record the history of work-flow state for various content objects, but only authors and administrators might view this information occasionally, then a collection of that history objects as an annotation on the content object would be more appropriate.
  </pre>
</blockquote>
<br>
Correct.<br>
<br>
<blockquote cite="mid:807604.62101.qm@web50806.mail.re2.yahoo.com"
 type="cite">
  <pre wrap="">Am I understanding this correctly?
  </pre>
</blockquote>
<br>
Indeed you are!<br>
<br>
Wichert.<br>
</body>
</html>