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

Diana Jaunzeikare rozziite at gmail.com
Fri Jun 5 14:56:02 UTC 2009


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