<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Configuration Options in Code or INI Files?</title>
	<atom:link href="http://www.heikkitoivonen.net/blog/2008/12/07/configuration-options-in-code-or-ini-files/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.heikkitoivonen.net/blog/2008/12/07/configuration-options-in-code-or-ini-files/</link>
	<description>A Finn in Silicon Valley - Adventures in Technology</description>
	<lastBuildDate>Wed, 17 Aug 2011 08:58:27 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
	<item>
		<title>By: zaur</title>
		<link>http://www.heikkitoivonen.net/blog/2008/12/07/configuration-options-in-code-or-ini-files/comment-page-1/#comment-6013</link>
		<dc:creator>zaur</dc:creator>
		<pubDate>Fri, 19 Dec 2008 18:53:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.heikkitoivonen.net/blog/?p=501#comment-6013</guid>
		<description>Last time I been considering a Python Object Notation (PyON). It bases on python syntax. It could be considered as readable reconstructable representation for python objects. It dosn&#039;t use eval/exec for reconstruction; it bases on AST interpretation. I think it could be usefull for configuration purposes.

http://code.google.com/p/pyon/

P.S. PyON project is very young but you already able to do interesting things :-)</description>
		<content:encoded><![CDATA[<p>Last time I been considering a Python Object Notation (PyON). It bases on python syntax. It could be considered as readable reconstructable representation for python objects. It dosn&#8217;t use eval/exec for reconstruction; it bases on AST interpretation. I think it could be usefull for configuration purposes.</p>
<p><a href="http://code.google.com/p/pyon/" rel="nofollow">http://code.google.com/p/pyon/</a></p>
<p>P.S. PyON project is very young but you already able to do interesting things <img src='http://www.heikkitoivonen.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sage</title>
		<link>http://www.heikkitoivonen.net/blog/2008/12/07/configuration-options-in-code-or-ini-files/comment-page-1/#comment-5748</link>
		<dc:creator>sage</dc:creator>
		<pubDate>Tue, 09 Dec 2008 08:32:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.heikkitoivonen.net/blog/?p=501#comment-5748</guid>
		<description>I definitly use yaml too instead of ini files.
yaml is easier to read than json (while every json file should be read by a yaml parser too)
yaml is easier to abstract complex structure than ini files.</description>
		<content:encoded><![CDATA[<p>I definitly use yaml too instead of ini files.<br />
yaml is easier to read than json (while every json file should be read by a yaml parser too)<br />
yaml is easier to abstract complex structure than ini files.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cory</title>
		<link>http://www.heikkitoivonen.net/blog/2008/12/07/configuration-options-in-code-or-ini-files/comment-page-1/#comment-5729</link>
		<dc:creator>Cory</dc:creator>
		<pubDate>Mon, 08 Dec 2008 17:41:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.heikkitoivonen.net/blog/?p=501#comment-5729</guid>
		<description>I think you&#039;re missing the most important reasons to use ini files, although you kind of dance around it.

The reason not to use code is because ini files &lt;i&gt;are not code&lt;/i&gt;.  This is important.  INI files are a declarative syntax; they cannot have ifs or loops.  Files that have a pure-declarative syntax have the following advantages:

- they can be losslessly transformed into another format (including code).  Code files do not have this advantage; there&#039;s always the risk that they contain an if block, which means you need an interpreter with a loaded namespace and runtime environment to understand them.

- they can be machine-edited.  Code can&#039;t be machine edited in the general case, see above.  You will want this if your package needs to be packaged in a .deb or .rpm for example; upgrade scripts take care of making edits around your users&#039; changes.

- They can be safely transferred (provided you filter out passwords).  Sending code over a wire is risky to the person receiving it, who must then interpret it.  Declarative ini files aren&#039;t code, and can be safely parsed.</description>
		<content:encoded><![CDATA[<p>I think you&#8217;re missing the most important reasons to use ini files, although you kind of dance around it.</p>
<p>The reason not to use code is because ini files <i>are not code</i>.  This is important.  INI files are a declarative syntax; they cannot have ifs or loops.  Files that have a pure-declarative syntax have the following advantages:</p>
<p>- they can be losslessly transformed into another format (including code).  Code files do not have this advantage; there&#8217;s always the risk that they contain an if block, which means you need an interpreter with a loaded namespace and runtime environment to understand them.</p>
<p>- they can be machine-edited.  Code can&#8217;t be machine edited in the general case, see above.  You will want this if your package needs to be packaged in a .deb or .rpm for example; upgrade scripts take care of making edits around your users&#8217; changes.</p>
<p>- They can be safely transferred (provided you filter out passwords).  Sending code over a wire is risky to the person receiving it, who must then interpret it.  Declarative ini files aren&#8217;t code, and can be safely parsed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin</title>
		<link>http://www.heikkitoivonen.net/blog/2008/12/07/configuration-options-in-code-or-ini-files/comment-page-1/#comment-5728</link>
		<dc:creator>Kevin</dc:creator>
		<pubDate>Mon, 08 Dec 2008 17:11:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.heikkitoivonen.net/blog/?p=501#comment-5728</guid>
		<description>It&#039;s python, do both. Write your INI in Python - keep the config separate from the code, but also keep it in code. Just import the config file. For long running daemons you can attempt to reload the file every x minutes or some such. This allows you to update your config without touching the application code, but gives you the power of Python for storing your config info in Dicts and such.</description>
		<content:encoded><![CDATA[<p>It&#8217;s python, do both. Write your INI in Python &#8211; keep the config separate from the code, but also keep it in code. Just import the config file. For long running daemons you can attempt to reload the file every x minutes or some such. This allows you to update your config without touching the application code, but gives you the power of Python for storing your config info in Dicts and such.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcos Dione</title>
		<link>http://www.heikkitoivonen.net/blog/2008/12/07/configuration-options-in-code-or-ini-files/comment-page-1/#comment-5726</link>
		<dc:creator>Marcos Dione</dc:creator>
		<pubDate>Mon, 08 Dec 2008 15:51:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.heikkitoivonen.net/blog/?p=501#comment-5726</guid>
		<description>ini files are really the wrong solution for complex things. see, config files are mostly a way to reprogram a certain tool; it&#039;s like the switches in the first programmable computers. implementing complex decisions with switches is difficult. for those cases I prefer coding your own decisions. an example I&#039;m toying with right now is a email server; it&#039;s routing table is complex enough to be more simple to implement by code rather than switches.</description>
		<content:encoded><![CDATA[<p>ini files are really the wrong solution for complex things. see, config files are mostly a way to reprogram a certain tool; it&#8217;s like the switches in the first programmable computers. implementing complex decisions with switches is difficult. for those cases I prefer coding your own decisions. an example I&#8217;m toying with right now is a email server; it&#8217;s routing table is complex enough to be more simple to implement by code rather than switches.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mkay</title>
		<link>http://www.heikkitoivonen.net/blog/2008/12/07/configuration-options-in-code-or-ini-files/comment-page-1/#comment-5725</link>
		<dc:creator>mkay</dc:creator>
		<pubDate>Mon, 08 Dec 2008 14:50:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.heikkitoivonen.net/blog/?p=501#comment-5725</guid>
		<description>+1 on options in code

Most &quot;options&quot; aren&#039;t really options at the office.  Some, like the Java class we should use to do X don&#039;t have any other values, but the argument is that &quot;someday we&#039;ll need that&quot;.  Usually they are instances of over-engineering.

I opt for the opposite and write straight-forward code.  When something needs to become an option, then I move to a configuration file.  Anything outside of the code needs a *lot* more documentation, maintenance, QA, etc.</description>
		<content:encoded><![CDATA[<p>+1 on options in code</p>
<p>Most &#8220;options&#8221; aren&#8217;t really options at the office.  Some, like the Java class we should use to do X don&#8217;t have any other values, but the argument is that &#8220;someday we&#8217;ll need that&#8221;.  Usually they are instances of over-engineering.</p>
<p>I opt for the opposite and write straight-forward code.  When something needs to become an option, then I move to a configuration file.  Anything outside of the code needs a *lot* more documentation, maintenance, QA, etc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Thiele</title>
		<link>http://www.heikkitoivonen.net/blog/2008/12/07/configuration-options-in-code-or-ini-files/comment-page-1/#comment-5724</link>
		<dc:creator>James Thiele</dc:creator>
		<pubDate>Mon, 08 Dec 2008 14:42:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.heikkitoivonen.net/blog/?p=501#comment-5724</guid>
		<description>-1 on config options in code.

Big downside is merging changes.

Alice writes a program and gives copies to Bob, Carol, Dan and Ellen. They all edit their copies for personal config options. Alice finds a bug and sends out a new version. Now everybody has to do a diff/patch cycle. If the config options were in a seperate file they&#039;d just drop in Alice&#039;s new code.</description>
		<content:encoded><![CDATA[<p>-1 on config options in code.</p>
<p>Big downside is merging changes.</p>
<p>Alice writes a program and gives copies to Bob, Carol, Dan and Ellen. They all edit their copies for personal config options. Alice finds a bug and sends out a new version. Now everybody has to do a diff/patch cycle. If the config options were in a seperate file they&#8217;d just drop in Alice&#8217;s new code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bc</title>
		<link>http://www.heikkitoivonen.net/blog/2008/12/07/configuration-options-in-code-or-ini-files/comment-page-1/#comment-5722</link>
		<dc:creator>bc</dc:creator>
		<pubDate>Mon, 08 Dec 2008 13:08:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.heikkitoivonen.net/blog/?p=501#comment-5722</guid>
		<description>OK, I checked. PyYAML has a &quot;safe_load&quot; function which will only create basic types, hence avoiding the security-risk of loading an untrusted file which could create a malicious object.</description>
		<content:encoded><![CDATA[<p>OK, I checked. PyYAML has a &#8220;safe_load&#8221; function which will only create basic types, hence avoiding the security-risk of loading an untrusted file which could create a malicious object.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

