Why XML config files?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daniel Billingsley

    #1

    Why XML config files?

    Ok, I wanted to ask this separate from nospam's ridiculous thread in hopes
    it could get some honest attention.

    VB6 had a some simple and fast mechanisms for retrieving values from basic
    text files, which in turn could be simply and easily maintained with
    notepad.

    I understand the benefits of XML, really, but in the case of configuration
    files it seems it is almost always nothing more than unnecessary complexity,
    both in accessing them and maintaining them.

    What am I missing?


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Why XML config files?

    Daniel,

    Well, you kind of answered your own question. The benefits of XML
    become apparent when you need them. Granted, when things work, you wonder
    why you need the extra complexity, but when you find yourself in a bind and
    you have to make changes, you will be glad you have XML, as the number of
    tools available to manipulate it are plentiful.

    Also, like everything else in XML, it allows for easy insertion into
    other business processes (I use business here loosely).

    If you want, all of the routines in VB are implemented as static methods
    in the Microsoft.Visua lBasic namespace which is distributed with the
    Framework (the classes for the most part are in Microsoft.Visua lBasic.dll).
    You can set a reference to this and use the methods as you would in VB
    normally.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "Daniel Billingsley" <dbillingsley@N O.durcon.SPAAMM .com> wrote in message
    news:umuuoJGqDH A.1724@TK2MSFTN GP10.phx.gbl...[color=blue]
    > Ok, I wanted to ask this separate from nospam's ridiculous thread in hopes
    > it could get some honest attention.
    >
    > VB6 had a some simple and fast mechanisms for retrieving values from basic
    > text files, which in turn could be simply and easily maintained with
    > notepad.
    >
    > I understand the benefits of XML, really, but in the case of configuration
    > files it seems it is almost always nothing more than unnecessary[/color]
    complexity,[color=blue]
    > both in accessing them and maintaining them.
    >
    > What am I missing?
    >
    >[/color]


    Comment

    • Tu-Thach

      #3
      Why XML config files?

      The benefit of XML config file is that you are not limited
      to just key/value settings, but you can have different
      types of configurations that are more complex. Of course
      you can achieve the same thing with regular text file, but
      why reinvent the wheel.

      Tu-Thach
      [color=blue]
      >-----Original Message-----
      >Ok, I wanted to ask this separate from nospam's[/color]
      ridiculous thread in hopes[color=blue]
      >it could get some honest attention.
      >
      >VB6 had a some simple and fast mechanisms for retrieving[/color]
      values from basic[color=blue]
      >text files, which in turn could be simply and easily[/color]
      maintained with[color=blue]
      >notepad.
      >
      >I understand the benefits of XML, really, but in the case[/color]
      of configuration[color=blue]
      >files it seems it is almost always nothing more than[/color]
      unnecessary complexity,[color=blue]
      >both in accessing them and maintaining them.
      >
      >What am I missing?
      >
      >
      >.
      >[/color]

      Comment

      • Daniel Billingsley

        #4
        Re: Why XML config files?


        "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote in
        message news:%23qpo0dGq DHA.3732@tk2msf tngp13.phx.gbl. ..[color=blue]
        > Daniel,
        >
        >...Granted, when things work, you wonder
        > why you need the extra complexity, but when you find yourself in a bind[/color]
        and[color=blue]
        > you have to make changes, you will be glad you have XML, as the number of
        > tools available to manipulate it are plentiful.[/color]

        Uh.. you mean like Editor, Notepad, Wordpad, Word, etc. ad infinitum? Come
        on, you've got to do better than that. Please, I'm not trying to be flaming
        sarcastic, but you just gave the argument for never "inventing" XML config
        files in the first place.
        [color=blue]
        >
        > Also, like everything else in XML, it allows for easy insertion into
        > other business processes (I use business here loosely).
        >
        > If you want, all of the routines in VB are implemented as static[/color]
        methods[color=blue]
        > in the Microsoft.Visua lBasic namespace which is distributed with the
        > Framework (the classes for the most part are in[/color]
        Microsoft.Visua lBasic.dll).

        That seems a rather nasty solution for my C# app.


        Comment

        • Daniel Billingsley

          #5
          Re: Why XML config files?

          Which is the cart and which is the horse? That is, by your own statement
          ("you can achieve the same thing with regular text file") didn't XML
          reinvent the wheel?

          "Tu-Thach" <anonymous@disc ussions.microso ft.com> wrote in message
          news:106101c3a8 68$70aee0c0$a50 1280a@phx.gbl.. .[color=blue]
          > The benefit of XML config file is that you are not limited
          > to just key/value settings, but you can have different
          > types of configurations that are more complex. Of course
          > you can achieve the same thing with regular text file, but
          > why reinvent the wheel.
          >
          > Tu-Thach
          >[/color]


          Comment

          • Daniel Billingsley

            #6
            Re: Why XML config files?

            Let me clarify... I meant my statement only to apply to config files, not
            XML in general. The benefit is obvious when we start talking about
            something complex like a representation of a DataTable, but config files
            are typically fairly simple.

            "Daniel Billingsley" <dbillingsley@N O.durcon.SPAAMM .com> wrote in message
            news:ucCkIdHqDH A.2772@TK2MSFTN GP10.phx.gbl...[color=blue]
            > Which is the cart and which is the horse? That is, by your own statement
            > ("you can achieve the same thing with regular text file") didn't XML
            > reinvent the wheel?
            >
            > "Tu-Thach" <anonymous@disc ussions.microso ft.com> wrote in message
            > news:106101c3a8 68$70aee0c0$a50 1280a@phx.gbl.. .[color=green]
            > > The benefit of XML config file is that you are not limited
            > > to just key/value settings, but you can have different
            > > types of configurations that are more complex. Of course
            > > you can achieve the same thing with regular text file, but
            > > why reinvent the wheel.
            > >
            > > Tu-Thach
            > >[/color]
            >
            >[/color]


            Comment

            • Dennis Redfield

              #7
              Re: Why XML config files?

              I beg to disagree. Configuration files can be quite complex. Use of XML
              for config files whenever your data is: nested rather than flat. For
              example:
              <servers>
              <server type="developme nt">
              <database>
              <name="mydataba se">
              <users>
              <user>
              <name>smith</name>
              <role>manager </role>
              </user>
              <user>
              <name>jones</name>
              <role>clerk</role>
              <users>
              </database>
              </server>
              <server type="productio n">
              <database>
              <name="yourdata base">
              <users>
              <user>
              <name>black</name>
              <role>manager </role>
              </user>
              <user>
              <name>white</name>
              <role>clerk</role>
              <users>
              </database>
              </server>
              </servers>

              Representing this in a flat INI type file is very complex if not impossible.
              when new element groups are added to the INI file access code may break.
              Since one has the power of Xpath and the XML DOM as part of the API one can
              access groups of nested information quite easily ( \servers[server
              @type="developm ent]\users).
              Also a new element groups may be added to the XML config file without
              breaking older access code.

              give it a try.

              dlr

              "Daniel Billingsley" <dbillingsley@N O.durcon.SPAAMM .com> wrote in message
              news:%23YBPFuHq DHA.2512@TK2MSF TNGP09.phx.gbl. ..[color=blue]
              > Let me clarify... I meant my statement only to apply to config files, not
              > XML in general. The benefit is obvious when we start talking about
              > something complex like a representation of a DataTable, but config files
              > are typically fairly simple.
              >
              > "Daniel Billingsley" <dbillingsley@N O.durcon.SPAAMM .com> wrote in message
              > news:ucCkIdHqDH A.2772@TK2MSFTN GP10.phx.gbl...[color=green]
              > > Which is the cart and which is the horse? That is, by your own[/color][/color]
              statement[color=blue][color=green]
              > > ("you can achieve the same thing with regular text file") didn't XML
              > > reinvent the wheel?
              > >
              > > "Tu-Thach" <anonymous@disc ussions.microso ft.com> wrote in message
              > > news:106101c3a8 68$70aee0c0$a50 1280a@phx.gbl.. .[color=darkred]
              > > > The benefit of XML config file is that you are not limited
              > > > to just key/value settings, but you can have different
              > > > types of configurations that are more complex. Of course
              > > > you can achieve the same thing with regular text file, but
              > > > why reinvent the wheel.
              > > >
              > > > Tu-Thach
              > > >[/color]
              > >
              > >[/color]
              >
              >[/color]


              Comment

              • Daniel Billingsley

                #8
                Re: Why XML config files?

                We don't disagree - I said quite clearly that config files are *typically*
                fairly simple, but acknowledged XML is obviously better for more complex
                situations.

                Of course, we're talking theoretically here. I would be curious to see what
                percentage of .NET apps have config files this complex vs. the kind that
                could easily be handled by a flat text file.

                I find your point about breaking flat text files interesting because for
                simple configuration information I see a 6-line file with all kinds of XML
                tags much more prone to maintenance problems than a simple 1 or 2 line flat
                file.

                I don't think we need to keep going 'round and 'round on this. I made this
                comment because I saw a *few* valid points in another thread which claimed
                something like OO principles and n-tiered applications were the work of
                satan. Obvious nonsensical drivel. I do, however, personally know of some
                OO purists that always tend to make simple projects 10 times more complex
                than they need to be, which in the long run costs somebody money.

                So my point here is I just that this is an example - I think (with no
                empirical evidence, of course) there are more cases than not that making
                config files XML added unnecessary complexity. Could .NET have supported
                both (without the VB namespace hack)? Hmmm.


                "Dennis Redfield" <dennis.redfiel d@acadia-ins.com> wrote in message
                news:OQsd5%23Hq DHA.2592@TK2MSF TNGP10.phx.gbl. ..[color=blue]
                > I beg to disagree. Configuration files can be quite complex.[/color]

                <snip>


                Comment

                • keyur shah

                  #9
                  Re: Why XML config files?

                  You are missing the point, of maintaining uniformity and standardization
                  across the whole world.


                  Keyur Shah
                  Verizon Communications
                  732-423-0745

                  *** Sent via Developersdex http://www.developersdex.com ***
                  Don't just participate in USENET...get rewarded for it!

                  Comment

                  • Daniel O'Connell

                    #10
                    Re: Why XML config files?


                    "Daniel Billingsley" <dbillingsley@N O.durcon.SPAAMM .com> wrote in message
                    news:uTQpyZIqDH A.2244@TK2MSFTN GP12.phx.gbl...[color=blue]
                    > We don't disagree - I said quite clearly that config files are *typically*
                    > fairly simple, but acknowledged XML is obviously better for more complex
                    > situations.
                    >
                    > Of course, we're talking theoretically here. I would be curious to see[/color]
                    what[color=blue]
                    > percentage of .NET apps have config files this complex vs. the kind that
                    > could easily be handled by a flat text file.
                    >
                    > I find your point about breaking flat text files interesting because for
                    > simple configuration information I see a 6-line file with all kinds of XML
                    > tags much more prone to maintenance problems than a simple 1 or 2 line[/color]
                    flat[color=blue]
                    > file.
                    >
                    > I don't think we need to keep going 'round and 'round on this. I made[/color]
                    this[color=blue]
                    > comment because I saw a *few* valid points in another thread which claimed
                    > something like OO principles and n-tiered applications were the work of
                    > satan. Obvious nonsensical drivel. I do, however, personally know of[/color]
                    some[color=blue]
                    > OO purists that always tend to make simple projects 10 times more complex
                    > than they need to be, which in the long run costs somebody money.
                    >
                    > So my point here is I just that this is an example - I think (with no
                    > empirical evidence, of course) there are more cases than not that making
                    > config files XML added unnecessary complexity. Could .NET have supported
                    > both (without the VB namespace hack)? Hmmm.
                    >[/color]

                    No. Remember, while configuration files are generally pretty simple, but
                    configuration can include things like assembly version redirections, etc,
                    which while not in every configuratoin, support HAS to be there, it may be
                    needed. Splitting across different formats just complicates things
                    needlessly. The choice to provide the slightly more complex solution with
                    vastly superior flexibility is a good choice, in my opinion. Flat files
                    simplicity is not enough to make up for their lack of flexibility.

                    It is, in theory, possible for an developer to write an INI or whatever for
                    his own settings. I'd call their design into question, I consider INI's and
                    the registry to be for legacy use only by this point.[color=blue]
                    >
                    > "Dennis Redfield" <dennis.redfiel d@acadia-ins.com> wrote in message
                    > news:OQsd5%23Hq DHA.2592@TK2MSF TNGP10.phx.gbl. ..[color=green]
                    > > I beg to disagree. Configuration files can be quite complex.[/color]
                    >
                    > <snip>
                    >
                    >[/color]


                    Comment

                    • Jeffrey Tan[MSFT]

                      #11
                      Re: Why XML config files?


                      Hi Daniel,

                      Thanks for posting in this group.
                      I have reviewed your posts. I think you already know the much benefit of
                      the XML, but as you think, most of the configuration files in .Net are
                      simple, so it worths no while to introduce such "complex" technical for
                      them.
                      I think the uniform xml format for config files is for uniformity and
                      standardization (just as keyur said). Just so, the .Net can provide the
                      uniform way for accessing and managing these files.
                      For the text file "simplicity " and xml file "complexìty ", I think this
                      points to the content of the configuration file. This simplicity based on
                      you manipulating the configuration file manually. While you maintain the
                      config files through program in .Net or other applications, I think plaint
                      text file's "simplicity " becomes not so simple(because of non static and
                      uniform architecture). While xml's "complexity " become more easy(because of
                      rich tools and access models). We should be aware of the percentage of
                      accessing config files manually or programmaticall y.
                      Also, all the config files in the xml format(whether short or long) are
                      more scalable.

                      Hope this helps,

                      Best regards,
                      Jeffrey Tan
                      Microsoft Online Partner Support
                      Get Secure! - www.microsoft.com/security
                      This posting is provided "as is" with no warranties and confers no rights.

                      --------------------
                      | From: "Daniel Billingsley" <dbillingsley@N O.durcon.SPAAMM .com>
                      | References: <umuuoJGqDHA.17 24@TK2MSFTNGP10 .phx.gbl>
                      <106101c3a868$7 0aee0c0$a501280 a@phx.gbl>
                      <ucCkIdHqDHA.27 72@TK2MSFTNGP10 .phx.gbl>
                      <#YBPFuHqDHA.25 12@TK2MSFTNGP09 .phx.gbl>
                      <OQsd5#HqDHA.25 92@TK2MSFTNGP10 .phx.gbl>
                      | Subject: Re: Why XML config files?
                      | Date: Tue, 11 Nov 2003 14:03:07 -0500
                      | Lines: 33
                      | X-Priority: 3
                      | X-MSMail-Priority: Normal
                      | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
                      | X-Mimeole: Produced By Microsoft MimeOLE V6.00.2800.1165
                      | Message-ID: <uTQpyZIqDHA.22 44@TK2MSFTNGP12 .phx.gbl>
                      | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
                      | NNTP-Posting-Host: 68-74-16-211.ded.amerite ch.net 68.74.16.211
                      | Path:
                      cpmsftngxa06.ph x.gbl!TK2MSFTNG XA06.phx.gbl!TK 2MSFTNGXA05.phx .gbl!TK2MSFTNGP 0
                      8.phx.gbl!TK2MS FTNGP12.phx.gbl
                      | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1984 59
                      | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
                      |
                      | We don't disagree - I said quite clearly that config files are *typically*
                      | fairly simple, but acknowledged XML is obviously better for more complex
                      | situations.
                      |
                      | Of course, we're talking theoretically here. I would be curious to see
                      what
                      | percentage of .NET apps have config files this complex vs. the kind that
                      | could easily be handled by a flat text file.
                      |
                      | I find your point about breaking flat text files interesting because for
                      | simple configuration information I see a 6-line file with all kinds of XML
                      | tags much more prone to maintenance problems than a simple 1 or 2 line
                      flat
                      | file.
                      |
                      | I don't think we need to keep going 'round and 'round on this. I made
                      this
                      | comment because I saw a *few* valid points in another thread which claimed
                      | something like OO principles and n-tiered applications were the work of
                      | satan. Obvious nonsensical drivel. I do, however, personally know of
                      some
                      | OO purists that always tend to make simple projects 10 times more complex
                      | than they need to be, which in the long run costs somebody money.
                      |
                      | So my point here is I just that this is an example - I think (with no
                      | empirical evidence, of course) there are more cases than not that making
                      | config files XML added unnecessary complexity. Could .NET have supported
                      | both (without the VB namespace hack)? Hmmm.
                      |
                      |
                      | "Dennis Redfield" <dennis.redfiel d@acadia-ins.com> wrote in message
                      | news:OQsd5%23Hq DHA.2592@TK2MSF TNGP10.phx.gbl. ..
                      | > I beg to disagree. Configuration files can be quite complex.
                      |
                      | <snip>
                      |
                      |
                      |

                      Comment

                      • Marc Scheuner [MVP ADSI]

                        #12
                        Re: Why XML config files?

                        >Of course, we're talking theoretically here. I would be curious to see what[color=blue]
                        >percentage of .NET apps have config files this complex vs. the kind that
                        >could easily be handled by a flat text file.[/color]

                        Well, even if there are only a few that benefit from having XML handle
                        the complexities, I think it's worth it going that way. I investigated
                        quite thoroughly whether we should use keep on using our trusty .INI
                        files instead - we gave up on it in the end, since there are some
                        cases (not many, but some) where the two-level section/key + value
                        just aren't enough.

                        Also, with all the XML support built right into the .NET framework,
                        you'd be foolish not to use it, and instead go back to re-invent the
                        wheel one more time.

                        Yes, XML is more complex and more verbose - get over it, and start
                        embracing it.

                        Marc
                        =============== =============== =============== =============== ====
                        Marc Scheuner May The Source Be With You!
                        Bern, Switzerland m.scheuner(at)i nova.ch

                        Comment

                        • Ed Crowley

                          #13
                          Re: Why XML config files?

                          I remember being on a nightmare project where we were using .INI files to
                          store language translations, and running into huge problems with (lack of)
                          proper Unicode support. Oh, and I remember everything breaking if the files
                          grew larger than 64KB ...

                          "Daniel Billingsley" <dbillingsley@N O.durcon.SPAAMM .com> wrote in message
                          news:uTQpyZIqDH A.2244@TK2MSFTN GP12.phx.gbl...[color=blue]
                          > We don't disagree - I said quite clearly that config files are *typically*
                          > fairly simple, but acknowledged XML is obviously better for more complex
                          > situations.
                          >
                          > Of course, we're talking theoretically here. I would be curious to see[/color]
                          what[color=blue]
                          > percentage of .NET apps have config files this complex vs. the kind that
                          > could easily be handled by a flat text file.
                          >
                          > I find your point about breaking flat text files interesting because for
                          > simple configuration information I see a 6-line file with all kinds of XML
                          > tags much more prone to maintenance problems than a simple 1 or 2 line[/color]
                          flat[color=blue]
                          > file.
                          >
                          > I don't think we need to keep going 'round and 'round on this. I made[/color]
                          this[color=blue]
                          > comment because I saw a *few* valid points in another thread which claimed
                          > something like OO principles and n-tiered applications were the work of
                          > satan. Obvious nonsensical drivel. I do, however, personally know of[/color]
                          some[color=blue]
                          > OO purists that always tend to make simple projects 10 times more complex
                          > than they need to be, which in the long run costs somebody money.
                          >
                          > So my point here is I just that this is an example - I think (with no
                          > empirical evidence, of course) there are more cases than not that making
                          > config files XML added unnecessary complexity. Could .NET have supported
                          > both (without the VB namespace hack)? Hmmm.
                          >
                          >
                          > "Dennis Redfield" <dennis.redfiel d@acadia-ins.com> wrote in message
                          > news:OQsd5%23Hq DHA.2592@TK2MSF TNGP10.phx.gbl. ..[color=green]
                          > > I beg to disagree. Configuration files can be quite complex.[/color]
                          >
                          > <snip>
                          >
                          >[/color]


                          Comment

                          • Daniel Billingsley

                            #14
                            Re: Why XML config files?

                            You folks are arguing for the need for XML config files in some cases, which
                            I've already admitted several times. I guess I should have made the subject
                            "why no more flat config files" to better represent my question.

                            In regards to supporting both simple flat files and XML files, I don't buy
                            the argument that it makes things too complicated. It doesn't seem any more
                            complicated to me than having to be aware of the way search paths worked in
                            DOS 6.22 or the way a web application can have multiple config files
                            scattered across several folders creating a complex hierarchy of config
                            settings. The rules would be quite simple:
                            1) look in a flat text file named xxx
                            2) look in the config file named xxx
                            3) XML takes precedence on conflict

                            Just think of a case where your config files only has one setting and you're
                            on the phone with a user of your software and you're trying to get them to
                            turn on verbose logging in the config file to track down some obscure bug...
                            would you rather have to walk the typical end user through changing a file
                            with one line

                            Logging=0
                            to
                            Logging=3

                            or have to get them to make the right change in an XML file. I'd take the
                            former any day. This is an example where the complexity of XML will
                            undoubtedly cost people money.

                            In fact, now that I think of it, the beauty of supporting both would be you
                            could put a few basic things like that in the .ini file and the more complex
                            stuff in the XML file.

                            As for .ini and registry being legacy, I think that is kind of a
                            self-defeating argument. We've been told for 5 years the registry was
                            supposed to make config files obsolete, and here we trying to get away from
                            the registry as much as possible and go back to config files. Maybe I'm
                            just an ornery old fart, but I'm very skeptical of the latest greatest new
                            directions from MS being the final word.

                            The "reinventin g the wheel" argument is interesting too in that regard,
                            since XML config files is I guess the 3rd version now. I agree it's a good
                            reinvention, but that argument isn't logical - as if leaving flat file
                            support in .NET would have been a 4th version. No, it was the 1st. Yes, it
                            would be unwise of me to write my own flat config file support at this
                            point, but that's quite a different thing from MS leaving it in .NET.

                            Yes, there are reasons why XML config files are a great thing, but that
                            ain't two of them.

                            Now, the international/unicode argument is an interesting one. I wonder how
                            big the impact of that is though, from the standpoint of number of projects
                            it effects. Since XML is in reality a simple text file, how does it solve
                            that problem?

                            Please don't let this degrade into some kind of flame war as if I'm arguing
                            against XML, or that direction, or MS in general. I'm ONLY arguing against
                            making things unnecessarily complex, which I believe XML config often does.



                            Comment

                            • Mark Broadbent

                              #15
                              Re: Why XML config files?

                              Daniel Billingsley wrote:
                              [color=blue]
                              > Ok, I wanted to ask this separate from nospam's ridiculous thread in
                              > hopes it could get some honest attention.
                              >
                              > VB6 had a some simple and fast mechanisms for retrieving values from
                              > basic text files, which in turn could be simply and easily maintained
                              > with notepad.
                              >
                              > I understand the benefits of XML, really, but in the case of
                              > configuration files it seems it is almost always nothing more than
                              > unnecessary complexity, both in accessing them and maintaining them.
                              >
                              > What am I missing?[/color]

                              thanks for a very good interesting post. I am speaking as a (you could
                              say) "wannabe developer" in c# so I do not talk as someone with a great
                              authority on the subject :?)
                              I must admit to agreeing with you that the arguments against simple ini
                              files has left me somewhat unconvinced possibly like yourself. I still
                              remember the days of MSDOS, Lotus123 etc and cant help but feel that
                              things have gone almost full circle (not a bad thing). One of the
                              reasons we are told is because of dll hell.
                              I remember when Microsoft didnt embrace standards but made up there
                              own, remember the battle between corba and com. Now ms is submitting
                              standards to the ecma! People would not have believed that 10 years ago.
                              And I guess as much as people may argue that what we are getting IS an
                              improvement to what we had, I wouldnt be suprised to see the
                              reinvention of a light weight registry in 10 years time. I guess what I
                              am saying is this ...that no matter whether it is an improvement or not
                              the fact of the matter is that it is here and it is here for the
                              forseeable future, so we must embrace it where we can.

                              "You can't say civilization don't advance -- for every war, they kill
                              you in a new way"
                              Will Rogers

                              --

                              Br,
                              Mark Broadbent
                              mcdba , mcse+i
                              =============

                              Comment

                              Working...