<?xml version="1.0" encoding="iso-8859-1"?><!-- generator="b2evolution/1.10.3" -->
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>Development Central</title>
						<link>http://www.truewill.net/myblog/index.php</link>
				<description>Development Central, Bill Sorensen's blog on software development</description>
				<language>en-US</language>
				<docs>http://backend.userland.com/rss</docs>
				<admin:generatorAgent rdf:resource="http://b2evolution.net/?v=1.10.3"/>
				<ttl>60</ttl>
								<item>
					<title>Bad Idea</title>
					<link>http://www.truewill.net/myblog/index.php/2012/04/30/bad_idea</link>
					<pubDate>Tue, 01 May 2012 02:22:23 +0000</pubDate>
					<dc:creator>truewill</dc:creator>
					<category domain="alt">C#</category>
<category domain="main">Quality</category>
<category domain="alt">.NET</category>
<category domain="alt">Windows</category>
<category domain="alt">Design</category>					<guid isPermaLink="false">201@http://www.truewill.net/myblog/</guid>
					<description>I wrote a quick-and-dirty developer utility over the last few days. It will only be used in-house, and only by developers. It&#8217;s small and simple.

&#8220;No need to use our MVC framework for WinForms,&#8221; I thought. &#8220;I&#8217;ll just write code-under-buttons.&#8221;

Wait - this method&#8217;s getting long and nested. I&#8217;d better refactor it.

Wait - how can I disable this button until these fields are filled?

Now I&#8217;m wishing that I had used our template and done it the right way. Even a simple application isn&#8217;t simple.
</description>
					<content:encoded><![CDATA[<p>I wrote a quick-and-dirty developer utility over the last few days. It will only be used in-house, and only by developers. It&#8217;s small and simple.</p>

<p>&#8220;No need to use our MVC framework for WinForms,&#8221; I thought. &#8220;I&#8217;ll just write code-under-buttons.&#8221;</p>

<p>Wait - this method&#8217;s getting long and nested. I&#8217;d better refactor it.</p>

<p>Wait - how can I disable this button until these fields are filled?</p>

<p>Now I&#8217;m wishing that I had used our template and done it the right way. Even a simple application isn&#8217;t simple.</p>
]]></content:encoded>
					<comments>http://www.truewill.net/myblog/index.php?p=201&amp;c=1&amp;tb=1&amp;pb=1#comments</comments>
				</item>
								<item>
					<title>Ceremony</title>
					<link>http://www.truewill.net/myblog/index.php/2012/04/29/ceremony_1</link>
					<pubDate>Sun, 29 Apr 2012 19:22:33 +0000</pubDate>
					<dc:creator>truewill</dc:creator>
					<category domain="alt">C#</category>
<category domain="main">Books</category>
<category domain="alt">WTF</category>
<category domain="alt">Design</category>
<category domain="alt">Functional Programming</category>					<guid isPermaLink="false">200@http://www.truewill.net/myblog/</guid>
					<description>We&#8217;re still working through Seven Languages in Seven Weeks in our lunch-and-learn book club at work. In the Cedar Rapids .Net Users Group book club, we&#8217;re almost finished with Real-World Functional Programming with examples in F# and C#.

And I&#8217;m learning that I hate ceremony.


  When writing Scala, I have to enclose blocks in curly braces. I don&#8217;t in F# or Ruby. Why?
  For the Nth time, I forget to end an Erlang function with a dot. I get an obscure compiler error.


In my day job, I write mostly C#. I&#8217;m used to that - typing curly braces, ending lines with semicolons, declaring types - it&#8217;s automatic. A good IDE helps a lot.

More and more, I wonder why the compiler doesn&#8217;t do more of this. F# is also a strongly-typed .NET language, and it can infer most types.

I&#8217;m starting to appreciate the simplicity of the F#/Ruby way of doing things.

As a side note, why are Apple and Microsoft bringing back the Bad Old Days of memory management? I have no desire to code in Objective-C or C++. I don&#8217;t want to use COM. Even the Linux folks seem to have a love affair with C/C++. Give me memory management. Give me modern languages.

And give me less ceremony.</description>
					<content:encoded><![CDATA[<p>We&#8217;re still working through <a href="http://pragprog.com/book/btlang/seven-languages-in-seven-weeks">Seven Languages in Seven Weeks</a> in our lunch-and-learn book club at work. In the <a href="http://crineta.org/">Cedar Rapids .Net Users Group</a> book club, we&#8217;re almost finished with <a href="http://www.manning.com/petricek/">Real-World Functional Programming with examples in F# and C#</a>.</p>

<p>And I&#8217;m learning that I hate ceremony.</p>

<ul>
  <li>When writing Scala, I have to enclose blocks in curly braces. I don&#8217;t in F# or Ruby. Why?</li>
  <li>For the Nth time, I forget to end an Erlang function with a dot. I get an obscure compiler error.</li>
</ul>

<p>In my day job, I write mostly C#. I&#8217;m used to that - typing curly braces, ending lines with semicolons, declaring types - it&#8217;s automatic. A good IDE helps a lot.</p>

<p>More and more, I wonder why the compiler doesn&#8217;t do more of this. F# is also a strongly-typed .NET language, and it can infer most types.</p>

<p>I&#8217;m starting to appreciate the simplicity of the F#/Ruby way of doing things.</p>

<p>As a side note, why are Apple and Microsoft bringing back the Bad Old Days of memory management? I have no desire to code in Objective-C or C++. I don&#8217;t want to use COM. Even the Linux folks seem to have a love affair with C/C++. Give me memory management. Give me modern languages.</p>

<p>And give me less ceremony.</p>]]></content:encoded>
					<comments>http://www.truewill.net/myblog/index.php?p=200&amp;c=1&amp;tb=1&amp;pb=1#comments</comments>
				</item>
								<item>
					<title>Make It Better</title>
					<link>http://www.truewill.net/myblog/index.php/2012/04/01/make_it_better</link>
					<pubDate>Sun, 01 Apr 2012 20:02:20 +0000</pubDate>
					<dc:creator>truewill</dc:creator>
					<category domain="alt">Books</category>
<category domain="alt">Design</category>
<category domain="main">Functional Programming</category>					<guid isPermaLink="false">198@http://www.truewill.net/myblog/</guid>
					<description>We&#8217;re working through Seven Languages in Seven Weeks in our lunch-and-learn book club at work. I just finished the material on Prolog.

This is a language I really want to like, but it&#8217;s frustrating.

Take for example the Fibonacci sequence. Why do I have to write

fib(N,F) :-
   succ(N1,N), succ(N2,N1), fib(N1,F1), fib(N2,F2),
   plus(F1,F2,F).


instead of

F(n) = F(n-1) + F(n-2)?

(Above code is from http://www.cubbi.com/fibonacci/prolog.html)

Both expressions are recursive. One&#8217;s obvious, one isn&#8217;t.

There are classes of problems (multiple constraints, expert systems, etc.) for which Prolog is well-suited. Some of its features have been incorporated into modern languages (particularly functional languages such as F#), but only some. We need more easy-to-use declarative models - look what LINQ did for C#.

Programming languages are still overly difficult to learn and insufficiently expressive. Many are filled with &#8220;noise&#8221; that detracts from the content. Most are mired in our imperative C-based past.

Prolog is effectively an evolutionary dead-end, and it shouldn&#8217;t be. But it, and our other languages, need to be better.

Update - April 4, 2012

I&#8217;ve since seen a cleaner way to do this in Prolog; the above example may be dated.</description>
					<content:encoded><![CDATA[<p>We&#8217;re working through <a href="http://pragprog.com/book/btlang/seven-languages-in-seven-weeks">Seven Languages in Seven Weeks</a> in our lunch-and-learn book club at work. I just finished the material on Prolog.</p>

<p>This is a language I really want to like, but it&#8217;s frustrating.</p>

<p>Take for example the Fibonacci sequence. Why do I have to write</p>

<pre><code>fib(N,F) :-
   succ(N1,N), succ(N2,N1), fib(N1,F1), fib(N2,F2),
   plus(F1,F2,F).
</code></pre>

<p>instead of</p>

<p><code>F(n) = F(n-1) + F(n-2)</code>?</p>

<p>(Above code is from <a href="http://www.cubbi.com/fibonacci/prolog.html)">http://www.cubbi.com/fibonacci/prolog.html)</a></p>

<p>Both expressions are recursive. One&#8217;s obvious, one isn&#8217;t.</p>

<p>There are classes of problems (multiple constraints, expert systems, etc.) for which Prolog is well-suited. Some of its features have been incorporated into modern languages (particularly functional languages such as F#), but only some. We need more easy-to-use declarative models - look what LINQ did for C#.</p>

<p>Programming languages are still overly difficult to learn and insufficiently expressive. Many are filled with &#8220;noise&#8221; that detracts from the content. Most are mired in our imperative C-based past.</p>

<p>Prolog is effectively an evolutionary dead-end, and it shouldn&#8217;t be. But it, and our other languages, need to be better.</p>

<p><strong>Update - April 4, 2012</strong></p>

<p>I&#8217;ve since seen a cleaner way to do this in Prolog; the above example may be dated.</p>]]></content:encoded>
					<comments>http://www.truewill.net/myblog/index.php?p=198&amp;c=1&amp;tb=1&amp;pb=1#comments</comments>
				</item>
								<item>
					<title>How can I mock X?</title>
					<link>http://www.truewill.net/myblog/index.php/2012/02/17/how_can_i_mock_x</link>
					<pubDate>Sat, 18 Feb 2012 03:14:42 +0000</pubDate>
					<dc:creator>truewill</dc:creator>
					<category domain="alt">Testing</category>
<category domain="main">IoC</category>
<category domain="alt">.NET</category>
<category domain="alt">Design</category>					<guid isPermaLink="false">197@http://www.truewill.net/myblog/</guid>
					<description>I&#8217;m on Stack Overflow often, and I follow the [moq] tag. I love Moq, and can answer a fair number of questions about it.

The questions that annoy me are ones like this:

How can I moq this query against ravendb?

Don&#8217;t.

You&#8217;ve just coupled your application to the library. Yes, IDocumentSession is an interface. But it&#8217;s RavenDB&#8217;s interface. Does the class that you&#8217;re injecting it into call all of its methods? Does it use all of the properties of the interfaces returned by these methods? I doubt it.

You&#8217;re violating the Interface Segregation Principle.

Your class is also announcing, &#8220;I know I&#8217;m talking to a NoSQL database, or something like one, and that that database&#8217;s API looks exactly like RavenDB&#8217;s.&#8221;

It&#8217;s not just RavenDB. HttpContext, repositories using IQueryable&#60;T&#62;, interfaces of expressions of generic function delegates, you name it.

Does your class need all of that functionality?

Or does it just need a simple service?

Custom interfaces are easy to write, easy to implement (with a custom wrapper class), and easy to mock. They let you be explicit in your dependencies, specifying what a given class needs and no more. With a custom interface, you can also replace the actual implementation easily; you&#8217;re no longer wedded to a given library, technology, or product.

Time spent thinking about dependencies is time saved asking questions about mocking frameworks.</description>
					<content:encoded><![CDATA[<p>I&#8217;m on <a href="http://stackoverflow.com/">Stack Overflow</a> often, and I follow the [moq] tag. I love <a href="http://code.google.com/p/moq/">Moq</a>, and can answer a fair number of questions about it.</p>

<p>The questions that annoy me are ones like this:</p>

<p><a href="http://stackoverflow.com/questions/9334753/how-can-i-moq-this-query-against-ravendb">How can I moq this query against ravendb?</a></p>

<p><strong>Don&#8217;t.</strong></p>

<p>You&#8217;ve just coupled your application to the library. Yes, IDocumentSession is an interface. But it&#8217;s <strong>RavenDB&#8217;s</strong> interface. Does the class that you&#8217;re injecting it into call all of its methods? Does it use all of the properties of the interfaces returned by these methods? I doubt it.</p>

<p>You&#8217;re violating the <a href="http://en.wikipedia.org/wiki/Interface_segregation_principle">Interface Segregation Principle</a>.</p>

<p>Your class is also announcing, &#8220;I know I&#8217;m talking to a NoSQL database, or something like one, and that that database&#8217;s API looks <strong>exactly</strong> like RavenDB&#8217;s.&#8221;</p>

<p>It&#8217;s not just RavenDB. HttpContext, repositories using IQueryable&lt;T&gt;, interfaces of expressions of generic function delegates, you name it.</p>

<p>Does your class need all of that functionality?</p>

<p>Or does it just need a simple service?</p>

<p>Custom interfaces are easy to write, easy to implement (with a custom wrapper class), and easy to mock. They let you be explicit in your dependencies, specifying what a given class needs <strong>and no more.</strong> With a custom interface, you can also replace the actual implementation easily; you&#8217;re no longer wedded to a given library, technology, or product.</p>

<p>Time spent thinking about dependencies is time saved asking questions about mocking frameworks.</p>]]></content:encoded>
					<comments>http://www.truewill.net/myblog/index.php?p=197&amp;c=1&amp;tb=1&amp;pb=1#comments</comments>
				</item>
								<item>
					<title>Interfaces and delegates</title>
					<link>http://www.truewill.net/myblog/index.php/2011/06/04/interfaces_and_delegates</link>
					<pubDate>Sun, 05 Jun 2011 02:25:15 +0000</pubDate>
					<dc:creator>truewill</dc:creator>
					<category domain="alt">C#</category>
<category domain="alt">IoC</category>
<category domain="alt">.NET</category>
<category domain="main">Design</category>					<guid isPermaLink="false">196@http://www.truewill.net/myblog/</guid>
					<description>&#8220;&#8230;an interface with one method is just a delegate&#8230;&#8221;

Sheer brilliance.

Mark Rendle said that on a Herding Code podcast. The context was that interfaces in APIs require that callers reference an assembly containing the interface definitions, and that versioning issues arise. A functional approach has the potential for avoiding those issues.

It&#8217;s a different way of looking at things. I wonder if he&#8217;s played Portal?</description>
					<content:encoded><![CDATA[<p>&#8220;&#8230;an interface with one method is just a delegate&#8230;&#8221;</p>

<p>Sheer brilliance.</p>

<p><a href="http://blog.markrendle.net/">Mark Rendle</a> said that on a <a href="http://herdingcode.com/?p=305">Herding Code podcast</a>. The context was that interfaces in APIs require that callers reference an assembly containing the interface definitions, and that versioning issues arise. A functional approach has the potential for avoiding those issues.</p>

<p>It&#8217;s a different way of looking at things. I wonder if he&#8217;s played <a href="http://en.wikipedia.org/wiki/Portal_%28video_game%29">Portal</a>?</p>]]></content:encoded>
					<comments>http://www.truewill.net/myblog/index.php?p=196&amp;c=1&amp;tb=1&amp;pb=1#comments</comments>
				</item>
					</channel>
</rss>

