Handling references

by Francesco Ciriaci last modified Dec 30, 2008 05:55 PM
Composite, complex objects have a different behaviour related to the use cases. Let's see in detail what happen to references between objects and objects made of sub-objects.

A) Contents that point to other contents (known also as “out-of-control”, external references, links).

Let's make an example of an article content type made of text and images. Image is a separate content type, and images embedded in articles are chosed from a common image library, shared by all CMS authors. This is a case in which the author of the article has “no control” over the images, as they have their own life outside the article, can be used by other authors in other articles. Thus these images can be modified, deleted, moved independently from articles.

Let's have a look to the use case:
versioning and references Arthur, the Author of an article on Italian food makes three versions of his article: he first write the a draft text and saves the first version. He then adds the image of a pizza and the image of a dish of pasta. He also delete a paragraph he didn't like and make some text changes, he saves the second version. Finally he corrects all typos and he decide to remove the pizza image, he saves the third and hopefully final version before publication.

Let's see what happens to his article when he decides to roll-back to version number two if, while he was editing the third version:

  1. the image has been moved in a new subfolder
  2. the image of the pizza has changed
  3. the image of the pizza has been deleted from the image library
In case 1) when Arthur rolls back to version 2 he will not see any change in his article.
In case 2) when he rolls back he will see his article with a new pizza image. He thinks: “this image is much better than the previous one”.
In case 3) when he rolls back to version 2 he will see the article with a broken image. Quite upset A. will not complain about the versioning system, but will go find the responsible! :-)

The fact is that versioning cannot be responsible of handling this kind of references between content because versioning is managed on the content by the content author, while the referenced objects are out of his control, and live outside of the content.

Hint: The same happens without versions when an article refers to an image and that image changes these change propagate to all articles that use that image. This should not change when versioning is introduced. Note: the same behaviour must be expected when browsing i.e. viewing a previous version of a content.

Invariant references

Another set of use cases, that we have called invariant references, want some references not to stick to versions of the content but to the content, independently from the version. An example is the relation Proposal-Responsible: a Proposal is a document for a new project and it is versioned; the Responsible is a person content type which is responsible for the proposal. When a proposal is reverted (rollback) to an old version the Responsible does not change, even if  in the past it has changed.
CMFEditions supports invariant references as well.