Specific actions instead of general insert

From W3C XForms Group Wiki (Public)

Original post from MarkBirbeck:


Date: Wed, 23 May 2007 17:58:37 +0200
To: www-forms-editor@w3.org
Subject: XForms 1.1 LC comment on insert and delete
From: "Mark Birbeck" <mark.birbeck@x-port.net>

Although incredibly powerful, I feel that the latest versions of
insert and delete are just too complicated for use in day-to-day form
building. I find that I am constantly forced to look at examples in
the spec or our tutorials, especially when dealing with attributes.
And worse, if looking at mark-up from other authors, I find it takes a
while to work out what it is that some code is doing.

The core of the problem is the way that the attributes behave when
used in combination, which often requires reference to documentation
to be completely sure that you've got it right.

I have no immediate suggestions as to how to resolve this, but I would
say that in general it is easier to code if there are a number of
actions that do something small and specific, rather than one action
that does a lot. So, for example, copying a node from one instance to
another is probably easier to understand if the action is called
'copy' or 'duplicate'. The fact that an 'insertion' takes place seems
secondary, and it's even possible that a node will be overwritten
rather than inserted.

Regards,

Mark