<?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"
	>
<channel>
	<title>Comments for Vidar's Musings</title>
	<atom:link href="http://www.kongsli.net/nblog/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kongsli.net/nblog</link>
	<description>Deep thoughts on shallow topics</description>
	<pubDate>Thu, 20 Nov 2008 00:12:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>Comment on Pure functions and testability by vidarkongsli</title>
		<link>http://www.kongsli.net/nblog/2008/09/19/pure-functions-and-testability/#comment-1297</link>
		<dc:creator>vidarkongsli</dc:creator>
		<pubDate>Mon, 22 Sep 2008 13:37:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.kongsli.net/nblog/?p=68#comment-1297</guid>
		<description>Thanks for the comments, guys. You touch on an important point: an object has a state, and instance methods are often dependent on the state. This is a key point that separates object oriented languages from other languages. Hence, there has to be a middle way. I don't advocate only having pure functions. That would, as Andreas points out, make a lot of "utility" methods. I would, rather, argue that a method should not be dependent on anything else than its parameters and instance state. For example, not dependent on any static methods of other classes. (Static methods tend to become the equivalent of a global variable, which is not good for testing).</description>
		<content:encoded><![CDATA[<p>Thanks for the comments, guys. You touch on an important point: an object has a state, and instance methods are often dependent on the state. This is a key point that separates object oriented languages from other languages. Hence, there has to be a middle way. I don&#8217;t advocate only having pure functions. That would, as Andreas points out, make a lot of &#8220;utility&#8221; methods. I would, rather, argue that a method should not be dependent on anything else than its parameters and instance state. For example, not dependent on any static methods of other classes. (Static methods tend to become the equivalent of a global variable, which is not good for testing).</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Pure functions and testability by Ole-Martin</title>
		<link>http://www.kongsli.net/nblog/2008/09/19/pure-functions-and-testability/#comment-1294</link>
		<dc:creator>Ole-Martin</dc:creator>
		<pubDate>Mon, 22 Sep 2008 11:04:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.kongsli.net/nblog/?p=68#comment-1294</guid>
		<description>Qi4J is trying to solve part of that problem in Java. Each method call goes through constraints and concerns before the actual implementation is executed. If the execution is successful, different side effects may occur. All these aspects are implemented as separate methods and may be unit tested independently. Check it out here: http://stephan.reposita.org/archives/2008/01/09/qi4j-the-next-java-forget-scala/</description>
		<content:encoded><![CDATA[<p>Qi4J is trying to solve part of that problem in Java. Each method call goes through constraints and concerns before the actual implementation is executed. If the execution is successful, different side effects may occur. All these aspects are implemented as separate methods and may be unit tested independently. Check it out here: <a href="http://stephan.reposita.org/archives/2008/01/09/qi4j-the-next-java-forget-scala/" rel="nofollow">http://stephan.reposita.org/archives/2008/01/09/qi4j-the-next-java-forget-scala/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Pure functions and testability by Andreas Knudsen</title>
		<link>http://www.kongsli.net/nblog/2008/09/19/pure-functions-and-testability/#comment-1293</link>
		<dc:creator>Andreas Knudsen</dc:creator>
		<pubDate>Mon, 22 Sep 2008 10:16:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.kongsli.net/nblog/?p=68#comment-1293</guid>
		<description>@Loc: I'd say yes to that, I have great experience with "pure functions", and I use them all the time.
The one drawback I see is that your code after a while starts to read like a "Utilities" project, where it starts to get a bit unclear who "owns" a piece of code. In Vidars Example he might as well called the function 
UserIsCurrentUser(string u, string c)
(which might be argued is more "correct" than ShowOrHideEditButton as it doesn't actually show or hide anything.)
but that method would probably be applicable in many places in your code base, so if you want to keep DRY where does it live? how do you find it again the next time you need to check current username (how do you spot it in the myriad of other "util" methods)?
IMHO the way to do this is through team communication, making sure that the entire team agrees what makes sense, so that you know that you would have to look for the UserIsCurrentUser in ProfileUtil for instance, even if you yourself did not write that code. 
Another alternative is to tightly bind the show/hide functionality to an object that is fed all needed info, does some processing on it and is used by the view to generate the UI.</description>
		<content:encoded><![CDATA[<p>@Loc: I&#8217;d say yes to that, I have great experience with &#8220;pure functions&#8221;, and I use them all the time.<br />
The one drawback I see is that your code after a while starts to read like a &#8220;Utilities&#8221; project, where it starts to get a bit unclear who &#8220;owns&#8221; a piece of code. In Vidars Example he might as well called the function<br />
UserIsCurrentUser(string u, string c)<br />
(which might be argued is more &#8220;correct&#8221; than ShowOrHideEditButton as it doesn&#8217;t actually show or hide anything.)<br />
but that method would probably be applicable in many places in your code base, so if you want to keep DRY where does it live? how do you find it again the next time you need to check current username (how do you spot it in the myriad of other &#8220;util&#8221; methods)?<br />
IMHO the way to do this is through team communication, making sure that the entire team agrees what makes sense, so that you know that you would have to look for the UserIsCurrentUser in ProfileUtil for instance, even if you yourself did not write that code.<br />
Another alternative is to tightly bind the show/hide functionality to an object that is fed all needed info, does some processing on it and is used by the view to generate the UI.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Pure functions and testability by Loc Tan Vo</title>
		<link>http://www.kongsli.net/nblog/2008/09/19/pure-functions-and-testability/#comment-1290</link>
		<dc:creator>Loc Tan Vo</dc:creator>
		<pubDate>Mon, 22 Sep 2008 07:51:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.kongsli.net/nblog/?p=68#comment-1290</guid>
		<description>Very helpful post! I agree that the ASP.NET programming model with ASPX code behind files promotes writing methods that are problematic to create unit tests for. We have experienced problems with testability regarding code behind files on our project. As you mention, pure functions would be a dream for unit testing. I also agree that functions with a return value are the most preferrable. To test void methods (that don't change the state of the object), we often have to introduce mock frameworks. In my personal opinion, overuse of mock frameworks (with many expectations) will lead to worse readability of the tests (which often are the best documentation for the code). 

Another thing I'm wondering about: pure functions are nice to test, but since they are independent of the state of the object, they tend to accept many arguments. If the amount of arguments exceed a certain number (maybe 2-3), the function can occure a bit unstructured somehow and difficult to know how to use it. What do you do in these cases? Encapsulate the arguments in an object and send the object into the method instead?</description>
		<content:encoded><![CDATA[<p>Very helpful post! I agree that the ASP.NET programming model with ASPX code behind files promotes writing methods that are problematic to create unit tests for. We have experienced problems with testability regarding code behind files on our project. As you mention, pure functions would be a dream for unit testing. I also agree that functions with a return value are the most preferrable. To test void methods (that don&#8217;t change the state of the object), we often have to introduce mock frameworks. In my personal opinion, overuse of mock frameworks (with many expectations) will lead to worse readability of the tests (which often are the best documentation for the code). </p>
<p>Another thing I&#8217;m wondering about: pure functions are nice to test, but since they are independent of the state of the object, they tend to accept many arguments. If the amount of arguments exceed a certain number (maybe 2-3), the function can occure a bit unstructured somehow and difficult to know how to use it. What do you do in these cases? Encapsulate the arguments in an object and send the object into the method instead?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Internet Explorer automation/Watin: catching navigation error codes by ftorres</title>
		<link>http://www.kongsli.net/nblog/2008/07/08/internet-explorer-automationwatin-catching-navigation-error-codes/#comment-290</link>
		<dc:creator>ftorres</dc:creator>
		<pubDate>Wed, 09 Jul 2008 01:01:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.kongsli.net/nblog/?p=64#comment-290</guid>
		<description>Would you give a look at http://www.InCisif.net.
A web testing tool using C# or VB.NET integrated with Visual Studio.

Thanks</description>
		<content:encoded><![CDATA[<p>Would you give a look at <a href="http://www.InCisif.net" rel="nofollow">http://www.InCisif.net</a>.<br />
A web testing tool using C# or VB.NET integrated with Visual Studio.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Breaking encapsulation with collections by vidarkongsli</title>
		<link>http://www.kongsli.net/nblog/2008/07/01/breaking-encapsulation-with-collections/#comment-231</link>
		<dc:creator>vidarkongsli</dc:creator>
		<pubDate>Tue, 01 Jul 2008 10:45:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.kongsli.net/nblog/?p=61#comment-231</guid>
		<description>True. Using ReadOnlyCollection is an alternative solution.</description>
		<content:encoded><![CDATA[<p>True. Using ReadOnlyCollection is an alternative solution.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Breaking encapsulation with collections by Erlend</title>
		<link>http://www.kongsli.net/nblog/2008/07/01/breaking-encapsulation-with-collections/#comment-230</link>
		<dc:creator>Erlend</dc:creator>
		<pubDate>Tue, 01 Jul 2008 10:42:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.kongsli.net/nblog/?p=61#comment-230</guid>
		<description>As I understand the "readonly" keyword only refers to the variable. If you need a collection of objects that cannot be changed, maybe ReadOnlyCollection is a better choice.</description>
		<content:encoded><![CDATA[<p>As I understand the &#8220;readonly&#8221; keyword only refers to the variable. If you need a collection of objects that cannot be changed, maybe ReadOnlyCollection is a better choice.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Setting up a DSAPI project in Visual Studio 2005 by vidarkongsli</title>
		<link>http://www.kongsli.net/nblog/2008/03/06/setting-up-a-dsapi-project-in-visual-studio-2005/#comment-218</link>
		<dc:creator>vidarkongsli</dc:creator>
		<pubDate>Sun, 29 Jun 2008 17:46:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.kongsli.net/nblog/?p=52#comment-218</guid>
		<description>No, unfortunately, I haven't tried it with a C DSAPI filter.</description>
		<content:encoded><![CDATA[<p>No, unfortunately, I haven&#8217;t tried it with a C DSAPI filter.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Setting up a DSAPI project in Visual Studio 2005 by scprotz</title>
		<link>http://www.kongsli.net/nblog/2008/03/06/setting-up-a-dsapi-project-in-visual-studio-2005/#comment-161</link>
		<dc:creator>scprotz</dc:creator>
		<pubDate>Fri, 27 Jun 2008 19:59:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.kongsli.net/nblog/?p=52#comment-161</guid>
		<description>This appears to be for a C++ DSAPI filter.  Have you tried this with a C DSAPI filter (such as the threestrikes demo on the Lotus Sandbox at http://www-10.lotus.com/ldd/sandbox.nsf/ecc552f1ab6e46e4852568a90055c4cd/ca47a6f8d659f546852567ad0070de25?OpenDocument&#38;Highlight=0,dsapi  ?)</description>
		<content:encoded><![CDATA[<p>This appears to be for a C++ DSAPI filter.  Have you tried this with a C DSAPI filter (such as the threestrikes demo on the Lotus Sandbox at <a href="http://www-10.lotus.com/ldd/sandbox.nsf/ecc552f1ab6e46e4852568a90055c4cd/ca47a6f8d659f546852567ad0070de25?OpenDocument&amp;Highlight=0,dsapi" rel="nofollow">http://www-10.lotus.com/ldd/sandbox.nsf/ecc552f1ab6e46e4852568a90055c4cd/ca47a6f8d659f546852567ad0070de25?OpenDocument&amp;Highlight=0,dsapi</a>  ?)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
