[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] Best practice for XSD enumeration values?
- From: Michael Kay <mike@saxonica.com>
- To: Roger L Costello <costello@mitre.org>
- Date: Thu, 17 Feb 2022 09:21:45 +0000
Firstly, I think you can only assess whether a design is good or bad if you know what the design objectives are, and we don't.
Secondly, if there's an established and well-defined terminology in common use in the application domain, then use it.
Third, the problem here to my eyes is not the "wordiness" of the values, it's the fact that you're packing multiple attributes of an airport into one property. Decompose it: is the airport civil or military or both, is it active or dormant, does it have permanent runways or not. Once you decompose it, you will naturally end up with simple keywords for the values of the properties.
In the UK I understand there are four types of charity:
• charitable incorporated organisation (CIO)
• charitable company (limited by guarantee)
• unincorporated association
• trust
If this is what the law says, and these are the names in the legislation, and there are no well-established abbreviations, then I think it would be reasonable to use them as the enumeration values for a "type-of-charity" attribute, despite the fact that they are wordy. But if there are commonly-used abbreviations, then I would use those in preference. And perhaps use "CIO" for the first one, since an abbreviation is defined - but that needs thought, because the abbreviation might be ambiguous to some users.
Michael Kay
Saxonica
> On 16 Feb 2022, at 15:54, Roger L Costello <costello@mitre.org> wrote:
>
> Hi Folks,
>
> This simpleType has a list of enumeration values:
>
> <xs:simpleType name="AirportType">
> <xs:restriction base="xs:string">
> <xs:enumeration value="active civil airport" />
> <xs:enumeration value="active military airport" />
> <xs:enumeration value="active joint (civil and military)" />
> <xs:enumeration value="active airport having permanent type surface runways" />
> </xs:restriction>
> </xs:simpleType>
>
> What do you think about those enumeration values? Good? Bad?
>
> A colleague told me: Whitespaces in enumeration values are evil." Do you agree? On the one hand, whitespace enables a value to be easily read. On the other hand, when someone is creating an XML document they might accidentally insert two spaces between words, thus yielding invalid data. Whitespaces good or bad?
>
> The same colleague recommended slamming the words together, and uppercase the first letter of following words, e.g., change "active civil airport" to "activeCivilAirport". But what about values with punctuation such as this value "active joint (civil and military)"? Slamming those words together will create a mess. Should punctuation be prohibited in enumeration values?
>
> This is a pretty long enumeration value: "active airports having permanent type surface runways". Are long values bad? Is there a recommended limit to the length of enumeration values?
>
> I am interested in hearing your thoughts on this issue.
>
> /Roger
>
> _______________________________________________________________________
>
> XML-DEV is a publicly archived, unmoderated list hosted by OASIS
> to support XML implementation and development. To minimize
> spam in the archives, you must subscribe before posting.
>
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
> subscribe: xml-dev-subscribe@lists.xml.org
> List archive: http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
>
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]