<?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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>John Petersen</title>
	<atom:link href="http://codebetter.com/johnpetersen/feed/" rel="self" type="application/rss+xml" />
	<link>http://codebetter.com/johnpetersen</link>
	<description>CodeBetter.Com - Stuff you need to Code Better!</description>
	<lastBuildDate>Fri, 10 Feb 2012 22:33:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>ASP.NET Connections &#8211; JavaScript Testing</title>
		<link>http://codebetter.com/johnpetersen/2012/02/09/asp-net-connections-javascript-testing/</link>
		<comments>http://codebetter.com/johnpetersen/2012/02/09/asp-net-connections-javascript-testing/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 18:27:38 +0000</pubDate>
		<dc:creator>johnvpetersen</dc:creator>
				<category><![CDATA[ASP.Net Connections]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://codebetter.com/johnpetersen/?p=155</guid>
		<description><![CDATA[I am honored to be presenting at ASP.NET Connections, March 26-29 in Las Vegas. One of the sessions I&#8217;m presenting is on the topic of JavaScript Testing. If you are writing web applications, JavaScript is likely as significant, if not&#160;&#8230; <a href="http://codebetter.com/johnpetersen/2012/02/09/asp-net-connections-javascript-testing/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I am honored to be presenting at <a href="http://www.devconnections.com/shows/sp2012/">ASP.NET Connections, March 26-29 in Las Vegas</a>. One of the sessions I&#8217;m presenting is on the topic of JavaScript Testing. If you are writing web applications, JavaScript is likely as significant, if not more so, than your native C#/VB code. And yet, it  is often treated differently from a testing perspective. How does one organize JavaScript to make it testable? How do the SOLID principles apply? What tools can I use to test JavaScript? These questions and others will be addressed through practical code examples on how to use testing frameworks like QUnit and how those tools can be integrated into Visual Studio.</p>
<p>To more illustrate what this session will cover, consider the this hypothetical: we need to display address components in a pre-defined section of a page.</p>
<p>The end result might look like this:</p>
<p><a href="http://codebetter.com/johnpetersen/files/2012/02/image_thumb.png"><img class="alignnone size-full wp-image-160" src="http://codebetter.com/johnpetersen/files/2012/02/image_thumb.png" alt="" width="244" height="158" /></a></p>
<p>The following code drives the address display:</p>
<pre class="brush: jscript; title: ; notranslate">
$.getJSON(&quot;data/data.json&quot;, function (data) {}).success(function (data) {
		  $(&quot;#target&quot;).empty();
		  var items = [];
		  $.each(data, function (key, val) {
		    items.push('&lt;/pre&gt;
&lt;ul&gt;
	&lt;li id=&quot;' + key + '&quot;&gt;' + val + '&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;
');
		  });

$('', {
		    html: items.join('')
		  }).appendTo('#target');

		})

		.error(function (error) {
		  $(&quot;#target&quot;).empty().append(&quot;

An error was encountered...

&quot;);
		})

		.complete(function (data) {
		  $(&quot;#target&quot;).removeClass('ajaxLoad');
		});
</pre>
<p>Fairly straightforward code: Data is acquired via getJSON and displayed. jQuery I used to drive the process. The code works, but there are problems. Recalling what we have learned from SOLID, DRY, etc. – we quickly learn that the code not maintainable, re-useable and it’s marginally testable. About the only thing that can be tested here is the end result. As to the target, were the proper classes assigned and is there an un ordered list with data? In other words, all we can really test are the side-effects of the JavaScript code, not the code itself. Looking at the code, there are several distinct things happening. First, there is the application of the ajaxLoad class. Second, there is the data acquisition process itself. Third, there is the application of the data. There are also operations to handle error conditions and when the ajax process has completed. Geographically, this code is embedded in an html document. Ideally, this code would be re-factored into its own js file. Going back to the distinct operations, each of these operations should be testable, and more specifically, unit testable. Ideally, we would like to verify our code with a test like this:</p>
<pre class="brush: jscript; title: ; notranslate">
function testfixture() {
    module(&quot;When retrieving address data&quot;);
	//Arrange
	var html = $('&lt;/pre&gt;
&lt;div id=&quot;target&quot;&gt;&lt;/div&gt;
&lt;pre&gt;')
   //Act
   ApplySomeOperation(html);

    test(&quot;Given that the data has \
	  been applied to a pre-defined div&quot;,
	   function () {
	   expect(1);

	   var ul = $(html).find(&quot;ul&quot;);

       //Assert
	   equal(ul.length, 1, &quot;The ul tag is present.&quot;);
	});
}
</pre>
<p>The code, as written, does not support a unit test like this. The code is essentially a <a href="http://en.wikipedia.org/wiki/Big_ball_of_mud" target="_blank">big ball of mud</a>. Again, the code “works”, but in our business, working is not enough. With a little re-factoring, we can get where we need to be.</p>
<p>This is what we end up with:</p>
<pre class="brush: jscript; title: ; notranslate">
function removeStartMsg(target) {
   $(target).removeClass('ajaxLoad');
}
function displayStartMsg(target) {
   $(target)
      .empty()
      .addClass('ajaxLoad')
      .append(&quot;

One moment while your data is \
	    being retrieved...

&quot;);
}
function createAddressHtml(data) {
   var items = [];
      $.each(data, function(key, val) {
	     items
		   .push('&lt;/pre&gt;
&lt;ul&gt;
	&lt;li id=&quot;' + key + '&quot;&gt;'
 + val + '&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;
');
	  });

return $('', {
		html: items.join('')
	   })
}
function displayAddress(data,target) {
   target.empty().html(createAddressHtml(data));
}
function getAddress(id,target) {
	var complete =  function(data) {
	    removeStartMsg(target);
		$(target).removeClass('ajaxLoad');
	};

	var success = function(data) {
		displayAddress(data,target)
	};

	var error = function(error) {
	   $(target).empty().append(&quot;
An error was encountered...

&quot;);
	}
	displayStartMsg(target);
	getData(id,&quot;data/data.json&quot;,success,error,complete);
}
function getData(id,source,successCallBack,errorCallBack,completeCallBack) {
   $.getJSON(source, {id: id},
       function (data) {}).success(function (data) {
	   successCallBack(data)
   })
   .error(function (error) {
       errorCallBack(error)
   })
   .complete(function (data) {
   	   completeCallBack(data)
	});
}
</pre>
<p>The idea is that each discrete operation has its own function. Thus &#8211; we adhere to the single responsibility principle. Also note that no function reaches into the DOM. Instead, the object it is to act on is handed to it. The code in the page reduces to this:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
   getAddress(0,$(&quot;#target&quot;));
&lt;/script&gt;
</pre>
<p>For testing purposes, the json source is a static file on IIS. With little effort however, the source could easily be any http endpoint. With the refactored code, we can write more granular tests. </p>
<p>For example:</p>
<pre class="brush: jscript; title: ; notranslate">
function testfixture() {
    module(&quot;When retrieving address data&quot;);
	//Arrange
	var html = $('&lt;div id=&quot;target&quot;&gt;&lt;/div&gt;')
   //Act

   getAddress(0,html);
   stop(2); // allow async processes to run

    test(&quot;Given that the data has \
	  been applied to a pre-defined div&quot;,
	   function () {
	   expect(1);

	   var ul = html.find(&quot;ul&quot;);

       //Assert
	   equal(ul.length, 1, &quot;The ul tag is present.&quot;);
	});

    test(&quot;Given that the data has \
	  been applied to a pre-defined div&quot;,
	   function () {
	   expect(1);
	   var expectedHtml = &quot;&lt;ul&gt;&lt;li id=\&quot;company\&quot;&gt;Microsoft Corporation&lt;/li&gt;
                &lt;li id=\&quot;Address\&quot;&gt;One Microsoft Way&lt;/li&gt;&lt;li id=\&quot;City\&quot;&gt;Redmond&lt;/li&gt;
                &lt;li id=\&quot;State\&quot;&gt;WA&lt;/li&gt;&lt;li id=\&quot;Zip\&quot;&gt;98052&lt;/li&gt;&lt;/ul&gt;&quot;
       //Assert
	   equal(html.html(), expectedHtml, &quot;The html markup is correct.&quot;);
	});
}
</pre>
<p>The following is the QUnit output:</p>
<p><a href="http://codebetter.com/johnpetersen/files/2012/02/testoutput.png"><img src="http://codebetter.com/johnpetersen/files/2012/02/testoutput-300x91.png" alt="" width="300" height="91" class="alignnone size-medium wp-image-191" /></a></p>
<p>Again, with the refactored code, we can test everything, at a unitary level, that is needed to support the display. </p>
]]></content:encoded>
			<wfw:commentRss>http://codebetter.com/johnpetersen/2012/02/09/asp-net-connections-javascript-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My appearance on Dot Net Rocks &#8211; SOPA</title>
		<link>http://codebetter.com/johnpetersen/2012/02/06/my-appearance-on-dot-net-rocks-sopa/</link>
		<comments>http://codebetter.com/johnpetersen/2012/02/06/my-appearance-on-dot-net-rocks-sopa/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 12:49:18 +0000</pubDate>
		<dc:creator>johnvpetersen</dc:creator>
				<category><![CDATA[ACTA]]></category>
		<category><![CDATA[Dot Net Rocks]]></category>
		<category><![CDATA[IP Law]]></category>
		<category><![CDATA[SOPA]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://codebetter.com/johnpetersen/?p=148</guid>
		<description><![CDATA[Recently, I was a guest on Dot Net Rocks. As you can see from the comments, this episode stirred the pot a bit. As I&#8217;ve always said, if you are not ticking off&#160;at least a few people &#8211; you are&#160;&#8230; <a href="http://codebetter.com/johnpetersen/2012/02/06/my-appearance-on-dot-net-rocks-sopa/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently, I was a guest on <a href="http://www.dotnetrocks.com/default.aspx?showNum=736">Dot Net Rocks</a>. As you can see from the comments, this episode stirred the pot a bit. As I&#8217;ve always said, if you are not ticking off&nbsp;at least a few people &#8211; you are not trying hard enough! There is an update to this show that will be airing on 2/9. The original focus of the show was on <a href="http://en.wikipedia.org/wiki/Stop_Online_Piracy_Act">SOPA</a> &#8211; discussing what it is and perhaps more importantly, what it is not. During the show, I had added that one of the sources of intellectual property law are treaties that the United States ratifies. Seems like a non-consequential statement at the time. Turns out &#8211; it was not. For a few years, <a href="http://en.wikipedia.org/wiki/Anti-Counterfeiting_Trade_Agreement">ACTA </a>has been discussed&nbsp; &#8211; but the topic has not received too much air play given that SOPA was in the news. Now that SOPA has been removed from consideration, ACTA has now entered the limelight.</p>
<p>I want to be clear here &#8211; I don&#8217;t agree with those that say that laws like SOPA and treaties like ACTA &#8211; subvert free speech. Stealing the intellectual property of others is not something that should be tolerated. That said, there&nbsp;were some troubling aspects in SOPA &#8211; mostly arising form the lack of due process. The major problem was that based on a mere allegation &#8211; a&nbsp;site <strong><em>could be shut down</em></strong>. &nbsp;It remained to be seen how that law would have been enforced.</p>
<p>ACTA is another thing altogether in that it is a treaty. In my opinion, <a href="http://www.fsf.org/campaigns/acta/">organizations like the Free Software Foundation (FSF) &#8211; completely mis-represent what ACTA is</a>. If there is one thing about ACTA I think is worthy of criticism is the secrecy around the treaty negotiations.</p>
<p>In general, I&#8217;m a fan of the FSF. That said, the torch and pitchfork crowd goes a bit too far with their assertions. Here are the FSF&#8217;s points:</p>
<ol>
<li>It makes it more difficult to distribute free software: Without file sharing and P2P technologies like BitTorrent, distributing large amounts of free software becomes much harder, and more expensive. BitTorrent is a grassroots protocol that allows everyone to contribute to legally distributing free software.</li>
<li>It will make it harder for users of free operating systems to play media: Consumers may no longer be able to buy media without DRM &#8212; and DRMed media cannot be played with free software.</li>
<li>It increases the chances of getting your devices taken away: Portable media players that support free formats are less common than devices which support DRM, such as the iPod. Will this make them suspicious to border guards?</li>
<li>It creates a culture of surveillance and suspicion, in which the freedom that is required to produce free software is seen as dangerous and threatening rather than creative, innovative, and exciting.</li>
</ol>
<p>First off, folks need to read ACTA. It states pretty clearly that notions of due process and free speech must endure &#8211; that the manner of how ACTA is enforced must be consistient with those ideals. Put it this way, illegal activity occurs on cell phones and computers. Are we less likely to use those devices? Are those devices confiscated today? Of course not. File sharing technology supports legal activities. Indeed, it can support illegal activities as well. That however, does not mean those technologies will go away. This is where common sense and practicality have to kick in. For example &#8211; let&#8217;s say you in fact, have illegal copies of music on your iPod. How can you tell by looking at the device? More importantly, how could a customs tell? Do we really think this is going to be a priority?&nbsp; </p>
<p>The fact is &#8211; pirated software, music and counterfeit goods are a problem &#8211; and it is well within the province of rights-holders to prosecute and protect their rights. That said, it cannot and should not happen at the expense of our rights and our rights to use technology that has legitimate purposes. I happen to think that the MPAA and RIAA, while they have some legitimate concerns, are also comprised of people that for the most part &#8211; are clueless on how to deal with these matters. If there is one point to take from the DNR episodes it is this &#8211; GET INVOLVED AND STAY INFORMED. If there is one suggestion I&#8217;d make to those who have to craft legislation and ratify treaties &#8211; it is this &#8211; G</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://codebetter.com/johnpetersen/2012/02/06/my-appearance-on-dot-net-rocks-sopa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use tasks you have to do around the house to improve your development skills</title>
		<link>http://codebetter.com/johnpetersen/2012/01/16/use-tasks-you-have-to-do-around-the-house-to-improve-your-development-skills/</link>
		<comments>http://codebetter.com/johnpetersen/2012/01/16/use-tasks-you-have-to-do-around-the-house-to-improve-your-development-skills/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 18:43:14 +0000</pubDate>
		<dc:creator>johnvpetersen</dc:creator>
				<category><![CDATA[Continuous Improvement]]></category>
		<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://codebetter.com/johnpetersen/?p=135</guid>
		<description><![CDATA[A somewhat unorthodox and non-traditional suggestion I admit, but as Brad Meltzer often asks: &#8220;This may seem unlikely, but go with me on this&#8230;&#8221; How many times have you had to build that piece of furniture from Ikea, install window blinds,&#160;&#8230; <a href="http://codebetter.com/johnpetersen/2012/01/16/use-tasks-you-have-to-do-around-the-house-to-improve-your-development-skills/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A somewhat unorthodox and non-traditional suggestion I admit, but as <a href="http://www.history.com/shows/brad-meltzers-decoded" target="_blank">Brad Meltzer</a> often asks: &#8220;This may seem unlikely, but go with me on this&#8230;&#8221;</p>
<p>How many times have you had to build that piece of furniture from Ikea, install window blinds, etc? In each case, you are solving a problem. You have to analyze and organize. It&#8217;s really not that different from development. It&#8217;s a project like anything else. It has a beginning, middle, end. Like development, if you misinterpret the requirements, you have to go back a few steps. That next thing you were going to do has to get pushed to a later time.</p>
<p>This past weekend, I had to install some Levolor Blinds into our spare bedroom. I also happened to be listening to the  <a href="http://thisdeveloperslife.com/" target="_blank">This Developer&#8217;s Life Podcast</a>. I was listening to <a href="http://thisdeveloperslife.com/post/1-0-6-abstraction" target="_blank">Episode 1.0.6: Abstraction</a>. A great episode (as they all are &#8211; and like really good things &#8211; you have to go through them a few times because you are likely to pick up something new and useful that you missed before.) The part that really struck me was the interview with <a href="http://c2.com/" target="_blank">Ward Cunningham</a>. It was then that I decided to use my blind installation task as an analog of sorts for development. The interview with Ward was the inspiration. The end game is to then reverse the flow &#8211; to perhaps use development as an analog for the blind installation task &#8211; assuming of course the blind installation task is successful!</p>
<p><strong>It begins with us&#8230;..</strong></p>
<p>The one thing that really struck me about Ward was his motivation &#8211; that he builds things form himself. The same was true with John Ressig and Dan Bricklin. Then it struck me that this is really a craftsmanship issue. True craftsmen always reserve the best stuff for themselves. Indeed, much of that good stuff accrues to the benefit the things that are released for public consumption. Craftsmen work product also shares another characteristic &#8211; what they produce is pleasing to look at and use by the harshest critic of them all &#8211; the craftsmen themselves.</p>
<p>Turning back to my window blind example, I wanted to ensure they would function properly, be pleasing to look at &#8211; much like what we strive for in our software.  For a satisfactory end result however, there has to be some measure of planning. Since I had two blinds to install, I wanted to make sure the second one had the benefit of the first &#8211; as to process and as to a completed product. My benchmarks were simple:</p>
<p><strong>Did I thoroughly understand the requirements?</strong></p>
<p><strong>Did I have a plan?</strong></p>
<p><strong>Was I organized?</strong></p>
<p><strong>As to tooling, did I have what I needed and were those tools readily available?</strong></p>
<p><strong>Was there improvement in the process?</strong></p>
<p>The great thing about tangible projects &#8211; particularly those you have to do around the house or wherever you may be, those projects provide immediate feedback. You know whether they look right. You know immediately whether something was hacked together. You know whether the finished product is pleasing to look at.  You also know what is lurking beneath the surface. I&#8217;m in the middle of the <a href="http://www.amazon.com/Steve-Jobs-Walter-Isaacson/dp/1451648537" target="_blank">Steve Jobs bio by Walter Isaacson</a>. Jobs was obsessive about quality (perhaps to an unhealthy extreme!!). His [Jobs] obsession was centered around the fact that quality of thing not seen was at least as important as what is seen.   That consideration absolutely applies to the software world. When we see properly working software, we can take pride that the things people don&#8217;t see are well constructed. With home projects &#8211; we know that something is not going to break or fall apart because the things people don&#8217;t see (like screws into the wall being well anchored) are well done.</p>
<p>Food for thought as you contemplate ways to continuously improve.</p>
]]></content:encoded>
			<wfw:commentRss>http://codebetter.com/johnpetersen/2012/01/16/use-tasks-you-have-to-do-around-the-house-to-improve-your-development-skills/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WebAPI Developer Preview 6: Self Hosted Mode Example</title>
		<link>http://codebetter.com/johnpetersen/2012/01/13/webapi-developer-preview-6-self-hosted-mode-example/</link>
		<comments>http://codebetter.com/johnpetersen/2012/01/13/webapi-developer-preview-6-self-hosted-mode-example/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 13:40:20 +0000</pubDate>
		<dc:creator>johnvpetersen</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[WebAPI]]></category>

		<guid isPermaLink="false">http://codebetter.com/johnpetersen/?p=117</guid>
		<description><![CDATA[In case you missed it, the WebAPI Developer Preview is up to version 6. The CodePlex site provides all of the information you need to get started. To illustrate how to build a simple WebAPI, this example uses ASP.NET MVC&#160;&#8230; <a href="http://codebetter.com/johnpetersen/2012/01/13/webapi-developer-preview-6-self-hosted-mode-example/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In case you missed it, the <a href="http://wcf.codeplex.com/releases/view/73423" target="_blank">WebAPI Developer Preview</a> is up to version 6. The CodePlex site provides all of the information you need to get started. To illustrate how to build a simple WebAPI, <a href="http://wcf.codeplex.com/wikipage?title=Getting started: Building a simple web api" target="_blank">this example</a> uses ASP.NET MVC as the host. While the example makes reference to the fact that you can create this example in self-hosted mode (not using ASP.NET/ASP.NET MVC) &#8211; there is no code that illustrates how to do this.</p>
<p>To get started, create a <strong>Console Application</strong> and follow the steps in the ASP.NET MVC example to use Nuget to download the WebAPI references and to create the Contact Manager classes. Once you have those items in place, all you need to do is outfit the application to fire up the web host. To do that, use this code:</p>
<pre class="brush: csharp; title: ; notranslate">
using System;
using ContactManagerSelfHost.APIs;
using Microsoft.ApplicationServer.Http;

namespace ContactManagerSelfHost
{
    class Program
    {
        static void Main(string[] args)
        {

            using (var host = new HttpServiceHost(typeof(ContactsApi), &quot;http://localhost:9000/api/contacts&quot;))
            {
                host.Open();
                Console.WriteLine(&quot;Press any key to stop host...&quot;);
                Console.ReadKey();
            }
        }
    }
}
</pre>
<p>Simply run the app and navigate to the URL. That&#8217;s it!</p>
]]></content:encoded>
			<wfw:commentRss>http://codebetter.com/johnpetersen/2012/01/13/webapi-developer-preview-6-self-hosted-mode-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Great post on why the patent system in the US is broken</title>
		<link>http://codebetter.com/johnpetersen/2011/11/07/great-post-on-why-the-patent-system-in-the-us-is-broken/</link>
		<comments>http://codebetter.com/johnpetersen/2011/11/07/great-post-on-why-the-patent-system-in-the-us-is-broken/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 13:33:01 +0000</pubDate>
		<dc:creator>johnvpetersen</dc:creator>
				<category><![CDATA[IP Law]]></category>
		<category><![CDATA[Patents]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://codebetter.com/johnpetersen/?p=112</guid>
		<description><![CDATA[You can read the post at SFGate. It&#8217;s a great interview with a Google attorney who lays out in pretty simple terms why the patent system in the US is broken. The comments are also worth a read. Some of&#160;&#8230; <a href="http://codebetter.com/johnpetersen/2011/11/07/great-post-on-why-the-patent-system-in-the-us-is-broken/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>You can read the post at <a href="http://www.sfgate.com/cgi-bin/article.cgi?f=/c/a/2011/11/05/BUQP1LQN3V.DTL">SFGate</a>. It&#8217;s a great interview with a Google attorney who lays out in pretty simple terms why the patent system in the US is broken. The comments are also worth a read. Some of them are quite insightful.</p>
<p>In a nutshell, to be patentable, the given subject matter must cross two thresholds:</p>
<ol>
<li>The subject matter must be <em><strong>novel</strong></em></li>
<li>It must be non-obvious to those who are skilled in the art.</li>
</ol>
<p>Ideas and discoveries are not patentable. Inventions are patentable. i.e. things that <em>do something</em>. Great examples are the microprocessor, the internal combustion engine, the  machine that produces Slurpees, etc. The big question is whether software is patentable. It&#8217;s settled that software is copyrightable in that it can be expressed in document form. But as we know as professionals in this business, software, like it&#8217;s machine and hardware counterparts, actually does something &#8211; whether it is controlling hardware, carrying out a business process, etc. A software process can be described in a patent claim just as the processes for how a microprocessor works can be documented (in reality, multiple patents will cover complex things like a microprocessor, combustion engine, etc.)</p>
<p>A good example of a software patent was FoxPro&#8217;s Rushmore Technology which, simply stated, was a data access method that used indexes to optimize data retrieval. A bad example of a software patent was <a href="http://en.wikipedia.org/wiki/1-Click" target="_blank">1-Click Buying</a>. Setting aside the obviousness problem here, let&#8217;s consider whether something like 1 Click Buying was novel. By novel, does something build on prior art? I think it is safe to say that 1 Click Buying most certainly built on prior art that Apple didn&#8217;t own. When you consider how big Apple has become, don&#8217;t just think of the iPod, iPhone, IPad, etc. In 2000, Amazon licensed 1-Click from Apple. How much in licensing and royalty fees do you reckon Apple has cashed in on?</p>
<p>I agree with the Google attorney, the system is broken and has been broken for quite some time.  That&#8217;s not to say that software cannot and should not be patentable. I contend that software is just as patentable as anything else that has the potential for being patentable subject matter. The notions of novelty and non-obviousness seem to have been discarded by the USPTO. Some claim that it is very difficult to discern whether something is actually building on prior art. Peraps if claims where drawn up in a more standardized way, it would be easier. But you see, this is where the lawyers come in. The goal is always to draw up claims that are broad and vague. The broder the claims, the more your patent covers &#8211; something that patent trolls strive for. The gate keeper to protect the system is supposed to be the USPTO. They have been totally asleep at the wheel. It&#8217;s also been the court system that has been asleep at the wheel. Often, the USPTO will actually get it right &#8211; only to be reversed by the federal courts.</p>
<p>Now&#8230;before you think this is something that is just limited to technology, think again. Do you remember those orange trashbags that you could fill with leaves? They had a picture of a pumpkin stamped on them. Was that novel? I don&#8217;t believe so as it most definitely built on prior art. Was it non-obvious?  I thnk it is safe to say that in reality, the bags were obvious. The USPTO rejected the patents. The Circuit Court however, in 1999, <a href="http://caselaw.findlaw.com/us-federal-circuit/1211877.html" target="_blank">reversed the USPTO</a>. The Dembiczak and Zinbarg case is a good one to read because it is instructive on the gap that existed between the law and common sense. The USPTO was reversed on technical grounds based on evidence that was not in the record &#8211; but nevertheless could have been. This was a case where there the narrow teaching/suggestion/motivation standard for obviousness under 35 U.S.C. §103 was applied. Fortunately, in 2007, in the <em>KSR v. Teleflex </em>decision, the SCOTUS finally brought in notions of common sense. IMO, had the KSR decision been around when 1 Click was applied for, the patent would have been rejected.</p>
<p>Things should get better, but it would appear they are not because of business reality. The fact is, companies with a lot of money have the threat of litigation on their side &#8211; and that causes many more other companies to cave in. The Google attorney interviewed commented, as I have in the past that the only way you get to a definitive word is to litigate and get a court decision as to what is novel and non-obvious. The difficulity is that these are mixed questions of law and fact.</p>
<p>Bottom line, it&#8217;s going to be a while before things actually get better in the patent landscape.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://codebetter.com/johnpetersen/2011/11/07/great-post-on-why-the-patent-system-in-the-us-is-broken/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery 1.7 Released &#8211; Event handling in a better, simplified and consolidated way</title>
		<link>http://codebetter.com/johnpetersen/2011/11/04/jquery-1-7-released-event-handling-in-a-better-simplified-and-consolidated-way/</link>
		<comments>http://codebetter.com/johnpetersen/2011/11/04/jquery-1-7-released-event-handling-in-a-better-simplified-and-consolidated-way/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 14:12:46 +0000</pubDate>
		<dc:creator>johnvpetersen</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://codebetter.com/johnpetersen/?p=101</guid>
		<description><![CDATA[In case you missed it, you can find the announcement here. Apart from the improved delegate performance (which turned out to be a wonderfully simple solution!) &#8211; the nicest feature IMO is the standardized way to bind events. The new .on()&#160;&#8230; <a href="http://codebetter.com/johnpetersen/2011/11/04/jquery-1-7-released-event-handling-in-a-better-simplified-and-consolidated-way/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In case you missed it, you can find the announcement <a href="http://blog.jquery.com/2011/11/03/jquery-1-7-released/" target="_blank">here</a>. Apart from the improved delegate performance (which turned out to be a wonderfully simple solution!) &#8211; the nicest feature IMO is the standardized way to bind events. The new <a href="http://api.jquery.com/on/" target="_blank">.on()</a> and <a href="http://api.jquery.com/off/" target="_blank">.off()</a> methods handle the new method of event binding. In a nutshell, we don&#8217;t have to worry about different methods such as .live(), .bind() and .delegate(). We also don&#8217;t have to worry about the event specific methods like .click(). We also don&#8217;t have to worry about the .unbind() method either. The simplified .on() and .off() methods consolidate these disparate methods into single, simplified, shortened and consolidated methods. Because of the improved performance with delegates, these methods are recipients of those improvements, assuming of course that a delegate is what will be manifested.</p>
<p>As to the .on method, the one are that requires special attention is the optional selector argument. To explain, let&#8217;s assume you have an element that has child elements and you wish to bind a click handler. I will use the example provided in the jquery documentation.</p>
<pre class="brush: jscript; title: ; notranslate">
//in this example, a click handler will be attached to every table row.
$(&quot;#dataTable tbody tr&quot;).on(&quot;click&quot;, function(event){
 alert($(this).text());
});
</pre>
<p>The preceeding example could be quite expensive if you have a lot of rows. Note the following example which uses the optional selector argument:</p>
<pre class="brush: jscript; title: ; notranslate">
//in this example, the bound element is the tbody, not the tr's under the tbody.
//the second argument in the .on call is used, in this case, we pass the &quot;tr&quot; selector.
$(&quot;#dataTable tbody&quot;).on(&quot;click&quot;,&quot;tr&quot;, function(event){
 alert($(this).text());
});
</pre>
<p>The difference between these two examples may seem semantic. The difference is anything but. In the second example, the handler is attached to one element &#8211; the tbody. The event is then delegated to the tr elements &#8211; which is directly beneath the tbody. Per the jQuery documentation, when you delegate events, be sure to define them as close in proximity to the child objects that will actually be used to fire the events. Otherwise, jQuery has to work harder to traverse through the object hierarchy.</p>
<p>Finally, if you want an event that runs one time only and then detaches itself, check out the new <a href="http://api.jquery.com/one/" target="_blank">.one()</a> method.  How many times have you defined an action the user can only do one time. All of that code that you wrote to manually unbind the event is no longer necessary thanks to the new .one() method!</p>
]]></content:encoded>
			<wfw:commentRss>http://codebetter.com/johnpetersen/2011/11/04/jquery-1-7-released-event-handling-in-a-better-simplified-and-consolidated-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Telerik&#8217;s ASP.NET AJAX Controls &#8211; Check them out</title>
		<link>http://codebetter.com/johnpetersen/2011/11/03/teleriks-asp-net-ajax-controls-check-them-out/</link>
		<comments>http://codebetter.com/johnpetersen/2011/11/03/teleriks-asp-net-ajax-controls-check-them-out/#comments</comments>
		<pubDate>Thu, 03 Nov 2011 14:18:56 +0000</pubDate>
		<dc:creator>johnvpetersen</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://codebetter.com/johnpetersen/?p=97</guid>
		<description><![CDATA[UPDATE: Telerik is offering a prize to one of you, ASP.NET AJAX developers: a FREE developer license for RadControls for ASP.NET AJAX (worth $799)! To participate in the drawing for this prize, you need to help Telerik spread the news about&#160;&#8230; <a href="http://codebetter.com/johnpetersen/2011/11/03/teleriks-asp-net-ajax-controls-check-them-out/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>UPDATE:</p>
<p>Telerik is offering a prize to one of you, ASP.NET AJAX developers: a FREE developer license for RadControls for ASP.NET AJAX (worth $799)! To participate in the drawing for this prize, you need to help Telerik spread the news about this learning resource by simply:<br />
1.       Tweeting this blog post (title and URL)<br />
2.       Use the following hashtag in the tweet: #TelerikDemos</p>
<p>I&#8217;ve been proud to be associated with <a href="http://www.telerik.com" target="_blank">Telerik </a>because of the high quality of their tools. Telerik has just released a new version of their <a href="http://www.telerik.com/account/your-products/trial-product-versions/trial-single-download.aspx?pmvid=0&amp;pid=561" target="_blank">ASP.NET AJAX controls</a>. If you are an ASP.NET Webforms shop and have been looking for an easy way to add some pizazz to your applications, you really need to check out these tools. As with all things Telerik, it&#8217;s not just the tools that are solid, the <a href="http://www.telerik.com/support/demos/developer-tools-demos.aspx" target="_blank">demos </a>are superb. One of th4e most common use cases we encounter is the need for management dashboards. Decision makers want quick access to the most important information with at a glance efficiencies. One of Telerik&#8217;s demo applications is just that &#8211; a <a href="http://demos.telerik.com/aspnet-ajax/salesdashboard/default.aspx" target="_blank">sales dashboard</a>. This is an integrated demo that ties multiple tools together: RadToolbar, Script Manager, Style Sheet Manager, and many more. Yes, this is a ASP.NET Web Forms app, but it also brings in modern  elements with Ajax and jQuery.</p>
<p>One of the cool features RadListView which provides a nice navigation tool to quickly access a specific employee&#8217;s sales data. You will find the code for that in the default.aspx page under the a comment that reads &#8212; Employees List &#8211;. What&#8217;s nice about the demo is that it shows you how easy it is to combine these user controls with JavaScript and CSS. The JavaScript that handles  the onmouseover and onmouseout events is encapsulated in a RadCodeBlock that is also contained in the default.aspx page.</p>
<p>While you can click on a particular employee, you can also use the Page Slider control to navigate to another page of employees. The code in the default.aspx page show how easy it is to bind that control the employee list view. You may be thinking &#8220;There must be a lot of messy code behind.&#8221; In any web forms app, there is some code behind. The Telerik Demos are architected quite nicely to minimize the code behind. As you will see, the various order categories and statistics have been encapsulated into their own classes.</p>
<p>Other demos include typical use cases such as event management and mail/Outlook integration. Other Telerik tools such as the OpenAccess ORM Reporting are highlighted and demonstrated.</p>
<p>Bottom line, if you are looking to add some cool features to your ASP.NET web forms applications and you want demos that have sound architectual guidance, you will definitely want to consider adding the Telerik&#8217;s RadControls for ASP.NET Ajax to your development toolkit.</p>
]]></content:encoded>
			<wfw:commentRss>http://codebetter.com/johnpetersen/2011/11/03/teleriks-asp-net-ajax-controls-check-them-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why if you have implemented or in the process of implementing Scrum and are considering adding Kanban, you will want to evaluate that decision carefully</title>
		<link>http://codebetter.com/johnpetersen/2011/10/23/why-if-you-have-implemented-or-in-the-process-of-implementing-scrum-and-are-considering-adding-kanban-you-will-want-to-evaluate-that-decision-carefully/</link>
		<comments>http://codebetter.com/johnpetersen/2011/10/23/why-if-you-have-implemented-or-in-the-process-of-implementing-scrum-and-are-considering-adding-kanban-you-will-want-to-evaluate-that-decision-carefully/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 15:43:29 +0000</pubDate>
		<dc:creator>johnvpetersen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Kanban]]></category>
		<category><![CDATA[Scrum]]></category>

		<guid isPermaLink="false">http://codebetter.com/johnpetersen/?p=83</guid>
		<description><![CDATA[This is not about Scrum vs. Kanban. Both are effective means to manage the work necessary to deliver value via software. That said; they each represent in their own right, a very different means to achieve that delivery. Scrum is&#160;&#8230; <a href="http://codebetter.com/johnpetersen/2011/10/23/why-if-you-have-implemented-or-in-the-process-of-implementing-scrum-and-are-considering-adding-kanban-you-will-want-to-evaluate-that-decision-carefully/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is not about Scrum vs. Kanban. Both are effective means<br />
to manage the work necessary to deliver value via software. That said; they<br />
each represent in their own right, a very different means to achieve that<br />
delivery. Scrum is rather prescriptive for how teams interact; how work is<br />
carried out, etc. Kanban is not prescriptive in that regard. A mashed up<br />
approach with combined disciplines can work. However, in doing so, you need to<br />
make sure with the combination; you end up something that is greater than the<br />
sum of its parts. In addition, you want to make sure you can retain the best of<br />
each discipline. In the case of your efforts to implement Scrum, you will want<br />
to make sure what you end up with is in fact Scrum.</p>
<p>To illustrate the point, let’s consider what Scrum is in a<br />
nutshell (as codified by Ken Schwaber and Jeff Sutherland, the creators of<br />
Scrum). Scrum Teams are created that are comprised of a Product Owner, Scrum<br />
Master and a Development Team. A Product Owner manages a Product Backlog that<br />
is prioritized in descending order by business value. The Development Team,<br />
which is cross-functional and self-organizing, in conjunction with the Product<br />
Owner and Scrum Master, based on a variety of factors (most often by a<br />
combination of historic velocity + current capacity) in the Sprint Planning<br />
Meeting, select a number of Product Backlog Items to work on during the Sprint<br />
– which may last for at most, 4 weeks. The Development Team, in conjunction<br />
with the Scrum Master and Product Owner (as needed), decides to how to<br />
decompose the selected Product Backlog Items that now comprise the Sprint<br />
Backlog into separate tasks. As the Development Team works during the Sprint,<br />
it meets each day for a maximum of 15 minutes in the Daily Scrum Meeting. At<br />
the end of each Sprint, during the Sprint Review (no more than 4 hours), the<br />
entire Scrum Team meets to discuss/review the Product Increment (what was<br />
completed during the Sprint). Subsequently, a Sprint Retrospective Meeting (no<br />
more than 3 hours) is held to discuss what went well, what did not go so well<br />
and what could be improved as to the Scrum Team. After that, the next Sprint<br />
Planning Meeting is held and the process repeats.  All of this is codified in the <a href="http://www.scrum.org/scrumguides/" target="_blank">Scrum Guide</a>.</p>
<p>As for what Kanban is it first has to be stated that Kanban,  unlike Scrum, originated in a non-software environment. Kanban originated with  Toyota and devised the system as a means of supporting the production of cars.  Over time, Kanban and the Lean Manufacturing concepts have been applied to the  software development discipline. To the degree those concepts map cleanly to  software development remains very much in debate and it’s not a debate I’m going to undertake here. Rather, I’ll focus on the goals and objectives of Kanban and Lean. The origins of Kanban in the software context were codified by David  Anderson in his book Kanban – where he postulated the Kanban Method. There are  5 core principles: workflow visualization (Kanban Board), limited WIP (work in process), managed flow, defined explicit processes and improved collaboration.</p>
<p>For all of the rules codified in the Scrum Guide, in Kanban (in the traditional<br />
manufacturing sense), there are two basic rules: the ability to see the work  flow and limit the WIP. These rules are meant to support the aims and goals of  Lean. The Kanban Method, as codified by David Anderson, there are three basic  principles: Start with what you know, Agree to pursue incremental and  evolutionary change and respect the current process, roles, and responsibilities. With regard to respecting the current process, this is where conflict between Scrum and Kanban can arise. Note that a team’s discipline or the degree to which a team is functional is not a factor in Kanban. Is any of this counter to Scrum? Not necessarily, but it might. For example, Scrum prescribes team makeup, title, roles, and responsibilities. If those roles (Product Owner, Scrum Master, etc.) and the responsibilities ascribed to those roles as promulgated by the Scrum Guide don’t exist, then yes, there will be conflict. Kanban says to respect what’s there. Scrum has a prescriptive mandate. Those are irreconcilable differences in my opinion and if your team is implementing Scrum, those efforts could be derailed if you bring Kanban principles into the mix.</p>
<p>A good way to view this is to look at the goals of each method. If you look at Kanban’s principles and if you already have a functioning Scrum Team, you will find that without implementing Kanban, you will already be achieving Kanban’s objectives. What about the Lean Goals? The main goal is minimizing WIP (i.e. waste). A Development Team does not take on more than what it can handle – which necessarily means that WIP is minimized. As for waste – the Product Owner sees to that by making sure the Product Backlog is well groomed (irrelevant items are removed, those items with the highest business value are<br />
at the top, etc.). So then, if you have implemented Scrum, why would you also try implement Kanban? In my opinion, you wouldn’t for the aforementioned reasons. What about Kanban’s chief way of visualizing work, the Kanban Board? If you are working on a Scrum Team, you are already working with some visual representation of the Product and Sprint Backlog. Further, there is a visual representation of what is being worked on and what is done. Can a Kanban Board do that? Sure – but Kanban is more than just a board. The key is not to get caught up in the tools and devices. Rather, it is important to look at the underlying principles of a given methodology or framework. From that, you can ascertain where there are things in common and conflicts.</p>
<p>Some teams that use Kanban may be under the belief they are practicing Scrum. That may or may not be a valid belief. That practice would have to be assessed and gauged against the Scrum Guide. On the other hand, if you are practicing Scrum, then I would submit that an effort to bring Kanban into the Scrum practice would not present added value and perhaps, would be counterproductive. That&#8217;s not a knock against Kanban. Rather, it&#8217;s an assertion on my part the good things Kanban brings to the table are already accounted for with your Scrum practices.  Does that mean that Kanban has no value in your organization if you are using Scrum? Absolutely not! There may be other activities where Scrum does not apply or is a good fit for one reason or another.  In those cases, Kanban may be and could be a very productive alternative.  How about those cases where your team practices Scrum…but…&lt;&lt;insert your but here&gt;&gt;.  mplementing Kanban, by itself, is not going to remediate those “Scrum Buts.”</p>
<p>As always, when deciding to implement a new tool or process, have a solid understanding of why you would undertake such an implementation. Make sure the ills you are trying to remedy can be remedied with a combined approach.  Make sure your approaches are compatible such that one approach does not negate/dilute the other approach. When combining approach, you will want to make sure the net value add is at least equal to the sum of the parts.</p>
]]></content:encoded>
			<wfw:commentRss>http://codebetter.com/johnpetersen/2011/10/23/why-if-you-have-implemented-or-in-the-process-of-implementing-scrum-and-are-considering-adding-kanban-you-will-want-to-evaluate-that-decision-carefully/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code and Slidedeck from Philly Code Camp</title>
		<link>http://codebetter.com/johnpetersen/2011/10/15/code-and-slidedeck-from-philly-code-camp/</link>
		<comments>http://codebetter.com/johnpetersen/2011/10/15/code-and-slidedeck-from-philly-code-camp/#comments</comments>
		<pubDate>Sat, 15 Oct 2011 17:49:06 +0000</pubDate>
		<dc:creator>johnvpetersen</dc:creator>
				<category><![CDATA[Code Camp]]></category>
		<category><![CDATA[Philly Code Camp]]></category>
		<category><![CDATA[Philly Dot Net]]></category>

		<guid isPermaLink="false">http://codebetter.com/johnpetersen/?p=80</guid>
		<description><![CDATA[You can download them here. Thanks to everyone who attended to make for another successful Philly Code Camp!!]]></description>
			<content:encoded><![CDATA[<p>You can download them <a href="https://docs.google.com/viewer?a=v&amp;pid=explorer&amp;chrome=true&amp;srcid=0B6Zn8tqUVSf1MWVmZjRmODAtNGU5Yi00YmRkLWJmMWItZWMzOTVkYjMxNWE3&amp;hl=en_US">here</a>. Thanks to everyone who attended to make for another successful Philly Code Camp!!</p>
]]></content:encoded>
			<wfw:commentRss>http://codebetter.com/johnpetersen/2011/10/15/code-and-slidedeck-from-philly-code-camp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sample code and decks from NYC Code Camp</title>
		<link>http://codebetter.com/johnpetersen/2011/10/10/sample-code-and-decks-from-nyc-code-camp/</link>
		<comments>http://codebetter.com/johnpetersen/2011/10/10/sample-code-and-decks-from-nyc-code-camp/#comments</comments>
		<pubDate>Mon, 10 Oct 2011 12:51:40 +0000</pubDate>
		<dc:creator>johnvpetersen</dc:creator>
				<category><![CDATA[Code Camp]]></category>
		<category><![CDATA[NYC Code Camp]]></category>

		<guid isPermaLink="false">http://codebetter.com/johnpetersen/?p=78</guid>
		<description><![CDATA[Another successful NYC code camp is behind us. The new venue at Pace University worked out well. With the bigger space, hundreds more attendees could be accomodated.  Here are the links for my two sessions: Building your First jQuery Plugin&#160;&#8230; <a href="http://codebetter.com/johnpetersen/2011/10/10/sample-code-and-decks-from-nyc-code-camp/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Another successful NYC code camp is behind us. The new venue at Pace University worked out well. With the bigger space, hundreds more attendees could be accomodated.  Here are the links for my two sessions:</p>
<p><a href="https://docs.google.com/viewer?a=v&amp;pid=explorer&amp;chrome=true&amp;srcid=0B6Zn8tqUVSf1MGY3MWJiZTAtYTA4ZC00ZjUwLWJkNjctM2E1ZDhmMTEyZmFj&amp;hl=en">Building your First jQuery Plugin</a></p>
<p><a href="https://docs.google.com/viewer?a=v&amp;pid=explorer&amp;chrome=true&amp;srcid=0B6Zn8tqUVSf1YzEyYWZhZTMtYmVjOC00Y2VkLTlmMmUtODc4YmRhZWFjZDM3&amp;hl=en">ReST and ASP.NET MVC</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://codebetter.com/johnpetersen/2011/10/10/sample-code-and-decks-from-nyc-code-camp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.310 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-02-22 18:05:25 -->
<!-- Compression = gzip -->
