Configuration file support
Detailed Description
Why XML Persistence, Anyway?
If you are allergic towards industry buzzwords (like myself), you probably think XML is for consultants and "enterprise developers" (whatever that means), not for Real Programmers (like yourself). Still, I think XML is a Good Thing (TM), and is suitable not only for some multi-million dollar project with 5000 pages of design documents filled with UML and Booch notation, but also for the config files of your little pet project you're developing in your spare time, or for the document format of the application you're working on to in your [non-spare?!?] time. Here are a few reasons why I like XML:
- XML files are easy to view and easy to edit with a simple text editor - anything from Notepad to emacs will do. There are also several freely available XML editors, which make the task even easier - check out the "Buyer's Guide" section at XML.com. This means it will be easier to debug your save/load code. Ever had the problem when you write your save and load routines, and saving and loading a file definitely doesn't produce the same memory objects you started with? You have no idea whether the bug is in the save or the load routine, and spend 1 hour tracing the correct one. Not with XML: one look at the XML file itself can tell you if it's correct.
- XML files are open - anyone can read your XML files, process them, convert them with a XML parser or a few lines of Perl code. (If you still haven't picked up Perl, go ahead and spend 2-3 days to learn it. You'll thank me.) That "anyone" includes yourself after six months - if you're like me, after 6 months you won't know anything about the code you're happily hacking at today, including how to read its data files. You can find XML parsers for all kinds of environments and programming languages.
- XML files are high-level - the parser and the support lib (something like tinyxml) will take care of handling primitive data types like numbers and strings, and you'll never have the joy again of having to store the string length before the string itself (brrr...) Still, XML files are more compact than most high-level alternatives (I've used MS OLE IPropertyBags, stored in OLE structured storage files, which definitely incur more overhead).
- Disk space is ultra-cheap today, so the overhead of XML compared to binary files can be safely ignored in most cases. (In the rest of the cases, you're looking at more data than you can handle without a database engine.)
- XML is simple to use. The special case of using XML for object persistence is made even more simple with tinycfg.
Generated on Wed Feb 9 11:31:37 2005 for OpenGUI by
1.4.0