[uf-new] collection-design-pattern proposal

Manu Sporny msporny at digitalbazaar.com
Sun Apr 22 22:12:42 PDT 2007


Proposed below is a much simpler method for specifying collections. It
uses the "id" attribute in the div/span elements.

Collections can be specified by adding the '.' character to specify
location in a hierarchy. The '.' character is equivalent to the
statement "child of". Example: "a.b" would express "b is a child of a".

If we wanted to express the following audio album:

+-- Black Horse and The Cherry Tree (Album title)
  +-- Black Horse and The Cherry Tree (Track #1)
  +-- One Day [Live] (Track #2)

The collection can be specified like so (pay attention to the "id"
attribute):

<div id="ktsampler" class="haudio">
 <span class="title">Black Horse and The Cherry Tree</span> by
 <span class="collaborator hcard fn">KT Tunstall</span>
 <ol class="xoxo">
  <li>
   <div id="ktsampler.bh" class="haudio">
    <span class="title">Black Horse & The Cherry Tree</span>
   </div>
  </li>
  <li>
  <div id="ktsampler.od" class="haudio">
   <span class="title">One Day [Live]</span>
  </div>
  </li>
 </ol>
</div>

Or, the alternative:

<div id="collection.ktsampler" class="haudio">
 <span class="title">Black Horse and The Cherry Tree</span> by
 <span class="collaborator hcard fn">KT Tunstall</span>
 <ol class="xoxo">
  <li>
   <div id="collection.ktsampler.bh" class="haudio">
    <span class="title">Black Horse & The Cherry Tree</span>
   </div>
  </li>
  <li>
  <div id="collection.ktsampler.od" class="haudio">
   <span class="title">One Day [Live]</span>
  </div>
  </li>
 </ol>
</div>

I propose that we use this collection-design-pattern mentioned above for
specifying all collections due to the following advances over all of the
other proposed methods:

 - It is simple and easy to write in HTML/XHTML.
 - It is compact and efficient.
 - It provides explicit structure instead of implicit structure.
 - A combination of the naming pattern with XOXO gives us everything
   that we need for collections in geo, audio, video and images.
 - It allows us to create loosely formatted parent-child relationships
   without enforcing structure (a good thing). In other words, we can
   associate an item at the top of the page with an item at the
   bottom of the page easily, without thinking of the XHTML structure.

Any objections to writing this up as a design pattern?

-- manu


More information about the microformats-new mailing list