[Home] [By Thread] [By Date] [Recent Entries]

  • From: Roger L Costello <costello@m...>
  • To: "xml-dev@l..." <xml-dev@l...>
  • Date: Thu, 20 Jan 2022 15:14:11 +0000

Hi Folks,

Michael Kay wrote:

	Obviously if two things are completely unrelated
 	then it's wise to choose different names. But usually
 	the question arises when they're a bit different,
 	but not completely different. Discovering useful
 	abstractions, and giving the abstractions names,
 	is a vital part of data modelling.

Let's take a real use case.

I am working on an XML model of aircraft flights. When planning a flight, a navigator draws a series of legs that the aircraft is to fly. For each leg, the navigator specifies constraints on the aircraft's altitude: the aircraft must be at a certain altitude, at-or-above a certain altitude, or at-or-below a certain altitude. Here is an XML representation of a leg:

<leg>
    <altitude>
        <at-or-above>
            <altitude>29000</altitude>
        </at-or-above>
    </altitude>
</leg>

Read as: on this leg of the flight, the aircraft should be at-or-above 29,000 feet.

Notice that the XML has two <altitude> elements with different types -- one has a complexType, the other has a simpleType.

Recalling what Michael Kay said:

... if two things are completely unrelated ...

In this case I don't think the two <altitude> elements are completely unrelated.

... usually the question arises when they're a bit different, but not completely different ...

I think this is the case. The two <altitude> elements are different but not completely different.

The outer <altitude> element says,

	The aircraft's altitude must satisfy
	the constraint specified (in the
	element's content). 

The inner <altitude> element says,

	Here is an altitude. 

Do you agree that the two <altitude> elements are different but not completely different?

Again, recalling what Michael Kay said:

... Discovering useful abstractions, and giving the abstractions names, is a vital part of data modelling.

I think there are two abstractions: (1) Constraints on an altitude, and (2) a specific altitude.

Does this mean an element that implements one abstraction should have a different name than an element that implements another abstraction? 

Question: Are you okay with the two <altitude> elements? Or should they have different names?

/Roger



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member