<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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>Lazycoder &#187; Languages</title>
	<atom:link href="http://www.lazycoder.com/weblog/category/languages/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lazycoder.com/weblog</link>
	<description></description>
	<pubDate>Thu, 18 Dec 2008 10:06:26 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Object oriented programming vs. class oriented programming</title>
		<link>http://www.lazycoder.com/weblog/2008/12/17/object-oriented-programming-vs-class-oriented-programming/</link>
		<comments>http://www.lazycoder.com/weblog/2008/12/17/object-oriented-programming-vs-class-oriented-programming/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 16:21:28 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[General]]></category>

		<category><![CDATA[Languages]]></category>

		<guid isPermaLink="false">http://www.lazycoder.com/weblog/?p=1054</guid>
		<description><![CDATA[In the last post, the code was pretty clean. Our resident Rhino.Mocks guru at work, Sean, left a comment saying that the new code was much better than the Do-Func stuff I had before. Sean was the one that pointed me to the Repeat.Times methods in Rhino.Mocks. I thought I'd post the old code that [...]]]></description>
			<content:encoded><![CDATA[<p>In the last post, the code was pretty clean. Our resident Rhino.Mocks guru at work, <a href="http://www.sneal.net/blog/default.aspx">Sean</a>, <a href="http://www.lazycoder.com/weblog/2008/12/12/mocking-idatareader-using-rhinomocks-35/#comment-187020">left a comment</a> saying that the new code was much better than the Do-Func stuff I had before. Sean was the one that pointed me to the Repeat.Times methods in Rhino.Mocks. I thought I'd post the old code that I had cobbled together from a StackOverflow answer.</p>
<div class="igBar"><span id="lcode-5"><a href="#" onclick="javascript:showCodeTxt('code-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-5">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">IDataReader reader = MockRepository.<span style="">GenerateStub</span>&lt;IDataReader&gt;<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; reader.<span style="">Stub</span><span style="color:#006600; font-weight:bold;">&#40;</span>x =&gt; x.<span style="">Read</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">Do</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span>Func&lt;bool&gt;<span style="color:#006600; font-weight:bold;">&#41;</span> delegate<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;m_NumberOfTimesIDataReaderHasBeenCalled++;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#40;</span>m_NumberOfTimesIDataReaderHasBeenCalled%<span style="color:#800000;color:#800000;">2</span> != <span style="color:#800000;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; reader.<span style="">Stub</span><span style="color:#006600; font-weight:bold;">&#40;</span>x =&gt; x<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">"ID"</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">Return</span><span style="color:#006600; font-weight:bold;">&#40;</span>Guid.<span style="">Empty</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; reader.<span style="">Stub</span><span style="color:#006600; font-weight:bold;">&#40;</span>x =&gt; x<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">"FullName"</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">Return</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"Test User"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; List&lt;UserDTO&gt; list = SearchProvider.<span style="">ParseUserData</span><span style="color:#006600; font-weight:bold;">&#40;</span>reader<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Assert.<span style="">IsNotNull</span><span style="color:#006600; font-weight:bold;">&#40;</span>list<span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
 The re-factored code using the Repeat.Times methods.</p>
<div class="igBar"><span id="lcode-6"><a href="#" onclick="javascript:showCodeTxt('code-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-6">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">IDataReader reader = MockRepository.<span style="">GenerateStub</span>&lt;IDataReader&gt;<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; reader.<span style="">Stub</span><span style="color:#006600; font-weight:bold;">&#40;</span>x =&gt; x.<span style="">Read</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">Return</span><span style="color:#006600; font-weight:bold;">&#40;</span>true<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">Repeat</span>.<span style="">Times</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; reader.<span style="">Stub</span><span style="color:#006600; font-weight:bold;">&#40;</span>x =&gt; x.<span style="">Read</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">Return</span><span style="color:#006600; font-weight:bold;">&#40;</span>false<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; reader.<span style="">Stub</span><span style="color:#006600; font-weight:bold;">&#40;</span>x =&gt; x<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">"ID"</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">Return</span><span style="color:#006600; font-weight:bold;">&#40;</span>Guid.<span style="">Empty</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; reader.<span style="">Stub</span><span style="color:#006600; font-weight:bold;">&#40;</span>x =&gt; x<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">"FullName"</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">Return</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"Test User"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; List&lt;UserDTO&gt; list = SearchProvider.<span style="">ParseUserData</span><span style="color:#006600; font-weight:bold;">&#40;</span>reader<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Assert.<span style="">IsNotNull</span><span style="color:#006600; font-weight:bold;">&#40;</span>list<span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>You can see how the second code sample is much cleaner than the first. A lot of the messiness of the first code sample comes from talking to the compiler instead of talking to objects. What do I mean by that? Well, in the first example we have to tell the compiler what the delegate should return </p>
<div class="igBar"><span id="lcode-7"><a href="#" onclick="javascript:showCodeTxt('code-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-7">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Func&lt;bool&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>You'll also notice some ugliness inside of the delegate body.</p>
<div class="igBar"><span id="lcode-8"><a href="#" onclick="javascript:showCodeTxt('code-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-8">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">m_NumberOfTimesIDataReaderHasBeenCalled++;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">return <span style="color:#006600; font-weight:bold;">&#40;</span>m_NumberOfTimesIDataReaderHasBeenCalled%<span style="color:#800000;color:#800000;">2</span> != <span style="color:#800000;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Here, I was incrementing a class member and checking to see if it was odd or even. If it was even, I'd return true, otherwise I'd return false. This allowed me to control the number of times the IDataReader.Read() method would return true. In this case, it would return true once, then the variable would be incremented to an odd number and the Read method would return false.</p>
<p>That's all part of me telling the compiler what to expect, when what I really want to do is just tell my objects what to do. <a href="http://altnetpodcast.com/episodes/10-oop-in-ruby">This episode of the Alt.net podcast</a> also talks a little bit about class-based programming versus object-oriented programming. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.lazycoder.com/weblog/2008/12/17/object-oriented-programming-vs-class-oriented-programming/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New ASP.NET MVC sample - Oxite - Needs some TLC</title>
		<link>http://www.lazycoder.com/weblog/2008/12/15/new-aspnet-mvc-sample-oxite-needs-some-tlc/</link>
		<comments>http://www.lazycoder.com/weblog/2008/12/15/new-aspnet-mvc-sample-oxite-needs-some-tlc/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 16:21:16 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[General]]></category>

		<category><![CDATA[Languages]]></category>

		<category><![CDATA[ASPNETMVC MVC WebDevelopment]]></category>

		<guid isPermaLink="false">http://www.lazycoder.com/weblog/?p=1052</guid>
		<description><![CDATA[Last week the MIX online team announced that they are releasing the ASP.NET MVC code that powers their MIX Online blog as open source at CodePlex. This is a great thing.
The code base, while touted as a "a real-world sample written using ASP.NET MVC.", is not without some problems. The commentary on Twitter soon after [...]]]></description>
			<content:encoded><![CDATA[<p>Last week the <a href="http://visitmix.com/Lab/Oxite">MIX online team announced that they are releasing the ASP.NET MVC code that powers their MIX Online blog as open source</a> at <a href="http://www.codeplex.com/oxite">CodePlex</a>. This is a great thing.</p>
<p>The code base, while touted as a "<a href="http://www.codeplex.com/oxite">a real-world sample written using ASP.NET MVC.</a>", is not without some problems. The commentary on Twitter soon after it's release was pretty negative.</p>
<p><a href="http://twitter.com/nkohari/statuses/1058691957"></p>
<blockquote><p>This is why Oxite is not good. <a href="http://pastie.org/339644">http://pastie.org/339644</a></p></blockquote>
<p></a></p>
<p><a href="http://twitter.com/subdigital/statuses/1058656762"></p>
<blockquote><p>browsing the Oxite source... wondering how many people will try to learn from this mess</p></blockquote>
<p></a></p>
<p><a href="http://twitter.com/bellware/statuses/1057254638"></p>
<blockquote><p>@robconery because microsoft doesn't deal with foibles with courage, i expect oxite will be allowed to degrade yet more customer potential</p></blockquote>
<p></a></p>
<p><a href="http://twitter.com/fredrik_k/statuses/1057055280"></p>
<blockquote><p>Oxite source is being slaughtered by the alt.net crowd; sad thing is, since its by MS others will use it as guidance on how to do MVC</p></blockquote>
<p></a></p>
<p><a href="http://twitter.com/DerikWhittaker/statuses/1055751880"></p>
<blockquote><p>@cwoodruff please, please, please do not use Oxite as a guide when doing MVC... PLEASE DO NOT</p></blockquote>
<p></a></p>
<p><a href="http://twitter.com/simonech/status/1058754441"></p>
<blockquote><p>@lazycoder if u read the code, it's actually a collection of anti-patterns of MVC... I hope people are not going to learn from it</p></blockquote>
<p></a></p>
<p><a href="http://blog.wekeroad.com">Rob Conery</a> has a great post where he outlines some of the <a href="http://blog.wekeroad.com/blog/some-thoughts-on-oxite/">issues with the Oxite code base </a>and how they can be fixed. He has already offered some patches to the team.</p>
<p>That's what I mean when I say this is a great thing. Since the team is doing all their work out in the open, we get to see how it evolves. I fear that a lot of the ASP.NET MVC code that we see written the first few years after it is released will look very similar to the Oxite code. Hopefully, the refactoring of the code base into something that embraces the strengths of MVC will be done in public as well so that first time MVC developers who find themselves writing the same code that the Oxite team has will have a lot of resources available.</p>
<p>I'd encourage everyone interested in the ASP.NET MVC product to watch the evolution of Oxite closely and contribute to the development.(1)</p>
<p><em>(1) That doesn't include me for quite some time as we're getting ready to have a baby soon. You don't want to see code I've written on only 4 hours sleep over two days.</em> <img src='http://www.lazycoder.com/weblog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.lazycoder.com/weblog/2008/12/15/new-aspnet-mvc-sample-oxite-needs-some-tlc/feed/</wfw:commentRss>
		</item>
		<item>
		<title>I&#8217;m in the Alt.net podcast on jQuery</title>
		<link>http://www.lazycoder.com/weblog/2008/10/08/im-in-the-altnet-podcast-on-jquery/</link>
		<comments>http://www.lazycoder.com/weblog/2008/10/08/im-in-the-altnet-podcast-on-jquery/#comments</comments>
		<pubDate>Wed, 08 Oct 2008 21:50:21 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[Languages]]></category>

		<category><![CDATA[Technology]]></category>

		<category><![CDATA[microsoft jquery podcast javascript]]></category>

		<guid isPermaLink="false">http://www.lazycoder.com/weblog/?p=1011</guid>
		<description><![CDATA[jQuery in ASP.NET
Mike Moore was kind enough to invite me on the alt.net podcast to talk about the recent jQuery announcement by Microsoft. Chris Brandsma, Rick Strahl, Dave Ward, Bertrand Le Roy, and Steven Harman were also on the podcast.
This was a great discussion. It was especially nice to have Bertrand during the discussion. If [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://altnetpodcast.com/episodes/11-jquery-in-asp.net">jQuery in ASP.NET</a></p>
<p><a href="http://blowmage.com/">Mike Moore</a> was kind enough to invite me on the <a href="http://altnetpodcast.com/">alt.net podcast</a> to talk about the recent jQuery announcement by Microsoft. <a href="http://www.chrisbrandsma.com/">Chris Brandsma</a>, <a href="http://www.west-wind.com/weblog/">Rick Strahl</a>, <a href="http://encosia.com/">Dave Ward</a>, <a href="http://weblogs.asp.net/Bleroy/">Bertrand Le Roy</a>, and <a href="http://stevenharman.net/">Steven Harman</a> were also on the podcast.</p>
<p>This was a great discussion. It was especially nice to have Bertrand during the discussion. If we had any questions about how or why Microsoft did something, we could ask him. I was happy to hear that one of the reasons they chose jQuery was because they didn't want to write their own <acronym title='Cascading Style Sheets'><span class='caps'>CSS</span></acronym> selector functions for MS <acronym title='Asynchronous Javascript and XML'><span class='caps'>AJAX</span></acronym>. It's nice to see that Microsoft sees the benefit in not always reinventing the wheel. Now, any new features or improvements that Microsoft would have made to their own selector engine can be contributed towards jQuery, making it a better product for all of us.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lazycoder.com/weblog/2008/10/08/im-in-the-altnet-podcast-on-jquery/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Herding Code #18 - F# with Matt Podwysocki</title>
		<link>http://www.lazycoder.com/weblog/2008/09/23/herding-code-18-f-with-matt-podwysocki/</link>
		<comments>http://www.lazycoder.com/weblog/2008/09/23/herding-code-18-f-with-matt-podwysocki/#comments</comments>
		<pubDate>Tue, 23 Sep 2008 16:01:09 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[General]]></category>

		<category><![CDATA[Languages]]></category>

		<category><![CDATA[fSharp]]></category>

		<category><![CDATA[functionalprogramming]]></category>

		<category><![CDATA[herdingcode]]></category>

		<category><![CDATA[mattpodwysockirules]]></category>

		<category><![CDATA[podcast]]></category>

		<guid isPermaLink="false">http://www.lazycoder.com/weblog/?p=995</guid>
		<description><![CDATA[We posted episode 18 last week. It's a great overview of F# and functional programming with Matt Podwysocki. Matt has a great love for F#. We wanted to do a show about F# that was a little more than just talking about F# itself and cover more about what functional programming is and why it's [...]]]></description>
			<content:encoded><![CDATA[<p>We posted episode 18 last week. It's a great <a href="http://herdingcode.com/?p=45">overview of F# and functional programming </a>with <a href="http://codebetter.com/blogs/matthew.podwysocki/default.aspx">Matt Podwysocki</a>. Matt has a great love for F#. We wanted to do a show about F# that was a little more than just talking about F# itself and cover more about what functional programming is and why it's important. </p>
<p>Some topics we cover in the podcast:</p>
<ul>
<li>What is functional programming, and why should we care?</li>
<li>Types of applications that would and wouldn’t benefit from F#</li>
<li>How F# differs from C# 3.x and Javascript</li>
<li>How F# is being used (games, scripting, data analysis and scrubbing, etc.)</li>
<li> F# pattern matching</li>
<li>Using F# in your C# or VB based applications today</li>
<li>Getting started: F# Interactive, reading the F# source, books and resources</li>
<li>Interaction with DLR</li>
<li>Functional features we’d like to see in C# and VB</li>
<li> Spec# and Sing#</li>
</ul>
<p>The post containing the podcast is turning into a great resource if you are interested in Functional Programming and F#. Matt provided us with a lot of links and we've been adding new links as we find them. If you know of any Functional Programming or F# links, feel free to leave them in the comments here or at the Herding Code post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lazycoder.com/weblog/2008/09/23/herding-code-18-f-with-matt-podwysocki/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Why can&#8217;t you declare a static method in an interface?</title>
		<link>http://www.lazycoder.com/weblog/2008/05/20/why-cant-you-declare-a-static-method-in-an-interface/</link>
		<comments>http://www.lazycoder.com/weblog/2008/05/20/why-cant-you-declare-a-static-method-in-an-interface/#comments</comments>
		<pubDate>Tue, 20 May 2008 18:00:04 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[General]]></category>

		<category><![CDATA[Languages]]></category>

		<category><![CDATA[C#]]></category>

		<category><![CDATA[compiler]]></category>

		<category><![CDATA[designtime]]></category>

		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.lazycoder.com/weblog/?p=947</guid>
		<description><![CDATA[I've stated on Twitter a couple of times that I'd like to be able to declare static methods as part of my interface. My reasoning is: If an interface defines a contract in my code, why can't a static method be part of that contract?
PLAIN TEXT
CODE:




public interface ITryStatic &#123;


&#160; &#160; static void Foo&#40;&#41;;


&#160; &#160; void [...]]]></description>
			<content:encoded><![CDATA[<p>I've stated on Twitter a couple of times that I'd like to be able to declare static methods as part of my interface. My reasoning is: If an interface defines a contract in my code, why can't a static method be part of that contract?</p>
<div class="igBar"><span id="lcode-11"><a href="#" onclick="javascript:showCodeTxt('code-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-11">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">public interface ITryStatic <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; static void Foo<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; void Bar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>I found a <a href="http://www.jguru.com/faq/view.jsp?EID=88225">great answer over in this forum</a>.</p>
<p>In both Java and .NET, classes can only inherit from one class but a class can implement multiple interfaces. So consider the following code.</p>
<div class="igBar"><span id="lcode-12"><a href="#" onclick="javascript:showCodeTxt('code-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-12">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">public interface ITryStatic <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; static void Foo<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">public interface ITryAnotherStatic <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; static void Foo<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">public class Whoops : ITryStatic, ITryAnotherStatic <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; public static void Foo<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> printline<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"Foo"</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ITryStatic staticWhoops;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">staticWhoops.<span style="">Foo</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">//which one does it try? It doesn't matter since there's no code to run.</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span>Whoops<span style="color:#006600; font-weight:bold;">&#41;</span>staticWhoops<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">Foo</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">//Sure, but it defeats the purpose of using an interface. </span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Essentially the answer is: The compiler tries to run the code specified by the static method in a class. Since an interface doesn't provide an implementation details, there is nothing to run. You could, if the compiler would let you, cast the interface to the concrete type that's actually being represented. But that defeats the purpose of declaring an using an interface.</p>
<p>I do wonder if <a href="http://en.wikipedia.org/wiki/Type_inference">type inference</a> could be used to route around this problem?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lazycoder.com/weblog/2008/05/20/why-cant-you-declare-a-static-method-in-an-interface/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New Languages Considered Helpful</title>
		<link>http://www.lazycoder.com/weblog/2008/04/07/new-languages-considered-helpful/</link>
		<comments>http://www.lazycoder.com/weblog/2008/04/07/new-languages-considered-helpful/#comments</comments>
		<pubDate>Mon, 07 Apr 2008 16:07:20 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[Languages]]></category>

		<guid isPermaLink="false">http://www.lazycoder.com/weblog/index.php/archives/2008/04/07/new-languages-considered-helpful/</guid>
		<description><![CDATA[&#160;
New Languages Considered Harmful 
I can't disagree more with this post.(1) There's no research or study that shows that learning impedes further learning. Once you learn how to program, moving between languages becomes easier. Every language has some kind of flow control syntax, some way to declare a variable, and some way to encapsulate code. [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p><a href="http://duartes.org/gustavo/blog/post/2008/04/02/New-Languages-Considered-Harmful.aspx">New Languages Considered Harmful</a> </p>
<p>I can't disagree more with this post.(<em>1</em>) There's no research or study that shows that learning impedes further learning. Once you learn how to program, moving between languages becomes easier. Every language has some kind of flow control syntax, some way to declare a variable, and some way to encapsulate code. You do have to <a href="http://twitter.com/mattpodwysocki/statuses/782611976" target="_blank">think a little differently if you switch between <acronym title='Object Oriented Programming'><span class='caps'>OOP</span></acronym>, functional, and procedural languages</a>. But even <a href="http://www.gnu.org/software/mit-scheme/documentation/mit-scheme-ref/Conditionals.html" target="_blank">Scheme has an if-else statement</a>. It doesn't take much effort to learn a new language, but it does take a lot of <a href="http://norvig.com/21-days.html" target="_blank">effort to master a programming language</a>.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><em>1. I think I could disagree more with this post if I really tried, but I know I disagree enough to make a post.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lazycoder.com/weblog/2008/04/07/new-languages-considered-helpful/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Modern JavaScript Development: null and undefined</title>
		<link>http://www.lazycoder.com/weblog/2008/03/03/modern-javascript-development-2/</link>
		<comments>http://www.lazycoder.com/weblog/2008/03/03/modern-javascript-development-2/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 14:08:21 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[Languages]]></category>

		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.lazycoder.com/weblog/index.php/archives/2008/03/03/modern-javascript-development-2/</guid>
		<description><![CDATA[In my last post on constructors and objects in JavaScript, I mentioned that the logical OR operator &#124;&#124; was short-circuited and allowed us to set default values for arguments passed into the constructor. So we know that the argument evaluates to false if we don't pass it in to the constructor, but what value does [...]]]></description>
			<content:encoded><![CDATA[<p>In my last post on constructors and objects in JavaScript, I mentioned that the <a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Operators:Logical_Operators#Short-Circuit_Evaluation">logical OR operator || was short-circuited</a> and allowed us to set default values for arguments passed into the constructor. So we know that the argument evaluates to false if we don't pass it in to the constructor, but what value does the argument have that makes it evaluate to false?</p>
<p>There are three different values, or types, that a variable can have in JavaScript, null, undefined, and the value you set.</p>
<div class="igBar"><span id="lcode-17"><a href="#" onclick="javascript:showCodeTxt('code-17'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-17">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">var isNull = null; <span style="color:#FF9933; font-style:italic;">//null type</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">var isUndefined; <span style="color:#FF9933; font-style:italic;">//undefined</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">var isNumber = <span style="color:#800000;color:#800000;">1</span>; <span style="color:#FF9933; font-style:italic;">//neither null nor undefined, contains a value </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>A variable is null if you explicitly set it to the null value or if it receives a value from an expression that results in null; A variable is undefined if you declare it and haven't assigned a value to it yet. The tricky part about null and undefined is that they are equal, but are two separate types. Consider the following code.</p>
<div class="igBar"><span id="lcode-18"><a href="#" onclick="javascript:showCodeTxt('code-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-18">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">var isNull = null;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">var isUndefined;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">alert<span style="color:#006600; font-weight:bold;">&#40;</span>isNull == isUndefined<span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>So how do we differentiate between null and undefined variables? By using either the typeof function or the identity(===) operator. The identity operator has an evil twin (!==) that returns true if the object is not of the type you passed.  The typeof function is defined in the JavaScript global object and returns a string containing the name of the type of object passed to it. The identity operator is a binary operator that compares the types of the two objects being compared and returns a boolean.</p>
<div class="igBar"><span id="lcode-19"><a href="#" onclick="javascript:showCodeTxt('code-19'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-19">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">var isNull = null;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">var isUndefined;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">alert<span style="color:#006600; font-weight:bold;">&#40;</span>isNull == isUndefined<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">alert<span style="color:#006600; font-weight:bold;">&#40;</span>isNull === isUndefined<span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
n.b. If you pass "null" as an argument to a function, typeof will return "Object", but the object will === null.</p>
<div class="igBar"><span id="lcode-20"><a href="#" onclick="javascript:showCodeTxt('code-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-20">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">function defaultArgs<span style="color:#006600; font-weight:bold;">&#40;</span>name, options<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; alert<span style="color:#006600; font-weight:bold;">&#40;</span>typeof<span style="color:#006600; font-weight:bold;">&#40;</span>name<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert<span style="color:#006600; font-weight:bold;">&#40;</span>name === null<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert<span style="color:#006600; font-weight:bold;">&#40;</span>name === undefined<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; this.<span style="">name</span> = name || <span style="color:#CC0000;">"unknown"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; this.<span style="">options</span> = options || <span style="color:#006600; font-weight:bold;">&#123;</span> size: <span style="color:#800000;color:#800000;">42</span> <span style="color:#006600; font-weight:bold;">&#125;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#125;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;var instanceOne = new defaultArgs<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"Scott"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;var instanceTwo = new defaultArgs<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var instanceThree = new defaultArgs<span style="color:#006600; font-weight:bold;">&#40;</span>null, <span style="color:#006600; font-weight:bold;">&#123;</span>size : <span style="color:#800000;color:#800000;">43</span> <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>So, how does this affect the logical OR operator? Well, both null and undefined are evaluated to "false" by the || operator, but the argument is still declared in the scope of the function and you can assign a default value to it. It's important to know the distinction between null and undefined. A function call may result in a null return value, a failed function call may result in an undefined value.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lazycoder.com/weblog/2008/03/03/modern-javascript-development-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>VB wasn&#8217;t so bad, well kinda</title>
		<link>http://www.lazycoder.com/weblog/2008/01/30/vb-wasnt-so-bad-well-kinda/</link>
		<comments>http://www.lazycoder.com/weblog/2008/01/30/vb-wasnt-so-bad-well-kinda/#comments</comments>
		<pubDate>Wed, 30 Jan 2008 17:31:32 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
		
		<category><![CDATA[Languages]]></category>

		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.lazycoder.com/weblog/index.php/archives/2008/01/30/vb-wasnt-so-bad-well-kinda/</guid>
		<description><![CDATA[From Ted Newards blog, comments from the Lang.NET language symposium.

    Editor's Note: I don't know what Visual Basic did to anger the Gods of Computer Science, but think about it for a second: they were a dynamic language that ran on a bytecode-based platform, used dynamic typing and late name-based binding by [...]]]></description>
			<content:encoded><![CDATA[<p>From Ted Newards blog, <a href="http://blogs.tedneward.com/2008/01/30/Highlights+Of+The+LangNET+Symposium+Day+Two.aspx">comments from the Lang.NET language symposium</a>.</p>
<blockquote><p>
    Editor's Note: I don't know what Visual Basic did to anger the Gods of Computer Science, but think about it for a second: they were a dynamic language that ran on a bytecode-based platform, used dynamic typing and late name-based binding by default, provided a "scripting glue" to existing applications (Office being the big one), focused primarily on productivity, and followed a component model from almost the first release. Then, after languishing for years as the skinny guy on the beach as the C++ developers kicked sand on their blanket, they get the static-typing and early-binding religion, just in time to be the skinny guy on the beach as the Ruby developers kick sand on their blanket.</p>
<p>    Oh, and to add insult to injury, the original code name for Visual Basic before it got a marketing name? Ruby.</p>
<p>    Whatever you did, VB, your punishment couldn't have fit the crime. Hopefully your highly-publicized personal hell is almost over.
</p></blockquote>
<p>While I agree about the dynamic typing and so forth. The reason VB got kicked around was:</p>
<ol>
<li>The CS majors thought that it promoted bad code written by bad developers. In reality, it promoted bad code written by inexperienced developers which still managed to meet whatever dorky requirements they had for the tiny application they were writing. Which is OK in my book. You weren't writing eBay in VB, you were writing Sally's strudel recipe database.</li>
<li> A complete and utter lack of pain-free inheritance. Sure you had editor inheritance, but that's no way to run a language.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.lazycoder.com/weblog/2008/01/30/vb-wasnt-so-bad-well-kinda/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Productivity vs. quality</title>
		<link>http://www.lazycoder.com/weblog/2008/01/22/productivity-vs-quality/</link>
		<comments>http://www.lazycoder.com/weblog/2008/01/22/productivity-vs-quality/#comments</comments>
		<pubDate>Wed, 23 Jan 2008 06:32:26 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
		
		<category><![CDATA[Languages]]></category>

		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.lazycoder.com/weblog/index.php/archives/2008/01/22/productivity-vs-quality/</guid>
		<description><![CDATA[Phil Haack linked to an interesting paper which intended to provide evidence that Test Driven Development increases the overall quality and productivity of developers on a given project.
I'm not going to debate the merits of TDD right now, did enough of that on Twitter last night ;), but I did notice something interesting that I [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://haacked.com/archive/2008/01/22/research-supports-the-effectiveness-of-tdd.aspx">Phil Haack linked to</a> an <a href="http://iit-iti.nrc-cnrc.gc.ca/publications/nrc-47445_e.html">interesting paper which intended to provide evidence that Test Driven Development increases the overall quality and productivity of developers on a given project.</a></p>
<p>I'm not going to debate the merits of TDD right now, did enough of that on Twitter last night ;), but I did notice something interesting that I hope the group conducting the test follows up. </p>
<p>It's in a <acronym title='Portable Document Format'><span class='caps'>PDF</span></acronym> so I can't quite link to the appropriate charts, but they are regression charts on page 10 and 11. One compares quality to # of tests written and the other compares productivity to # of tests written. (I'm summarizing). The interesting part to me was that there were some of the participants in the TL (test last) group that scored higher than some of the TF(Test First) group members. In fact, if I'm interpreting that chart correctly, the highest quality code was written by members of the TL group. </p>
<p>The second chart appeared to show that the overall productivity for ALL group members was low, with the exception of a couple of members who fell way outside of the C.I.</p>
<p>I also liked that it appeared that the regression lines were hand-drawn on after the fact. <img src='http://www.lazycoder.com/weblog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.lazycoder.com/weblog/2008/01/22/productivity-vs-quality/feed/</wfw:commentRss>
		</item>
		<item>
		<title>What do you want out of a framework?</title>
		<link>http://www.lazycoder.com/weblog/2007/10/08/what-do-you-want-out-of-a-framework/</link>
		<comments>http://www.lazycoder.com/weblog/2007/10/08/what-do-you-want-out-of-a-framework/#comments</comments>
		<pubDate>Mon, 08 Oct 2007 23:11:22 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[General]]></category>

		<category><![CDATA[Languages]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Rails]]></category>

		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.lazycoder.com/weblog/index.php/archives/2007/10/08/what-do-you-want-out-of-a-framework/</guid>
		<description><![CDATA[Had an interesting discussion with blowmage (Mike Moore) over Twitter. I said that having the "param1/param2" pattern in the ASP.NET MVC made me itchy from a security standpoint. He replied.

Eh, just don't add them to the URL. The ASP.NET MVC assumes you know what you are doing. I'm sick of frameworks babysitting me.

I replied:

and yet [...]]]></description>
			<content:encoded><![CDATA[<p>Had an interesting discussion with <a href="http://blowmage.com/">blowmage (Mike Moore)</a> over Twitter. I said that <a href="http://www.lazycoder.com/weblog/index.php/archives/2007/10/08/member-variable-values-in-the-querystring-security-risk/">having the "param1/param2" pattern in the ASP.NET MVC made me itchy from a security standpoint</a>. <a href="http://twitter.com/blowmage/statuses/318353092">He replied</a>.</p>
<blockquote><p>
Eh, just don't add them to the <acronym title='Uniform Resource Locator'><span class='caps'>URL</span></acronym>. The ASP.NET MVC assumes you know what you are doing. I'm sick of frameworks babysitting me.
</p></blockquote>
<p><a href="http://twitter.com/lazycoder/statuses/318362372">I replied:</a></p>
<blockquote><p>
and yet you use a managed language that holds your hand and cleans up your memory for you. <img src='http://www.lazycoder.com/weblog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />
</p></blockquote>
<p>Which came out a little harsher than I meant. But my gist is, isn't a GC system babysitting you already? How much abstraction do you want out of a framework?</p>
<p>Bottom line is: a web application, is basically an abstraction for sending and receiving headers and <acronym title='HyperText Markup Language'><span class='caps'>HTML</span></acronym> to/from a browser. You can dress that process up with domain models and other abstractions. But you *can* build a web application strictly using sockets if you really don't want to be babysat.</p>
<p>Now that's absolute crazy talk. No one wants to build an eCommerce site by sending packets over a pipe. That'd be a crazy as writing an <a href="http://www.menuetos.org/">operating system today using 32-bit/64-bit x86 assembly</a>. So we accept some levels of abstraction. In fact, we embrace abstraction. Hunting down errors in a memory dump is no fun. Neither is making sure all of your string buffers are properly allocated and sized. We don't want to have to malloc() and free() char buffers when we want to concatenate strings, so we make a StringBuilder class that handles all the <a href="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_5.html">nastiness</a> for us.</p>
<p>It's also not fun to get stuck in a framework that is so opinionated that when you stray from it's primrose path you are assaulted by rabid dogs. <a href="http://gettingreal.37signals.com/ch04_Make_Opinionated_Software.php">Opinionated software is good</a>, but a framework should allow you to <a href="http://www.martinfowler.com/articles/injection.html">inject your own opinion</a>.</p>
<p>So what do you really want out of a framework. Ultimately, I think developers really want a framework that will nerf the sharp corners of the underlying hardware for us. We want to be babysat.But we also want the freedom to rip things out and <a href="http://www.lazycoder.com/weblog/index.php/archives/2007/04/09/know-your-platform/">route around the hard parts</a>. And frankly, we want frameworks that work <strong>for</strong> us, not <strong>against</strong> us. It's when the framework is working against us that we rail and rant and cry out for change.</p>
<p>Me? I want the full on <a href="http://youtube.com/watch?v=19BWJQ8kjrw">Star Trek-Computer</a>:write-me-a-program-that-will-let-me-sell-my-"My Little Pony"-collection-on-eBay" framework.</p>
<p>Feel free to leave your own thoughts below. Difficulty: No Linking to <a href="http://www.joelonsoftware.com/articles/LeakyAbstractions.html">Spolskys "Leaky Abstractions"</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lazycoder.com/weblog/2007/10/08/what-do-you-want-out-of-a-framework/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
