XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
RE: Highly Declarative Designs

Hi Folks,

Thank you John, Frank, and Kurt for your comments. I am still contemplating them.

Today I found an example [1] from HTML5 which illustrates the difference between a design that is highly declarative versus one that is not.

HTML5 has an <audio> element. You can specify multiple file formats using the <source> element. E.g.,

    <audio>
        <source src="witchitalineman.ogg">
        <source src="witchitalineman.mp3">
    </audio>

A browser that can play back Ogg Vorbis files will look no further than the first <source> element. A browser that can play MP3 files but not Ogg Vorbis files will skip over the first <source> element and play the file in the second <source> element.

You can help the browsers by providing the mime types for each source file: 

    <audio>
        <source src="witchitalineman.ogg" type="audio/ogg">
        <source src="witchitalineman.mp3" type="audio/mpeg">
    </audio>


I assert that the second form is highly declarative with respect to mime type information. 

Consider this question:

   What is the mime type of the audio files?

With the second form the question is readily answered simply by navigating to the type attribute. Using XPath this is accomplished as follows:

    audio/source[1]/@type
    audio/source[2]/@type

With the first form the question is not so readily answered. It requires an application (e.g., browser) to parse "witchitalineman.ogg" and infer the mime type from the file name suffix.

My recommendation is to use the highly declarative design. In the above example, that means use the second form.

Comments?

/Roger

[1] The example comes from the book, "HTML5 for Web Designers" by Jeremy Keith.


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


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS