This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Assuming the config information doesn't change during the runtime of the application, performance should not be a major factor in deciding between the two. It's likely that startup and configuration time pale in comparison to the overall execution time of the application.
I would only go with a properties approach IF: 1. All parameters can be represented as simple name - value pairs 2. There is absolutely no hierarchy or other structure that controls the use of the name - value pairs.
Dynamic configuration (which I take to mean changing the configuration of a running program) can be done with either approach. Just make sure that synchronization is used to prevent access during the changeover, and that changes properly propagate through the system.
I use XML where my applications have to support a fairly deep hierarchy and properties for simple stuff. Bill [ July 05, 2005: Message edited by: William Brogden ]
Well... heirarchy in XML is imposed by the user... this can be done similarly in properties file. For instance, in XML <main> <sub1> <sub11/> <sub12/> </sub1> </sub2> </main>
Can be written as main.sub1.sub11= main.sub1.sub12= main.sub2 =
My point is that XML structure/heirarchy can be imposed on properties file.
Author and all-around good cowpoke
Joined: Mar 22, 2000
We used to see a lot of properties files like that in JRun servlet configuration before the servlet API added web.xml they were a real pain to track, write and edit. By going to XML you can use the XSLT, Xquery, Xpath, namespaces, entities, DTDs and Schema. Nothing similar exists for properties.