<?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: Code Satisfaction</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2007/03/07/code-satisfaction/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2007/03/07/code-satisfaction/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Thu, 09 Feb 2012 19:28:40 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: AT--o</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/03/07/code-satisfaction/#comment-53539</link>
		<dc:creator>AT--o</dc:creator>
		<pubDate>Mon, 01 Nov 2010 07:41:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1620#comment-53539</guid>
		<description>&lt;p&gt;Oh, so that is why I feel the need to start all over.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Oh, so that is why I feel the need to start all over.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jan</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/03/07/code-satisfaction/#comment-22758</link>
		<dc:creator>Jan</dc:creator>
		<pubDate>Mon, 12 Mar 2007 13:08:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1620#comment-22758</guid>
		<description>&lt;p&gt;Simon that&#039;s genius!&lt;/p&gt;
&lt;p&gt;There you go,we can go back to a page a sub.&lt;br&gt;
Can anyone else come up with an example (other than the constants declaration)?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Simon that&#8217;s genius!</p>
<p>There you go,we can go back to a page a sub.<br />
Can anyone else come up with an example (other than the constants declaration)?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon Murphy</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/03/07/code-satisfaction/#comment-22755</link>
		<dc:creator>Simon Murphy</dc:creator>
		<pubDate>Mon, 12 Mar 2007 06:28:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1620#comment-22755</guid>
		<description>&lt;p&gt;I have to say I&#039;m a paper fan rather than a comments/code in the ide fan. Whilst going straight to the IDE may seem like an efficiency, typing/writing is not the time critical part of what I do.I&#039;d say I spend more time thinking/reseaching/planning/designing. Doing any of those faster/better would have a bigger effect for me, and a big piece of paper is the best I&#039;ve found for me so far.&lt;/p&gt;
&lt;p&gt;Dick - why not use callbyname? (xl 2k + I think?)&lt;br&gt;
AS well as saving code it makes your code less brittle&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;each&lt;/span&gt; f &lt;span class=&quot;kw1&quot;&gt;in&lt;/span&gt; rs.fields&lt;br&gt;
&#160; &#160;callbyname theObjectofYourClass, f.name, vblet, f.value&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;next&lt;/span&gt; f&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Personally though I&#039;d be tempted to put a recordset in the class so its clients could use all that ado good stuff. In fact I&#039;d probably use a variant array.&lt;/p&gt;
&lt;p&gt;Totally agree on business application based naming and clear interfaces, I&#039;d much rather this than comments.&lt;br&gt;
cheers&lt;br&gt;
Simon&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I have to say I&#8217;m a paper fan rather than a comments/code in the ide fan. Whilst going straight to the IDE may seem like an efficiency, typing/writing is not the time critical part of what I do.I&#8217;d say I spend more time thinking/reseaching/planning/designing. Doing any of those faster/better would have a bigger effect for me, and a big piece of paper is the best I&#8217;ve found for me so far.</p>
<p>Dick &#8211; why not use callbyname? (xl 2k + I think?)<br />
AS well as saving code it makes your code less brittle</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">for</span> <span class="kw1">each</span> f <span class="kw1">in</span> rs.fields<br />
&nbsp; &nbsp;callbyname theObjectofYourClass, f.name, vblet, f.value<br />
<span class="kw1">next</span> f</div>
</div>
<p>Personally though I&#8217;d be tempted to put a recordset in the class so its clients could use all that ado good stuff. In fact I&#8217;d probably use a variant array.</p>
<p>Totally agree on business application based naming and clear interfaces, I&#8217;d much rather this than comments.<br />
cheers<br />
Simon</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jan</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/03/07/code-satisfaction/#comment-22751</link>
		<dc:creator>Jan</dc:creator>
		<pubDate>Sat, 10 Mar 2007 23:12:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1620#comment-22751</guid>
		<description>&lt;p&gt;Dick, true example! but at least I know, you thought through the options first.&lt;br&gt;
Just cause I make rules, doesn&#039;t mean I don&#039;t break rules.  I agree with you all.&lt;/p&gt;
&lt;p&gt;The best code I write (and I admit it isn&#039;t always great) is the stuff I scribbled down on paper on the train on the way home (its 1:30 hrs each way and the old batteries don&#039;t always last).  When I go back and read it in the morning it is just lists of subs to fill up with code.  Every sub is easy to write they are each so simple.&lt;/p&gt;
&lt;p&gt;Oh and my wife says your name sounds a bit like &quot;Bite the Watering Can&quot; in Russian Kus-Leika.&lt;br&gt;
And I am not going to mention what I thought I might find at a web site called Dicks-Blog.&lt;/p&gt;
&lt;p&gt;Luckily I took the gamble !&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Dick, true example! but at least I know, you thought through the options first.<br />
Just cause I make rules, doesn&#8217;t mean I don&#8217;t break rules.  I agree with you all.</p>
<p>The best code I write (and I admit it isn&#8217;t always great) is the stuff I scribbled down on paper on the train on the way home (its 1:30 hrs each way and the old batteries don&#8217;t always last).  When I go back and read it in the morning it is just lists of subs to fill up with code.  Every sub is easy to write they are each so simple.</p>
<p>Oh and my wife says your name sounds a bit like &#8220;Bite the Watering Can&#8221; in Russian Kus-Leika.<br />
And I am not going to mention what I thought I might find at a web site called Dicks-Blog.</p>
<p>Luckily I took the gamble !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tushar Mehta</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/03/07/code-satisfaction/#comment-22750</link>
		<dc:creator>Tushar Mehta</dc:creator>
		<pubDate>Sat, 10 Mar 2007 22:35:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1620#comment-22750</guid>
		<description>&lt;p&gt;Jan wrote, &quot;Write pseudo code on paper first and break your problem up into the smallest bits you can think of.&quot;&lt;/p&gt;
&lt;p&gt;Right idea but why use paper and pseudo code?  Also, there&#039;s no need to commit prematurely to &quot;smallest bits you can think of&quot;&lt;/p&gt;
&lt;p&gt;I start with totally functional &quot;pseudo code&quot; and flesh out the code as required.  For example start with&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;type&lt;/span&gt; UserDataType&lt;br&gt;
&#160; &#160; ...&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;end&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;type&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;sub&lt;/span&gt; CalledFromCmdBarButton()&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;dim&lt;/span&gt; UserData &lt;span class=&quot;kw1&quot;&gt;as&lt;/span&gt; UserDataType&lt;br&gt;
&#160; &#160; initialize UserData &lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; AppForm.getdata(UserData) &lt;span class=&quot;kw1&quot;&gt;then&lt;/span&gt; _&lt;br&gt;
&#160; &#160; &#160; &#160; processData UserData &lt;br&gt;
&#160; &#160; cleanup UserData &lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;end&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;sub&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;This way I can not only compile but can also execute the code at any time.  Essentially, the actual code also serves as a prototype.  In addition, by using the proper data structures and using procedures (subs/functions) that reflect the requirements of the business/scientific application I am addressing, the code is also self-documented.  Finally, since each procedure always has a clearly defined interface (I almost never use globals) I can guarantee that a change local to a procedure will require no testing of any other code.&lt;/p&gt;
&lt;p&gt;It also makes it easy to change code that ain&#039;t broke.  For example, I might implement a quick and dirty procedure (say a bubble sort).&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;sub&lt;/span&gt; SortData(&lt;span class=&quot;kw1&quot;&gt;byref&lt;/span&gt; AllData() &lt;span class=&quot;kw1&quot;&gt;as&lt;/span&gt; UserDataType)&lt;br&gt;
&#160; &#160; &lt;span class=&quot;co1&quot;&gt;&#039;...&lt;br&gt;
&lt;/span&gt; &#160; &#160;&lt;span class=&quot;kw1&quot;&gt;end&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;sub&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Then, if there is a need I will replace the code with a more sophisticated approach, say a quicksort.  Since the SortData code uses only local variables and the argument(s) passed to it, I don&#039;t have to test any other code.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Jan wrote, &#8220;Write pseudo code on paper first and break your problem up into the smallest bits you can think of.&#8221;</p>
<p>Right idea but why use paper and pseudo code?  Also, there&#8217;s no need to commit prematurely to &#8220;smallest bits you can think of&#8221;</p>
<p>I start with totally functional &#8220;pseudo code&#8221; and flesh out the code as required.  For example start with</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">type</span> UserDataType<br />
&nbsp; &nbsp; &#8230;<br />
&nbsp; &nbsp; <span class="kw1">end</span> <span class="kw1">type</span><br />
<span class="kw1">sub</span> CalledFromCmdBarButton()<br />
&nbsp; &nbsp; <span class="kw1">dim</span> UserData <span class="kw1">as</span> UserDataType<br />
&nbsp; &nbsp; initialize UserData <br />
&nbsp; &nbsp; <span class="kw1">if</span> AppForm.getdata(UserData) <span class="kw1">then</span> _<br />
&nbsp; &nbsp; &nbsp; &nbsp; processData UserData <br />
&nbsp; &nbsp; cleanup UserData <br />
&nbsp; &nbsp; <span class="kw1">end</span> <span class="kw1">sub</span></div>
</div>
<p>This way I can not only compile but can also execute the code at any time.  Essentially, the actual code also serves as a prototype.  In addition, by using the proper data structures and using procedures (subs/functions) that reflect the requirements of the business/scientific application I am addressing, the code is also self-documented.  Finally, since each procedure always has a clearly defined interface (I almost never use globals) I can guarantee that a change local to a procedure will require no testing of any other code.</p>
<p>It also makes it easy to change code that ain&#8217;t broke.  For example, I might implement a quick and dirty procedure (say a bubble sort).</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">sub</span> SortData(<span class="kw1">byref</span> AllData() <span class="kw1">as</span> UserDataType)<br />
&nbsp; &nbsp; <span class="co1">&#8216;&#8230;<br />
</span> &nbsp; &nbsp;<span class="kw1">end</span> <span class="kw1">sub</span></div>
</div>
<p>Then, if there is a need I will replace the code with a more sophisticated approach, say a quicksort.  Since the SortData code uses only local variables and the argument(s) passed to it, I don&#8217;t have to test any other code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug Glancy</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/03/07/code-satisfaction/#comment-22746</link>
		<dc:creator>Doug Glancy</dc:creator>
		<pubDate>Sat, 10 Mar 2007 18:18:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1620#comment-22746</guid>
		<description>&lt;p&gt;Jon, &quot;How about writing the pseudo code in the IDE?&quot;  For me the temptation to switch over to real code is very great, but I&#039;ve managed to restrain myself sometimes.  OTOH, writing on paper sounds like something I&#039;d never even start, so for me the IDE and some discipline is the best option.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Jon, &#8220;How about writing the pseudo code in the IDE?&#8221;  For me the temptation to switch over to real code is very great, but I&#8217;ve managed to restrain myself sometimes.  OTOH, writing on paper sounds like something I&#8217;d never even start, so for me the IDE and some discipline is the best option.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dick Kusleika</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/03/07/code-satisfaction/#comment-22745</link>
		<dc:creator>Dick Kusleika</dc:creator>
		<pubDate>Sat, 10 Mar 2007 17:13:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1620#comment-22745</guid>
		<description>&lt;p&gt;&quot;Never ever write more than a screen&#039;s worth of code&quot;&lt;/p&gt;
&lt;p&gt;I like it, but I break it all the time.  Recently I was populating a class module with data from adodb recordset.  I had about 40 lines that looked like&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container text default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;text codecolorer&quot;&gt;clsSO.TxnID = rsSO.Fields(&quot;TxnID&quot;).Value&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;I couldn&#039;t keep all 40 lines on a screen.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>&#8220;Never ever write more than a screen&#8217;s worth of code&#8221;</p>
<p>I like it, but I break it all the time.  Recently I was populating a class module with data from adodb recordset.  I had about 40 lines that looked like</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container text default">
<div style="white-space: nowrap;" class="text codecolorer">clsSO.TxnID = rsSO.Fields(&#8220;TxnID&#8221;).Value</div>
</div>
<p>I couldn&#8217;t keep all 40 lines on a screen.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gruff999</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/03/07/code-satisfaction/#comment-22742</link>
		<dc:creator>gruff999</dc:creator>
		<pubDate>Sat, 10 Mar 2007 15:18:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1620#comment-22742</guid>
		<description>&lt;p&gt;While I don&#039;t write a lot of code I have been tempted, once or twice, to revisit one of my proudest achievements. I inevitably start off planning to re-write from scratch, find that an existing method is the only one I know, decide to recycle that piece of code, then find I don&#039;t actually understand some of the other bits. The whole thing gets shelved again as &#039;too much work&#039;.&lt;/p&gt;
&lt;p&gt;The problems are these (some already mentioned). 1) The code works. 2) The finished (working) product is extremely satisfying and you tend to forget the pain and hard work it took to get there. 3) The quality of the commenting isn&#039;t sufficient. 4) Several key parts of the code were worked on the reduce them to their barest possible components, when something more wordy and self explanatory would have been better, meaning I&#039;ve created some nice but impenetrable &#039;black holes&#039;. (I don&#039;t like redundant code one bit but it&#039;s a fine line between &#039;terse&#039; and &#039;what the hell?&#039; when you read it back months later).&lt;/p&gt;
&lt;p&gt;Which is why I&#039;m grateful for this blog. I can write some O.k. code when motivated. Just about get my head round variable scope and ByRef or ByVal (though probably not employ either correctly). I don&#039;t use Functions only Subs (cos&#039; I don&#039;t know any better). There are a couple of practicle tips in this thread for more strategic/architectural code design. More please.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>While I don&#8217;t write a lot of code I have been tempted, once or twice, to revisit one of my proudest achievements. I inevitably start off planning to re-write from scratch, find that an existing method is the only one I know, decide to recycle that piece of code, then find I don&#8217;t actually understand some of the other bits. The whole thing gets shelved again as &#8216;too much work&#8217;.</p>
<p>The problems are these (some already mentioned). 1) The code works. 2) The finished (working) product is extremely satisfying and you tend to forget the pain and hard work it took to get there. 3) The quality of the commenting isn&#8217;t sufficient. 4) Several key parts of the code were worked on the reduce them to their barest possible components, when something more wordy and self explanatory would have been better, meaning I&#8217;ve created some nice but impenetrable &#8216;black holes&#8217;. (I don&#8217;t like redundant code one bit but it&#8217;s a fine line between &#8216;terse&#8217; and &#8216;what the hell?&#8217; when you read it back months later).</p>
<p>Which is why I&#8217;m grateful for this blog. I can write some O.k. code when motivated. Just about get my head round variable scope and ByRef or ByVal (though probably not employ either correctly). I don&#8217;t use Functions only Subs (cos&#8217; I don&#8217;t know any better). There are a couple of practicle tips in this thread for more strategic/architectural code design. More please.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/03/07/code-satisfaction/#comment-22740</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Sat, 10 Mar 2007 14:49:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1620#comment-22740</guid>
		<description>&lt;p&gt;Jan -&lt;/p&gt;
&lt;p&gt;These are good. How about writing the pseudo code in the IDE? This way, the pseudo code acts as the initial comments in the sub.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Jan -</p>
<p>These are good. How about writing the pseudo code in the IDE? This way, the pseudo code acts as the initial comments in the sub.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jan</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/03/07/code-satisfaction/#comment-22738</link>
		<dc:creator>Jan</dc:creator>
		<pubDate>Sat, 10 Mar 2007 11:42:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1620#comment-22738</guid>
		<description>&lt;p&gt;My best practice rules are simple...&lt;/p&gt;
&lt;p&gt;Write pseudo code on paper first and break your problem up into the smallest bits you can think of.&lt;br&gt;
Start writing in VBA by typing up a list of the names of the subs you wanted to build&lt;br&gt;
Go back and describe them at the top of each sub in some green.&lt;br&gt;
Try to keep yours subs looking like a paragraph and never write a chorus.&lt;/p&gt;
&lt;p&gt;Never ever write more than a screen&#039;s worth of code in any sub if it is bigger then chop it in to three or more.&lt;/p&gt;
&lt;p&gt;It sounds boring but you don&#039;t need much more than this to start writing nice code.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>My best practice rules are simple&#8230;</p>
<p>Write pseudo code on paper first and break your problem up into the smallest bits you can think of.<br />
Start writing in VBA by typing up a list of the names of the subs you wanted to build<br />
Go back and describe them at the top of each sub in some green.<br />
Try to keep yours subs looking like a paragraph and never write a chorus.</p>
<p>Never ever write more than a screen&#8217;s worth of code in any sub if it is bigger then chop it in to three or more.</p>
<p>It sounds boring but you don&#8217;t need much more than this to start writing nice code.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

