<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Seven Truths of Good Code</title>
	<link>http://blog.jtimothyking.com/2006/11/14/seven-truths-of-good-code</link>
	<description>Stories of a Self-published, Entrepreneurial Fiction Author (née Software Guy)</description>
	<pubDate>Mon, 08 Sep 2008 10:38:20 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Kris</title>
		<link>http://blog.jtimothyking.com/2006/11/14/seven-truths-of-good-code#comment-9901</link>
		<dc:creator>Kris</dc:creator>
		<pubDate>Sat, 02 Dec 2006 02:52:26 +0000</pubDate>
		<guid>http://blog.jtimothyking.com/2006/11/14/seven-truths-of-good-code#comment-9901</guid>
		<description>I really enjoyed this post... I'll refrain from printf argument but you made some great points that everyone should keep in mind as they develop.</description>
		<content:encoded><![CDATA[<p>I really enjoyed this post&#8230; I&#8217;ll refrain from printf argument but you made some great points that everyone should keep in mind as they develop.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shiftMode &#187; Blog Archive &#187; Good Code</title>
		<link>http://blog.jtimothyking.com/2006/11/14/seven-truths-of-good-code#comment-9676</link>
		<dc:creator>shiftMode &#187; Blog Archive &#187; Good Code</dc:creator>
		<pubDate>Wed, 22 Nov 2006 00:08:02 +0000</pubDate>
		<guid>http://blog.jtimothyking.com/2006/11/14/seven-truths-of-good-code#comment-9676</guid>
		<description>[...] I&#8217;d have to wholeheartedly agree on Tim&#8217;s seven truths of good code&#8230; [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] I&#8217;d have to wholeheartedly agree on Tim&#8217;s seven truths of good code&#8230; [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Seven Truths Of Good Code - rukh.de</title>
		<link>http://blog.jtimothyking.com/2006/11/14/seven-truths-of-good-code#comment-9516</link>
		<dc:creator>Seven Truths Of Good Code - rukh.de</dc:creator>
		<pubDate>Wed, 15 Nov 2006 12:48:36 +0000</pubDate>
		<guid>http://blog.jtimothyking.com/2006/11/14/seven-truths-of-good-code#comment-9516</guid>
		<description>[...] J. Timothy King writes about Seven Truths Of Good Code. Seven good points on how to separate source and data. He explains why it is a bad idea to use hardcoded data if you could create a variable for it. There is also one point about good commenting. [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] J. Timothy King writes about Seven Truths Of Good Code. Seven good points on how to separate source and data. He explains why it is a bad idea to use hardcoded data if you could create a variable for it. There is also one point about good commenting. [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Allen</title>
		<link>http://blog.jtimothyking.com/2006/11/14/seven-truths-of-good-code#comment-9511</link>
		<dc:creator>Jonathan Allen</dc:creator>
		<pubDate>Wed, 15 Nov 2006 08:04:25 +0000</pubDate>
		<guid>http://blog.jtimothyking.com/2006/11/14/seven-truths-of-good-code#comment-9511</guid>
		<description>prinftf is not a implementation of the MVC concept. It has nothing to do with the MVC concept, as anyone who even considered reading the original SmallTalk paper on MVC knows this.</description>
		<content:encoded><![CDATA[<p>prinftf is not a implementation of the MVC concept. It has nothing to do with the MVC concept, as anyone who even considered reading the original SmallTalk paper on MVC knows this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: J. Timothy King</title>
		<link>http://blog.jtimothyking.com/2006/11/14/seven-truths-of-good-code#comment-9497</link>
		<dc:creator>J. Timothy King</dc:creator>
		<pubDate>Tue, 14 Nov 2006 20:21:50 +0000</pubDate>
		<guid>http://blog.jtimothyking.com/2006/11/14/seven-truths-of-good-code#comment-9497</guid>
		<description>You're confusing the &lt;em&gt;data&lt;/em&gt; being printed with the &lt;em&gt;symbol&lt;/em&gt; used to represent that data. Yes, the data to be printed should absolutely be separate from the format. But the symbol used to represent that data is closely related to the format, especially if the format refers to a data type in a strongly typed language like C++.

Some examples:

BAD:
&lt;blockquote&gt;&lt;pre&gt;cout &#60;&#60; &#34;My name is Tim. I am 12 years old, 4'10\&#34;, 80 pounds.&#34;
  &#34; (Not really. This is just an example.)&#34; &#60;&#60; endl;&lt;/pre&gt;&lt;/blockquote&gt;

GOOD:
&lt;blockquote&gt;&lt;pre&gt;const person_t&#38; me = get_author();
cout &#60;&#60; &#34;My name is &#34; &#60;&#60; me.name() &#60;&#60; &#34;. &#34;
  &#60;&#60; &#34;I am &#34; &#60;&#60; me.age() &#60;&#60; &#34; years old, &#34;
  &#60;&#60; feet(me.height()) &#60;&#60; &#34;'&#34; &#60;&#60; inches(me.height()) &#60;&#60; &#34;\&#34;, &#34;
  &#60;&#60; me.weight() &#60;&#60; &#34; pounds.&#34;
  &#60;&#60; (me.is_real()? &#34;&#34; : &#34; (Not really. This is just an example.)&#34;)
  &#60;&#60; endl;&lt;/pre&gt;&lt;/blockquote&gt;

NOT SO GOOD:
&lt;blockquote&gt;&lt;pre&gt;const person_t&#38; me = get_author();
printf(&#34;My name is %s. I am %d years old, %d'%d\&#34;, %d pounds.%s\n&#34;,
  (const char*)(me.name().c_str()), (int)(me.age()),
  (int)(feet(me.height())), (int)(inches(me.height())),
  (int)(me.weight()),
  (me.is_real()? &#34;&#34; : &#34; (Not really. This is just an example.)&#34;));&lt;/pre&gt;&lt;/blockquote&gt;

Let's say I want to insert a field for my eye color. Make that change to the &lt;em&gt;cout&lt;/em&gt;-style and &lt;em&gt;printf&lt;/em&gt;-style formats, and tell me which is easier to keep straight.

-TimK</description>
		<content:encoded><![CDATA[<p>You&#8217;re confusing the <em>data</em> being printed with the <em>symbol</em> used to represent that data. Yes, the data to be printed should absolutely be separate from the format. But the symbol used to represent that data is closely related to the format, especially if the format refers to a data type in a strongly typed language like C++.</p>
<p>Some examples:</p>
<p>BAD:</p>
<blockquote><pre>cout &lt;&lt; &quot;My name is Tim. I am 12 years old, 4'10\&quot;, 80 pounds.&quot;
  &quot; (Not really. This is just an example.)&quot; &lt;&lt; endl;</pre>
</blockquote>
<p>GOOD:</p>
<blockquote><pre>const person_t&amp; me = get_author();
cout &lt;&lt; &quot;My name is &quot; &lt;&lt; me.name() &lt;&lt; &quot;. &quot;
  &lt;&lt; &quot;I am &quot; &lt;&lt; me.age() &lt;&lt; &quot; years old, &quot;
  &lt;&lt; feet(me.height()) &lt;&lt; &quot;'&quot; &lt;&lt; inches(me.height()) &lt;&lt; &quot;\&quot;, &quot;
  &lt;&lt; me.weight() &lt;&lt; &quot; pounds.&quot;
  &lt;&lt; (me.is_real()? &quot;&quot; : &quot; (Not really. This is just an example.)&quot;)
  &lt;&lt; endl;</pre>
</blockquote>
<p>NOT SO GOOD:</p>
<blockquote><pre>const person_t&amp; me = get_author();
printf(&quot;My name is %s. I am %d years old, %d'%d\&quot;, %d pounds.%s\n&quot;,
  (const char*)(me.name().c_str()), (int)(me.age()),
  (int)(feet(me.height())), (int)(inches(me.height())),
  (int)(me.weight()),
  (me.is_real()? &quot;&quot; : &quot; (Not really. This is just an example.)&quot;));</pre>
</blockquote>
<p>Let&#8217;s say I want to insert a field for my eye color. Make that change to the <em>cout</em>-style and <em>printf</em>-style formats, and tell me which is easier to keep straight.</p>
<p>-TimK</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://blog.jtimothyking.com/2006/11/14/seven-truths-of-good-code#comment-9496</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Tue, 14 Nov 2006 18:59:11 +0000</pubDate>
		<guid>http://blog.jtimothyking.com/2006/11/14/seven-truths-of-good-code#comment-9496</guid>
		<description>I mostly agree, except about printf format strings. The data being printed and the format it is printed in are distinct, and should be separate. printf is basically an implementation of the MVC concept.</description>
		<content:encoded><![CDATA[<p>I mostly agree, except about printf format strings. The data being printed and the format it is printed in are distinct, and should be separate. printf is basically an implementation of the MVC concept.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
