ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: From attributes to elements and other concerns
Date Fri, 24 Nov 2000 18:50:21 GMT
Peter Donald wrote:

> Hi,
> I just received a number of complaints/concerns about latest ant direction
> from a number of relatively non-technical people (and as such I am not sure
> if they are valid complaints). As ant has evolved there has been a tendency
> to reduce the number of attributes in a task and increase the number of
> elements. So parameters are gradually going from "include" attributes to
> "include" elements. I was told that this is increasing difficult for
> average users. While I tend to agree that it increases difficulty I think
> it is a fair enough tradeoff for added power in general. It does increase
> the learning curve a little but ...
> Not sure - what does everyone else think ? Is it desirable to continue the
> trend or not ? I would say tentatively that it is a desirable thing to
> elementize tasks.

Interestingly, this question is not limited to just Ant.  It's a general design
issue for pretty much any XML-based data stream, and there are analogous issues
in other areas -- such as designing families of custom tags for JSP

It's probably because I look at the world from a "nested tree of objects" point
of view fairly often when designing such things, but I tend to start with the
following rule of thumb:

    If something must be specified exactly once,
    or can be specified at most once, make it an
    attribute.  If something can be specified more
    than once, make it an element (which is
    typically nested inside an "owning" element).

This principle has served me pretty well so far, and it tends to match what I
typically do when processing XML based stuff (attributes --> properties,
elements --> beans).  It also seems to be consistent with the path that Ant has
been taking lately, so it seems OK to me.

(Other than the fact that you make me change my build files every blasted
version, of course :-)

> Cheers,
> Pete

Craig McClanahan

View raw message