Question about design

Discussion in 'XML' started by razael1@gmail.com, Nov 1, 2006.

  1. Guest

    Let's say, for example, that I want to represent universities in XML.
    Each university has any number of buildings, departments, and offices.
    Which of these is better?

    Option A:
    <university>
    <building>
    <name>...</name>
    </building>
    ...(include all buildings)
    <department>
    ...(do the same for departments and offices)
    </university>

    Option B:
    <university>
    <buildings>
    <building>
    ...
    </buildings>
    <departments>
    <department>
    ...
    </departments>
    etc.
    </university>

    Are putting the different types of objects in their own groups
    redundant, or does it make things clearer/more organized?

    Thanks,
    Colin K.
     
    , Nov 1, 2006
    #1
    1. Advertising

  2. wrote:
    > Are putting the different types of objects in their own groups
    > redundant, or does it make things clearer/more organized?


    As with any other programming data-structure design issue, this is as
    much a matter of style as anything else. If you were designing these as
    structures/objects in your favorite programming language, which
    organization would you prefer? The answer probably depends on which
    operations you're going to be doing most often. Approach the XML design
    the same way.

    Generally, there's no harm in having an extra level of hierarchy in your
    data structures.

    However, I would suggest using attributes for values which describe a
    datum rather than being contained within it. Specifically, I would prefer
    <building name="...">
    rather than making name an element, unless the name is itself a
    structured datum.


    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
     
    Joe Kesselman, Nov 1, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ZackS
    Replies:
    5
    Views:
    6,805
    Just an Illusion
    Jul 9, 2004
  2. SpamProof
    Replies:
    3
    Views:
    652
    SpamProof
    Dec 1, 2003
  3. dave
    Replies:
    5
    Views:
    596
    William Brogden
    Jul 17, 2004
  4. Tim Smith
    Replies:
    2
    Views:
    856
    Tim Smith
    Dec 15, 2004
  5. Bartholomew Simpson

    class design/ design pattern question

    Bartholomew Simpson, Jun 12, 2007, in forum: C++
    Replies:
    2
    Views:
    452
    Daniel T.
    Jun 12, 2007
Loading...

Share This Page