[BioRuby] GSOC: phyloXML for BioRuby: should pluralize attribute names which hold arrays?

Christian M Zmasek czmasek at burnham.org
Tue Jun 9 18:10:40 UTC 2009


Hi, Diana:

Indeed some of these plurals sound a little weird. Part of it is due to 
English issues, and also because for some elements, it is unusual to 
have more than one. For example, taxonomies: in the vast majority of 
cases, each node is associated with one taxonomy, yet phyloxml allows 
more than one taxonomy per node.

That being said, I would agree with you and others, and conclude that 
using the plurals might be more appropriate, even though a little 
unexpected.

Christian





Diana Jaunzeikare wrote:
> Hi all,
>
> Distribution element of phyloXML consists of <desc>[0..1], 
> <point>[0..*] and <polygon>[0..*] tags. When mapping it to a class I 
> have a temptation to call the class attributes in plural form for 
> point and polygon, since there can be several such tags included in 
> the Distribution. Like this:
>
>
>       Distribution class:
>
>     * desc (string)
>     * points [] (Array of Point objects)
>     * polygons [] (Array of Polygon objects)
>
>
> If I were to follow such convention throughout all classes, some 
> plural forms might sound a bit awkward. For example:
>
> PhyloXMLNode class:
>
>     * confidences [] (Array of Confidence objects)
>     * taxonomies [] (array of Taxonomy objects)
>     * sequences [] (Array of Sequence objects)
>     * events (Events objectS)
>     * distributions [] (Array of Distribution objects)
>     * references [] (Reference object)
>     * properties [] (Property object)
>
> Confidences sound a bit weird (but then again, I am not a native 
> English speaker). Events are plural, but its not an array of objects.
>
> The reason I am bringing this up, is because if the attributes which 
> hold arrays would be plural it would be easier to remember that they 
> are arrays, and not forget to add index in brackets (which I myself 
> forget fairly often when writing unit tests), for example
>
> node.sequences[0].name
>
> instead of
>
> node.sequence[0].name
>
> What do you think?
>
> Diana




More information about the BioRuby mailing list