[plug] Data Abstraction

Onno Benschop onno at itmaze.com.au
Wed Dec 17 15:19:30 WST 2003


On Wed, 2003-12-17 at 17:48, James Devenish wrote:
> In message <1071642942.22241.133.camel at latte.internal.itmaze.com.au>
> on Wed, Dec 17, 2003 at 05:35:43PM +1100, Onno Benschop wrote:
> > An item contains one or more descriptors.
> > A descriptor refers to one blob.
> > A blob may be referred to by one or more descriptors.
> [...]
> > When I create a map, I don't know yet if the blobs can be stored, nor do
> > I know what name they'll get until I store them. Thus I cannot generate
> > the HTML for the roll-over until I've stored the blob.
> 
> So...create the map *after* all the blobs are saved. I'm missing the
> problem, aren't I?

Yup, but a valiant effort ;-)

> Are you needing a way to determine *when* the map can be created,

No.

> or are
> you having a problem referring to blobs from descriptors when the blobs
> are unsaved?

No.

> Or do items already contain object references to
> descriptors, and descriptors contain object references to blobs, but you
> don't want to iterate through the blobs to determine when they've been
> saved?

No.

> > I don't want to store the blob directly, I need to do it via the
> > descriptors, because they contain the actual information about each blob
> > and their relationship to the item.
> 
> Do descriptors/blobs refer to the item/descriptor, or is it strictly
> Item's descriptor_id -> Descriptor's blob_path -> Blob's data?

Yes and no...

Items and Descriptors are records in a table. Blobs are files in a
directory.

I store a file by storing it with a name that is the md5sum of the file,
this saves disk-space, because no duplicate files get stored (I know
there is a "chance" of the same sum for a different file - don't care at
this stage - since the md5sum is abstracted anyway - I can simply and
trivially come up with a different naming convention)

The Item record has an id (the item-id), that gets used in the
descriptor record to create a 1->many relationship, allowing multiple
descriptors per item.

The descriptor record contains the name of the file it refers to.

At the time my map_store function runs, nothing exists. I need to create
an item, save it's id, add descriptors, saving their ids, retrieve the
blobNames from the descriptor, generate the HTML, update the item.

BUT...

If I directly store blobs from within the item-creation, I'm skipping a
level of abstraction.

I need for items to know about descriptors, and for descriptors to know
about blobs, but I don't want items to access blobs directly.

I realise that I'm stuck into my way of approaching this problem, thus
my message to the list...


Onno Benschop 

Connected via Optus B3 at S34°43'17" - E150°34'56" (Kangaroo Valley, NSW)
-- 
()/)/)()        ..ASCII for Onno.. 
|>>?            ..EBCDIC for Onno.. 
--- -. -. ---   ..Morse for Onno.. 

Proudly supported by Skipper Trucks, Highway1, Concept AV, Sony Central, Dalcon
ITmaze - ABN: 56 178 057 063 - ph: 04 1219 8888 - onno at itmaze dot com dot au




More information about the plug mailing list