[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How should a two-digit airport runway number berepresented
Roger L Costello <costello@mitre.org> writes: > "Runways, all runways, have a 2-digit number that represents the magnetic heading of the runway to the nearest 10 degrees. If the runway's > heading is 265 — 274 degrees, then the runway number is 27 — always drop the last “0.” The opposite end of the runway is 180 degrees apart, so > Runway 09 (90 degrees)." You don't identify the source of this quotation, but whoever it is appears to have phrased things slightly loosely. Having two (decimal) digits looks to me like a property of a numeral, not a property of a number. > How to represent a runway number in XML? > > Specifically, how to represent Runway 09? > > <runwayNumber>09</runwayNumber> > > Or like this: > > <runwayNumber>9</runwayNumber> What operations do people and software perform on the value? Do they perform arithmetic? Apparently, yes: they have to know that for any runway R, runway (R + 18) mod 36 is the same physical object. Do they performa any arithmetic other than adding or subtracting 18? Do you ever calculate the sum of a set of runway numbers? The average? The standard deviation? Do they perform string operations? Presumably: at the very least, the value gets serialized to a display or to paper as part of the interface. If arithmetic is performed much more often than serialization, then storing the value internally as an integer is likely to save some type conversions and thus some cycles. If serialization happens much more often than arithmetic, storing the value internally as a string is likely to save type conversions. Of course, the additional cost of the type conversions here is going to be swamped in real life by the cost of moving data from memory into a register and back -- let alone reading it from disk -- so this specific question looks to be pretty safely in 'angels dancing on the head of a pin' territory. But thinking about how to get it right is a good exercise -- bad choices increase friction in the software. From the description in the quotation you offer, the value sounds like a numeral (that is, a string) whose numeric value is occasionally relevant, rather than a number whose serialization in decimal digits is occasionally necessary. So my first thought would be to make it a subtype of string -- just as I would do for ZIP codes in the U.S., where leading zeroes cannot be omitted without invalidating the field. But the decisive factor is not my first thought but the nature of the datum as shown by its use. I hope this helps. -- C. M. Sperberg-McQueen Black Mesa Technologies LLC http://blackmesatech.com
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|