<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://azurecoding.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"><channel><title>Azure Coding .NET</title><link>http://azurecoding.com/blogs/</link><description>Keep your head in the Cloud As You're Coding .NET</description><dc:language>en-US</dc:language><generator>CommunityServer 2008.5 (Build: 30929.2835)</generator><item><title>Learning F# Using Project Euler</title><link>http://azurecoding.com/blogs/brownie/archive/2010/05/14/learning-f-using-project-euler.aspx</link><pubDate>Sat, 15 May 2010 00:29:08 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:6626</guid><dc:creator>Mike Brown</dc:creator><slash:comments>3</slash:comments><description>&lt;p&gt;I’ve decided that immersion is the best way for me to learn new programming concepts. My exposure to WPF came 4 years ago when I started at a new employer and was told that my first assignment was to learn the application codebase and create a WPF Datagrid that could display data from our application (the view of the data was dynamically composed using metadata from an &lt;a href="http://en.wikipedia.org/wiki/Entity-attribute-value_model" target="_blank"&gt;EAV&lt;/a&gt; database). Needless to say, the effort helped bring me up to speed quickly with both the internal codebase and WPF.&lt;/p&gt; &lt;!--more--&gt;  &lt;p&gt;I want to learn F# and have been looking for a way to immerse myself in it. Enter &lt;a href="http://projecteuler.net/" target="_blank"&gt;Project Euler&lt;/a&gt;, an online collection of math/computer science puzzles. I’m using F# to solve the problems one by one, purposefully using the functional aspects of the language rather than the OO aspects. Here is my solution for the first problem in F#&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;let list =      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; [1..999]      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; |&amp;gt;List.map(fun n -&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if n % 3 = 0 || n % 5=0 then      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; n      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; else      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0)      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; |&amp;gt;List.sum&lt;/p&gt;    &lt;p&gt;printfn &amp;quot;Sum of integers %d&amp;quot; list&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;I’m trying to figure if there’s a way for me to remove the if…then…else clause (possibly using pattern matching). But I guess it’s a good start for now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=6626" width="1" height="1"&gt;</description></item><item><title>What is MVVM?</title><link>http://azurecoding.com/blogs/brownie/archive/2010/05/04/what-is-mvvm.aspx</link><pubDate>Tue, 04 May 2010 15:22:03 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:6519</guid><dc:creator>Mike Brown</dc:creator><slash:comments>8</slash:comments><description>&lt;p&gt;There has been a lot of confusion lately over just what MVVM is and what it isn’t. I think this confusion has led many to throw their hands up in disgust and/or frustration and swear off MVVM altogether. I think the confusion comes because people aren’t clear about the delineation between the pattern itself and the details of implementing the pattern. So here is my definition of MVVM.&lt;/p&gt;  &lt;h2&gt;Model-View-ViewModel (aka Presentation Model)&lt;/h2&gt;  &lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; You have a UI with complex, interdependent interactions.    &lt;br /&gt;&lt;strong&gt;Solution:&lt;/strong&gt; Separate the UI from the UI logic using a ViewModel that encapsulates the interactions and provides properties for a View to retrieve its state (and the state of its elements).    &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;This is the long and short of MVVM Nothing more nothing less. Everything else is an implementation detail. If you use INPC or not, if you use Code-Behind in ASP.NET or Data binding in WPF/Silverlight. If you use DelegateCommands, RelayCommands, or RoutedCommands. If you use attached behaviors or Blend behaviors, VSM, or data triggers is not a concern of the pattern. The pattern is overkill for &amp;quot;Calculator Examples&amp;quot; (unless of course your calculator is storing a stack of historical operations for undo/redo). The pattern is not mutually exclusive of using a Front Controller for navigation.   &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;I think the majority of frustration regarding MVVM comes from a lack of this fundamental knowledge of what it is and what it isn&amp;#39;t. So there, I&amp;#39;ve spelled it out. HOW the pattern is implemented is up to the individual.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=6519" width="1" height="1"&gt;</description></item><item><title>Silverlight Bing Maps Control and Drag &amp; Drop</title><link>http://azurecoding.com/blogs/icbtw/archive/2010/04/17/silverlight-bing-maps-control-and-drag-amp-drop.aspx</link><pubDate>Sat, 17 Apr 2010 22:57:00 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:6234</guid><dc:creator>David Justice</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;I was recently asked to build up a Silverlight tool to show a file full 
of addresses on a map. I decided to use the Silverlight bing maps 
control and I must say I was not disappointed with it&amp;#39;s functionality. 
It ended up being extremely simple. The tools used to create this were 
VS2010, Silverlight 4, Bing maps Silverlight control, and the Bing maps 
web services.&lt;/p&gt;...(&lt;a href="http://azurecoding.com/blogs/icbtw/archive/2010/04/17/silverlight-bing-maps-control-and-drag-amp-drop.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=6234" width="1" height="1"&gt;</description><category domain="http://azurecoding.com/blogs/icbtw/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://azurecoding.com/blogs/icbtw/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://azurecoding.com/blogs/icbtw/archive/tags/Bing+Maps/default.aspx">Bing Maps</category></item><item><title>Sacha Barber’s New WPF Framework</title><link>http://azurecoding.com/blogs/brownie/archive/2010/04/01/sacha-barber-s-new-wpf-framework.aspx</link><pubDate>Thu, 01 Apr 2010 18:37:18 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:6125</guid><dc:creator>Mike Brown</dc:creator><slash:comments>3</slash:comments><description>&lt;p&gt;Today, Sacha Barber and a few of his colleagues released an article on CodeProject about their &lt;a href="http://www.codeproject.com/KB/WPF/Baboon.aspx" target="_blank"&gt;new framework for WPF&lt;/a&gt;. The article appears to be a preview for their upcoming book.&amp;#160; I looked a little closely at the article. And based on it my recommendation is that people not purchase the book. I mean it’s not even a great example of using baboons (seriously a tool tip? do you know what a baboon will do when the tooltip is hidden…you really don’t want to see the results). And the article (and book) only appears to deal with Baboon Converters which is just a tiny subset of Animal Conversion in WPF.&lt;/p&gt;  &lt;p&gt;To me here are the core pillars of animal conversion:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;800 Pound Gorrilas&lt;/li&gt;    &lt;li&gt;Elephants in the room&lt;/li&gt;    &lt;li&gt;Bulls in China shops&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;An ancillary topic would be bugs in rugs, but they are more advanced than the other three. I doubt Sacha has even considered the ramifications of implementing bugs in rugs? What about serialization (even though the bug is in the rug, you really should serialize the bug before the rug...serializing the rug first should get messy)? I mean seriously ANYBODY can handle Baboons. They&amp;#39;re friggin baboons! Show me how you handle snakes in the grass (or worst yet on a plane) then I&amp;#39;ll give you some credit. But don&amp;#39;t expect me to pat you on the back for handling a conversion my 4 year old daughter can do. &lt;/p&gt;  &lt;p&gt;I guess it&amp;#39;s a good beginner&amp;#39;s introduction to the concept of animal converters. But that&amp;#39;s insulting to beginners when you think about it. &lt;/p&gt;  &lt;p&gt;In summary, I recommend that you not buy “Learning Baboon Converters” As much as I respect Sacha…he’s a great guy. I can’t with good conscience recommend this book.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=6125" width="1" height="1"&gt;</description></item><item><title>Equality</title><link>http://azurecoding.com/blogs/brownie/archive/2010/03/18/equality.aspx</link><pubDate>Thu, 18 Mar 2010 20:42:49 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:6041</guid><dc:creator>Mike Brown</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;This is something that I’m surprised isn’t included in the framework out of the box. When using the Distinct Query operator, one of the overloads takes an IEqualityComparer&amp;lt;T&amp;gt; instance. There is friction in creating a separate IEqualityComparer&amp;lt;T&amp;gt; implementation for every object you want to compare and in some cases, Equality means something different depending on context so you don’t necessarily want to implement IEqualiyComparer&amp;lt;T&amp;gt; directly on your T (and/or you aren’t able to do so because it is a class from someone’s library).&lt;/p&gt;  &lt;p&gt;Whatever your reason, here is a generic implementation of IEqualityComparer that works similar to my DelegateCommand. You create an instance of it on the spot (or cache an instance) passing in lambdas that represent your equality logic.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;public class Equality&amp;lt;T&amp;gt; : IEqualityComparer&amp;lt;T&amp;gt;     &lt;br /&gt;{      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; private readonly Func&amp;lt;T, int&amp;gt; _hashFunc;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; private readonly Func&amp;lt;T, T, bool&amp;gt; _equalsFunc; &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; public Equality(Func&amp;lt;T,int&amp;gt;hashFunc)     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; _hashFunc = hashFunc;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; _equalsFunc = (x, y) =&amp;gt; x.GetHashCode() == y.GetHashCode();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; public Equality(Func&amp;lt;T,int&amp;gt;hashFunc, Func&amp;lt;T,T,bool&amp;gt;equalsFunc )     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; _hashFunc = hashFunc;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; _equalsFunc = equalsFunc;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; public bool Equals(T x, T y)     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; //can&amp;#39;t compare null      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if (typeof(T).IsClass)      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if (x == null || y == null)      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return false;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return _equalsFunc(x, y);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; public int GetHashCode(T obj)     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return _hashFunc(obj);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;}&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The first constructor overload takes just the hash function and specifies that the hashcode is your identifier (great for entities with an Int as their id). The second constructor takes a hash function and an equality function. Using Equality&amp;lt;T&amp;gt; is as simple as:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;var manufacturers =     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Catalogs.Select(c =&amp;gt; c.Product.ManuFacturer).Distinct(new Equality&amp;lt;ManuFacturer&amp;gt;(i =&amp;gt; i.Id));&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Hope it’s useful to you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=6041" width="1" height="1"&gt;</description><category domain="http://azurecoding.com/blogs/brownie/archive/tags/LINQ/default.aspx">LINQ</category><category domain="http://azurecoding.com/blogs/brownie/archive/tags/Software+Engineering/default.aspx">Software Engineering</category></item><item><title>Intention Revealing Interfaces or Car.FuelInjectionSystem.FuelInjectionRate.Increase()</title><link>http://azurecoding.com/blogs/brownie/archive/2010/03/17/intention-revealing-interfaces-or-car-fuelinjectionsystem-fuelinjectionrate-increase.aspx</link><pubDate>Wed, 17 Mar 2010 17:21:00 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:6032</guid><dc:creator>Mike Brown</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;I was having a discussion with &lt;a target="_blank" href="http://joshsmithonwpf.wordpress.com"&gt;Josh Smith&lt;/a&gt; about my upcoming article in MSDN Magazine on enterprise patterns with RIA Services. It&amp;rsquo;s basically a deep-dive into the technology that goes beyond the Drag-n-Drop demos you&amp;rsquo;ve seen so far. Josh&amp;rsquo;s feedback was generally positive but he had one comment on my section on Domain Models and Intention-Revealing Interfaces. Here&amp;rsquo;s the section in question&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;hellip;[quoting Eric Evans&amp;rsquo; Domain Driven Design]&lt;/p&gt;
&lt;p&gt;&lt;em&gt;If a developer must consider the implementation of a component in order to use it, the value of encapsulation is lost. If someone other than the original developer must infer the purpose of an object or operation based on its implementation, that new developer may infer a purpose that the operation or class fulfills only by chance. If that was not the intent, the code may work for the moment, but the conceptual basis of the design will have been corrupted, and the two developers will be working at cross-purposes.[ (Evans, 2004) pg 246]&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;To put it simply, by explicitly naming the function for its purpose and encapsulating the logic (along with a few comments to make it clear what&amp;rsquo;s happening), I have made it easy for the next guy (even if the next guy is me 5 months from now) to determine what is happening before he even goes to the implementation.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Josh&amp;rsquo;s comment:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;So what you&amp;rsquo;re saying is that I should name my functions according to what they do and write relevant comments?&amp;nbsp; Seriously?&amp;nbsp; &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I had many similar moments when reading &lt;a target="_blank" href="http://www.amazon.com/gp/product/0321125215?ie=UTF8&amp;amp;tag=ivolvedbusine-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=0321125215"&gt;Eric Evan&amp;rsquo;s book&lt;/a&gt; where my response was &amp;ldquo;well d&amp;rsquo;uh&amp;rdquo;. But I got to thinking, how often have I seen code that doesn&amp;rsquo;t follow this simple rule. To make it patently obvious let&amp;rsquo;s look at some code that will make a car accelerate:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;sCar.FuelInjectionSystem.FuelInjectionRate.Increase()&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;What&amp;rsquo;s that, you have an electric car okay:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;switch(sCar.Engine.EngineType) &lt;br /&gt;{ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; case(EngineType.InternalCombustion) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sCar.FuelInjectionSystem.FuelInjectionRate.Increase(); &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; case(EngineType.Electric) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sCar.Motor.Battery.Amperage.Increase(); &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;br /&gt;}&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;You&amp;rsquo;re on your own if you have a &lt;a target="_blank" href="http://bttf.wikia.com/wiki/Mr._Fusion"&gt;Mr. Fusion powered car&lt;/a&gt;. I have no idea how they work (although according to FuturePedia the Mr. Fusion doesn&amp;rsquo;t actually power the car only the Flux Capacitor). But I digress, as the consumer of the car API, I really don&amp;rsquo;t want to be concerned with fuel injection rates or battery amperages. Please don&amp;rsquo;t get technical on me and explain that it&amp;rsquo;s actually wattage that is adjusted on the battery not amperage or whatever snide remark you have regarding the accuracy of my functions. That&amp;rsquo;s the point of this post because of the car&amp;rsquo;s design &lt;strong&gt;I don&amp;rsquo;t have to know how it&amp;rsquo;s done&lt;/strong&gt;. And neither should the consumer of your car&amp;rsquo;s API. It should be a simple call:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;//look at that! &lt;br /&gt;sCar.Go() &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;a href="http://azurecoding.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/brownie/480_5F00_SCarGo769045_5F00_4C7EF215.jpg"&gt;&lt;img height="164" width="244" src="http://azurecoding.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/brownie/480_5F00_SCarGo769045_5F00_thumb_5F00_3306C90E.jpg" align="left" alt="480_S-Car-Go-769045" border="0" title="480_S-Car-Go-769045" style="border-bottom:0px;border-left:0px;display:inline;margin-left:0px;border-top:0px;margin-right:0px;border-right:0px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;That is the point of the intention revealing interface. Instead of making your consumers have intimate knowledge of the innards of your system to make it work, provide them with a simple interface that tells them exactly how to make it do what they want to do.&lt;/p&gt;
&lt;p&gt;It may be obvious when you read &amp;ldquo;explicitly name the function according to its purpose&amp;rdquo;, but following that advice tends to be less commonplace than it implies.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=6032" width="1" height="1"&gt;</description><category domain="http://azurecoding.com/blogs/brownie/archive/tags/Patterns/default.aspx">Patterns</category><category domain="http://azurecoding.com/blogs/brownie/archive/tags/Software+Engineering/default.aspx">Software Engineering</category></item><item><title>Windows Phone 7 the Belle of the Ball</title><link>http://azurecoding.com/blogs/brownie/archive/2010/03/15/windows-phone-7-the-belle-of-the-ball.aspx</link><pubDate>Mon, 15 Mar 2010 19:56:21 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:5994</guid><dc:creator>Mike Brown</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;With its noticeable absence from PDC 2008 and 2009, it appeared that Windows Mobile had all but been abandoned. Yes and no. Windows Mobile is no more . Say hello to Windows Phone.&lt;/p&gt;  &lt;p&gt;The opening keynote for Mix 2010 was all about Windows Phone 7. If it weren’t patently obvious from the various leaks and pseudo announcements, WP7 uses Silverlight as the primary developer platform. It also supports XNA for game development.&lt;/p&gt;  &lt;p&gt;The developer tools for Windows Phone 7 are Free. Included in the tools:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Visual Studio 2010 Express &lt;/li&gt;    &lt;li&gt;Blend 4 for Windows Phone &lt;/li&gt;    &lt;li&gt;XNA Studio 4 for Windows Phone &lt;/li&gt;    &lt;li&gt;Windows Phone 7 Device Emulator &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;All the tools except Blend 4 are included in one handy &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=2338b5d1-79d8-46af-b828-380b0f854203&amp;amp;displaylang=en" target="_blank"&gt;installer&lt;/a&gt; And Christian Schormann shows where you can &lt;a href="http://electricbeach.org/?p=438" target="_blank"&gt;get the Blend tools here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The keynote will be available for download tomorrow (in case you missed it). There are a ton of features for Windows Phone 7 that were highlighted in the keynote (I’ll provide a synopsis later). But why are you waiting for me to tell you? Go download it yourself!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=5994" width="1" height="1"&gt;</description><category domain="http://azurecoding.com/blogs/brownie/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://azurecoding.com/blogs/brownie/archive/tags/XNA/default.aspx">XNA</category><category domain="http://azurecoding.com/blogs/brownie/archive/tags/Windows+Phone+7/default.aspx">Windows Phone 7</category></item><item><title>2010 MVP Summit Recap (Or How to Slay a Robeast)</title><link>http://azurecoding.com/blogs/brownie/archive/2010/03/01/2010-mvp-summit-recap.aspx</link><pubDate>Mon, 01 Mar 2010 10:50:00 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:5894</guid><dc:creator>Mike Brown</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;&lt;img src="http://azurecoding.net/cfs-file.ashx/__key/CommunityServer.Components.UserFiles/00.00.00.21.00/voltron.jpg" align="left" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;No you&amp;rsquo;re not going to get an inside dish on what to expect at Mix (if you can make it, I HIGHLY suggest you go&amp;hellip;unfortunately, an urgent contract popped up for me that prevents me from going&amp;hellip;now that I think of it, considering the nature of the contract, I&amp;rsquo;m sure the client will understand my desire to go to Mix&amp;hellip;so maybe I will be able to go). In fact, even if I were crazy enough to break my NDA (I &lt;strong&gt;think&lt;/strong&gt; I can talk about my NDA without breaking it), I wouldn&amp;rsquo;t be in position to tell you anything. You see, the summit was scheduled at an inopportune time for me this year. Because of its dates:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;I was gone on Valentine&amp;rsquo;s Day&lt;/li&gt;
&lt;li&gt;I was still gone on my Wife&amp;rsquo;s birthday&lt;/li&gt;
&lt;li&gt;I wasn&amp;rsquo;t able to attend any sessions because of a focus group I was attending during the day.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Granted, the Summit alone wasn&amp;rsquo;t to blame for 1 and 2 because 3 would have had me in Redmond regardless, but missing the sessions was a heartbreaker for me. It&amp;rsquo;s an opportunity to interact with the product groups and give a lot of feedback and input on the direction they should take for next revs of the products. I can point to two features in Silverlight 4 that I can literally say &amp;ldquo;That was my idea.&amp;rdquo; from my participation in last year&amp;rsquo;s Summit.&lt;/p&gt;
&lt;p&gt;DESPITE missing all of the sessions at the Summit, I can still tell you that I would go again in a heartbeat and here is why. I decided that I would fly the red eye on Friday so that I could participate in the side sessions during the day. I ended up&amp;hellip;losing interest in the morning keynote and went to the lobby and pulled out the laptop to do some hacking. During a break to &amp;ldquo;get some fresh air&amp;rdquo; I met an Exchange MVP who mentioned that he had an idea for some software leveraging Exchange Web Services but that he wasn&amp;rsquo;t a developer so hasn&amp;rsquo;t had the time to do anything about it. I listened to his idea and it sounded very interesting. So I asked if he had time and would like to tinker with it.&lt;/p&gt;
&lt;p&gt;Two hours later (would have been much quicker if I hadn&amp;rsquo;t screwed up my Hyper-V configuration&amp;hellip;need to remember to blog that experience so that if I bump into it again, I know how to resolve it much more quickly), I&amp;rsquo;ve got an Exchange server configured for development and the core design of the solution. In addition working on that solution provided some ideas that would be useful in another project.&lt;/p&gt;
&lt;p&gt;This is why I love the MVP program. It brings the most knowledgeable people about Microsoft&amp;rsquo;s products under one umbrella. Learning Exchange on my own would have probably taken me about a week to get it installed. Having an Exchange MVP helped me boil that effort down to about 30 minutes. It probably would have been quite a while before I had enough experience with Exchange before I would have thought of a similar idea independently.&lt;/p&gt;
&lt;p&gt;On the other side my new associate who had little recent programming experience gained an &amp;ldquo;expert&amp;rdquo; who could help make his vision reality in short order&amp;hellip;in fact we already have a simple internal solution in place, the next step is to make it &amp;ldquo;user friendly&amp;rdquo;(I&amp;rsquo;ve heard this is an important feature for commercial products).&lt;/p&gt;
&lt;p&gt;What this anecdote demonstrates (and I have a few others from the week)&amp;nbsp; is a benefit that far outweighs any other that the program offers (although I&amp;rsquo;ll take those too thank you very much), being able to easily network with recognized community leaders in technology. Think of it like Voltron, individually the lions are powerful, combined they can slay any beast with a single slash of the blazing sword.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=5894" width="1" height="1"&gt;</description><category domain="http://azurecoding.com/blogs/brownie/archive/tags/startup/default.aspx">startup</category><category domain="http://azurecoding.com/blogs/brownie/archive/tags/MVP/default.aspx">MVP</category><category domain="http://azurecoding.com/blogs/brownie/archive/tags/Personal+Development/default.aspx">Personal Development</category></item><item><title>Make Cheap Software or Make Software Cheap</title><link>http://azurecoding.com/blogs/brownie/archive/2010/02/23/make-cheap-software-or-make-software-cheap.aspx</link><pubDate>Tue, 23 Feb 2010 11:35:00 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:5862</guid><dc:creator>Mike Brown</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;I came across two interesting items on the web today. The first was &lt;a href="http://bit.ly/cxrVq2" target="_blank"&gt;Rocky Lhotka’s mCSLA series&lt;/a&gt; in which he presents a DSL over CSLA. I know, I know but let’s put our opinions about CSLA aside and look at the really important point. Here is a sample of Rocky’s DSL&lt;/p&gt;  &lt;p&gt;&lt;font face="Arial"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;pre&gt;Object Customer in Test
{
    Allow Create{“Clerk”};
    Allow Edit{“Clerk”};
    Allow Delete{“Clerk”};

    Public ReadOnly int id;
    Public string Name{
        Allow Write {“Clerk”};
        Rule StringRequired;
        Rule StringMaxLength{50};
    }
} Identity Id;&lt;/pre&gt;

  &lt;p&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Altogether, about 10 significant lines of code written. I’m going to let that simmer for a while and move to the second post of interest. This time from &lt;a href="http://blog.objectmentor.com/articles/2010/02/01/software-on-the-cheap" target="_blank"&gt;Uncle Bob&lt;/a&gt;. In this post, Uncle Bob points out that it costs about $11 per SLOC and points to a sample line of code:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;code&gt;StringBuffer nameBuffer = new StringBuffer();&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So let’s look back at Rocky’s code (and I highly recommend watching the video). There’s a helluva lot more embedded in Allow Create{“Clerk”} than in StringBuffer nameBuffer=new StringBuffer();&lt;/p&gt;

&lt;p&gt;That one line:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Tells Rocky’s framework to give the “Clerk” role permission to create a Customer object&lt;/li&gt;

  &lt;li&gt;Wires up the UI (although very rudimentary) to create a new Customer&lt;/li&gt;

  &lt;li&gt;Handles all the plumbing to save the Customer to the database&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On top of all this, the code is generated CONSISTENTLY. So you don’t have to worry whether Uncle Bob remembered to dispose of his database connection, because once you program the framework to handle it, that’s the way it’s done. I would guess that each of those bullets would take an average of 7 lines of code to write by hand (that’s not even counting unit tests). 21 lines of code replaced by one. If this doesn’t sell the value of software factories to you, I don’t know what will.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=5862" width="1" height="1"&gt;</description></item><item><title>Accounting for Cost of Sales with Currying</title><link>http://azurecoding.com/blogs/brownie/archive/2010/01/18/accounting-for-cost-of-sales-with-currying.aspx</link><pubDate>Mon, 18 Jan 2010 14:00:00 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:5631</guid><dc:creator>Mike Brown</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;I have a quick question for you. If you’re selling a widget for $100 and the local sales tax is 8%, how much should you add to the cost of the item to cover the sales tax? If you said $8 or 8%, you’re losing money. To the tune of 64 cents a sale. (Do the math, 8% of 108 is $8.64.) &lt;/p&gt;  &lt;p&gt;What’s 64 cents you ask? Over a hundred sales it’s $64, over a thousand it’s $640. And over a million sales it’s $640 thousand dollars! Granted, in the process of losing that 640 thousand dollars, you’ve made $108 Million in pre-tax revenue. But more than half a million dollars in lost profit is nothing to scoff at either. But that’s what every POS system out there does. I’ve just checked in the code for Azure POS (the Silverlight/.NET 4/Azure exemplar I’m developing for my Mix content submission) that does it right. The functionality gave me a good opportunity to demonstrate simulated currying in C#.&lt;/p&gt;  &lt;h3&gt;&lt;strong&gt;Indian Food, Lambdas, and Sales Tax&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;Currying is a feature of most purely functional languages (named after Haskell Curry) whereby a function that takes two parameters is transformed into two functions, the first function takes the first parameter and returns the second which takes the second parameter and returns the result. In fact most functional languages, multi-parameter functions are at their core represented just as that. To clarify let’s look at declaring a multi-parameter function in F#:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;let applyTax(taxRate:double) (amount:double)     &lt;br /&gt;&amp;#160; //insert computation here and return result (declared as a double      &lt;br /&gt;&amp;#160; result;;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;In C# this is equivalent to&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;public double applyTax(double taxRate, double amount)&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Well not really. There’s a significant difference between the two and this is where currying comes in. The declaration in F#, when entered into the F# Interactive will give the following output:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;val applyTax : double-&amp;gt;double-&amp;gt;double&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This is read as “the value applyTax is a function that takes a double that returns a function that takes a double that returns a double.” So for instance if you know the tax rate (say .08) you can pass it to applyTax and have a handle to a function that will take the amount and apply an 8% tax to it. F# is pretty cool like that. &lt;/p&gt;  &lt;h3&gt;&lt;/h3&gt;  &lt;h3&gt;&lt;/h3&gt;  &lt;h3&gt;Getting Func&amp;lt;e&amp;gt; With It&lt;/h3&gt;  &lt;p&gt;So how can we do that in C#? Simply make an overload of ApplyTax that returns a func&amp;lt;double,double&amp;gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;public func&amp;lt;double,double&amp;gt; ApplyTax(double taxRate)     &lt;br /&gt;{      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; return (amount)=&amp;gt;{ApplyTax(taxrate,amount);}      &lt;br /&gt;}&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Now I can create variables for the different tax rates at my various retail stores&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;var applyCookCountyTax = ApplyTax(.10);     &lt;br /&gt;var applyLakeCountyTax = ApplyTax(.08);&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This is the plight of retailers in the Chicagoland area. There is a 10% sales tax in Cook county. That means you’re paying $20 more to buy a $1000 TV in Cook County than in Lake County and retailers close to the county line lose sales to this disparity. In reality you’d probably store the functions in a Dictionary rather than holding them in individual variables.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;var taxAmount = store.TaxTable[“Cook”](100);     &lt;br /&gt;//taxAmount =8.70&lt;/p&gt; &lt;/blockquote&gt;  &lt;h3&gt;The Secret Sauce&lt;/h3&gt;  &lt;p&gt;The solution to the question is simple algebra let x equal the amount of the sale and z be the tax rate you need to find y such that when x and y are added, multiplied by z and subtracted from their sum you get x.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;x+y – z(x+y) = x     &lt;br /&gt;x+y – zx – zy = x      &lt;br /&gt;y-zy = zx&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Given x and z solving for y is trivial. Now you can wear a smug smile when you make a purchase at Best Buy knowing that you’re not footing the bill for sales tax. That is until you realize that the REAL sales tax is the markup they add over their wholesale price for that TV you just bought.&lt;/p&gt;  &lt;h3&gt;Extra Credit&lt;/h3&gt;  &lt;p&gt;Wes Dyer has an &lt;a href="http://blogs.msdn.com/wesdyer/archive/2007/01/29/currying-and-partial-function-application.aspx" target="_blank"&gt;interesting post&lt;/a&gt; about simulated currying in C# on his blog. Also I’d imagine that using dynamics it might be possible to declare a base class that auto curries any functions declared in &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=5631" width="1" height="1"&gt;</description><category domain="http://azurecoding.com/blogs/brownie/archive/tags/Software+Engineering/default.aspx">Software Engineering</category><category domain="http://azurecoding.com/blogs/brownie/archive/tags/Functional+Programming/default.aspx">Functional Programming</category></item><item><title>The Pomodoro Technique</title><link>http://azurecoding.com/blogs/brownie/archive/2010/01/11/the-pomodoro-technique.aspx</link><pubDate>Mon, 11 Jan 2010 13:00:00 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:5584</guid><dc:creator>Mike Brown</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;I was going to talk about how my digital cleanse reminds me of a macro scale Pomodoro. Then I realized that I never really talked about the &lt;a href="http://www.pomodorotechnique.com"&gt;Pomodoro Technique&lt;/a&gt;. The Pomodoro Technique is a method for getting organized and being focused. It is a time management system created by Franesco Cirillo. I&amp;rsquo;m going to let him tell you how he came up with the concept:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;One day in the classroom on campus where I used to study, I watched my classmates with a critical eye, and then looked even more critically at myself: how I got myself organized, how I interacted with others, how I studied. It was clear to me that the high number of distractions and interruptions and the low level of concentration and motivation were at the root of the confusion I was feeling.&lt;/p&gt;
&lt;p&gt;So I made a bet with myself, as helpful as it was humiliating: &amp;ldquo;Can you study &amp;ndash; really study - for 10 minutes?&amp;rdquo; I needed objective validation, a Time Tutor, and I found one in a kitchen timer shaped like a pomodoro (the Italian for tomato) &amp;ndash; in other words, I found my &amp;ldquo;Pomodoro&amp;rdquo;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;!--more--&gt;
&lt;p&gt;So the basic concept is to take a block of time and devote it solely to a single task. Rather than saying &amp;ldquo;I&amp;rsquo;ll work on this task until it&amp;rsquo;s done&amp;rdquo; you say &amp;ldquo;I&amp;rsquo;m going to work on this task and ignore all distractions for X minutes. Then I will stop for a quick break. And work on it for another X minutes&amp;rdquo; The key to the Pomodoro is working within a box of time and then stopping to integrate what you&amp;rsquo;ve done up to that point. The break is just as important as the time box. Taking a break allows you to evaluate what you&amp;rsquo;ve done on the task up to this point. Cirillo recommends 25 minute time boxes with a 5 minute break.&lt;/p&gt;
&lt;h3&gt;Dealing with Interruptions&lt;/h3&gt;
&lt;p&gt;Invariably, when working on something, an interruption will occur. Someone will stop by your desk, your phone will ring, an IM will pop up, an email will arrive in your inbox, or your twitter client will chirp to alert you to a new tweet. Some of these can be avoided altogether turn off alerts for email and twitter; set your phone to DnD (send straight to voicemail or mute the ringer if you don&amp;rsquo;t have built in DnD); set your IM client not to disrupt you (use trillian to provide a nice auto-response saying you&amp;rsquo;re busy to help avoid offending someone who feels you&amp;rsquo;re ignoring them); and close your office door. Don&amp;rsquo;t have an office door you say. It&amp;rsquo;s still possible to address that issue. Just look at your timer and say &amp;ldquo;I&amp;rsquo;m busy right now can I get back to you in X minutes&amp;rdquo; and put your headphones back on that obviously didn&amp;rsquo;t provide a big enough hint that you didn&amp;rsquo;t want to be disturbed.&lt;/p&gt;
&lt;p&gt;The standing rule is that if you can address the interruption within 15 seconds, you haven&amp;rsquo;t invalidated your Pomodoro.&lt;/p&gt;
&lt;h3&gt;&lt;/h3&gt;
&lt;h3&gt;That Five Minute Break&lt;/h3&gt;
&lt;p&gt;Remember that co-worker that tapped you on your shoulder 15 minutes ago? Follow up with him. Check your email, look at twitter, look up the name of that class that you needed to use for the matrix transform, take a five minute stroll around the office, get some water, go take a bathroom break. Do whatever it is you need to do just STOP WORKING ON WHAT YOU WERE DOING!&lt;/p&gt;
&lt;h3&gt;Multi-Pomodoro Tasks&lt;/h3&gt;
&lt;p&gt;No one is telling you to break down your tasks so that they all fit within a single Pomodoro. That&amp;rsquo;s as crazy as a soup sandwich. What the time box allows you to do is switch contexts if need be. Say the annoying co-worker (who sent an Email, IM, and Voice Message within the 25 minutes but still didn&amp;rsquo;t get the hint) alerts you that the client wants the header to be Teal instead of lime green and they need that update within the next hour (&amp;ldquo;make it 45 minutes since the hour started when I came to your desk&amp;rdquo;). You can reprioritize and use the next Pomodoro to make the lime green header teal.&lt;/p&gt;
&lt;h3&gt;The Activity Inventory&lt;/h3&gt;
&lt;p&gt;So how do you get these tasks? Just like lean and agile software development processes use a backlog for tasks that aren&amp;rsquo;t currently being performed, the Pomodoro technique uses an activity inventory. In addition because of the fine grained nature of Pomodoro there is a more localized activity inventory sheet: To Do Today. It&amp;rsquo;s just like it sounds, it contains the activities that you plan to do today. When a task arises (for instance that lime green header switch) add it to the appropriate activity inventory. For something that must be done today add it to the bottom of the to do today inventory. For something that can wait until another day put it in the general activity inventory.&lt;/p&gt;
&lt;h3&gt;&lt;/h3&gt;
&lt;h3&gt;A Lot More to It&lt;/h3&gt;
&lt;p&gt;Those are the basics, but there&amp;rsquo;s a lot more to the Pomodoro Technique. A key point to the technique is to eliminate interruptions. It gets easier with time. Practically everyone I&amp;rsquo;ve spoken to who uses the technique has marveled at how much more productive they have become. Just as important to the boxed time of focus is the break. The break allows you to &amp;ldquo;integrate&amp;rdquo; what you&amp;rsquo;ve done. Take a breather and note your progress. Think of it as a waking nap. As you advance the technique helps you go from recording how long tasks take in terms of Pomodori to estimating how many Pomodori a task will take. There are even practices to allow you to measure estimates against actuals and adjust your future estimates accordingly. In other words, it allows you to gauge you personal velocity.&lt;/p&gt;
&lt;h3&gt;Back to the Digital Cleanse&lt;/h3&gt;
&lt;p&gt;On a larger scale, my digital cleanse is like my break between Pomodori. It allows me to remove myself from my day to day and take a quick breath. I liked it so much that I will be starting each month with a DC. Looking at &lt;a href="http://azurecoding.net/blogs/brownie/archive/2010/01/08/welcome-to-2010.aspx"&gt;all I did with my last one&lt;/a&gt;, who knows what will happen this round.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=5584" width="1" height="1"&gt;</description></item><item><title>Welcome to 2010</title><link>http://azurecoding.com/blogs/brownie/archive/2010/01/08/welcome-to-2010.aspx</link><pubDate>Fri, 08 Jan 2010 13:55:00 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:5545</guid><dc:creator>Mike Brown</dc:creator><slash:comments>3</slash:comments><description>&lt;p&gt;Yes I know I’ve already posted twice on here this year (more on that later). But this is my first post coming out of my &lt;a href="http://jhnmyr.tumblr.com/post/308807536/the-one-week-digital-cleanse" target="_blank"&gt;Digital Cleanse&lt;/a&gt;. What did I do in that week away from twitter, facebook, and all the tech “news” sites like engadget, joystiq, etc.?&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Incorporated a company &lt;/li&gt;    &lt;li&gt;Finished the second book of the Icewind Dale Trilogy (I started reading that book 3 years ago and was only on the third chapter) &lt;/li&gt;    &lt;li&gt;Designed two inventions…one of which I will perform a patent search and if it’s clear file a patent &lt;/li&gt;    &lt;li&gt;Wrote high level visions of seven software products two of which I am combining into a single solution and developing &lt;/li&gt;    &lt;li&gt;Spent quality time with my girls every evening. &lt;/li&gt;    &lt;li&gt;Lost 12 pounds &lt;/li&gt;    &lt;li&gt;Got more organized &lt;/li&gt;    &lt;li&gt;Got my MVP Award renewed (this wasn’t the result of anything I did this week but rather over the course of last year) &lt;/li&gt;    &lt;li&gt;Reconnected with my network &lt;/li&gt;    &lt;li&gt;Celebrated my Grandmother in law’s 85th birthday. &lt;/li&gt;    &lt;li&gt;Posted twice to my blog in one week. (Three times if you count today). &lt;/li&gt;    &lt;li&gt;A few other things I’m not allowed to mention. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;All in all it’s been an INCREDIBLE week. I’ve never felt so energized before. And there’s only more to come.&lt;/p&gt;  &lt;h4&gt;What I Learned&lt;/h4&gt;  &lt;p&gt;&lt;a href="http://azurecoding.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/brownie/image_5F00_01D0A9F9.png"&gt;&lt;img style="border-right-width:0px;margin:5px 10px 5px 0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" border="0" alt="image" align="left" src="http://azurecoding.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/brownie/image_5F00_thumb_5F00_64B713BC.png" width="324" height="247" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;By forcing myself to forgo twitter and facebook and essentially “mindless” browsing, my mind had to fill the void somehow. It craved the stimulus that constant updates and bite sized nuggets of news used to provide. Fortunately, just before Christmas, I purchased a bunch of &lt;a href="http://piccadillyinc.com" target="_blank"&gt;Piccadilly notebooks&lt;/a&gt;. I know &lt;a href="http://www.moleskine.com" target="_blank"&gt;Moleskines&lt;/a&gt; are all the rage, but I have a frugal mindset right now and these guys were heavily discounted at Barnes and Nobles. But I did see a &lt;a href="http://www.moleskine.com/catalogue/diariesplanners/12_month_daily/" target="_blank"&gt;really nice day planner Moleskine&lt;/a&gt; that caught my eye, I passed on it. One I selected to be my idea book (a soft covered ruled small notebook), another my journal and meeting note taking book (hard covered small graph paper), and a third is my design book (hard covered large graph paper). I feel naked without them. The first one that makes a &lt;a href="http://pomodorotechnique.com" target="_blank"&gt;Pomodoro&lt;/a&gt; notebook has a customer for life.&lt;/p&gt;  &lt;p&gt;I bought some extras for my wife as well and showed her the pocket in the back where she can stuff all the receipts she likes to collect. She’s sticking with her other notebooks for the time being. But she does comment when she notices me opening my notebook “Uh-oh he’s pulling out the Piccadilly.”&lt;/p&gt;  &lt;p&gt;I’ve decided that going forward, I will confine my usage of twitter to a set time each day. Facebook, it’ll be relegated to pure casual time. There’s not much there for me business wise. Most of my business socializing is through linkedin or Twitter. I’ve never really done the myspace or any of the other pure “social web” sites. Frankly, I don’t have the time.&lt;/p&gt;  &lt;p&gt;Right now, I look at my time as an investment that is worth more than money. If I’m not doing something that gives me a return on that investment, I damn sure better enjoy it. Twitter in moderation is a good investment. Spending all day checking out your tweet stream isn’t (not that I really did that, but I spent more time than I care to mention with twitter open and having it closed for seven days made it patently obvious that there are better things that I can do with my time.&lt;/p&gt;  &lt;p&gt;What did you do with your Digital Cleanse? If you didn’t do one, what are you waiting for?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=5545" width="1" height="1"&gt;</description></item><item><title>The Duct Tape Programmer Revisited</title><link>http://azurecoding.com/blogs/brownie/archive/2010/01/07/the-duct-tape-programmer-revisited.aspx</link><pubDate>Thu, 07 Jan 2010 13:25:31 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:5541</guid><dc:creator>Mike Brown</dc:creator><slash:comments>2</slash:comments><description>&lt;p&gt;Not too long ago, &lt;a href="http://azurecoding.net/blogs/brownie/archive/2009/09/30/i-want-to-be-a-duct-tape-programmer.aspx" target="_blank"&gt;I responded&lt;/a&gt; to the reaction that many had to Joel Spolsky’s article “&lt;a href="http://www.joelonsoftware.com/items/2009/09/23.html" target="_blank"&gt;The Duct Tape Programmer&lt;/a&gt;”. My belief still remains that people missed the point due to the unfortunate titling (as well as the severe dating of the technologies mentioned). I think it might make the meaning of “duct tape programmer” more apparent to contrast the duct tape programmer with his antithesis: the bright shiny guy. And what better way to do that than with a case study: 3D Realms and Duke Nukem Forever.&lt;/p&gt;  &lt;p&gt;Now for those who don’t know, Duke Nukem Forever was originally announced in 1997 as the follow up to wildly successful Duke Nukem 3D. How successful you ask? Duke Nukem 3D was self-published by 3D Realms and sold around 3.5 million copies. It doesn’t take a rocket scientist to realize that 3D Realms was sitting on a boatload of money. And therein lies the problem. Because 3D Realms was self financing development of Prey (which finally saw release a few years ago) and Duke Nukem Forever, they had full control over time and budget. 12 years later, 3D Realms threw in the towel and closed their doors.&lt;/p&gt;  &lt;p&gt;The tragic thing is that Duke Nuke Forever had been “completed” five times over in those 12 years. Unfortunately just as they should have been marching toward development, George Broussard would see a new “must have” feature for Duke Forever demonstrated in a new engine. Instead of passing on that bright shiny object for this time and pushing on to release, he would have the team rebuild the game on the new engine. There are at least 4 documented instances of this occurring.&lt;/p&gt;  &lt;p&gt;And that my friends is the difference between Joel’s Duct Tape Programmer and the Bright Shiny Guy. The duct tape programmer doesn’t give a damn about that new high resolution snowflake modeling, he wants to ship the product so he can start the next version using the high res snowflakes. That is why I wanted to be the Duct Tape Programmer. You go ahead and use products that are barely released on your enterprise critical system. I’ll use the tools that I’m familiar with. You can argue that the new stuff is sexy. What’s really sexy to me is shipping a product. &lt;/p&gt;  &lt;p&gt;And in the end that’s what our job really is. Just ask the &lt;a href="http://www.wired.com/magazine/2009/12/fail_duke_nukem" target="_blank"&gt;former developers at 3D Realms&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=5541" width="1" height="1"&gt;</description></item><item><title>RIAlity TV</title><link>http://azurecoding.com/blogs/brownie/archive/2010/01/01/riality-tv.aspx</link><pubDate>Fri, 01 Jan 2010 21:51:00 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:5469</guid><dc:creator>Mike Brown</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;I am creating a video blog designed as a reality TV show called RIAlity TV. (Actually I&amp;#39;m designing it to be a Channel of RIAlity shows). The first show called &amp;quot;The Project Room:Catching the Wave&amp;quot; will document creating a software product from start to finish using the .NET 4 stack top to bottom. &lt;/p&gt;
&lt;p&gt;Silverlight 4&lt;/p&gt;
&lt;p&gt;MEF&lt;/p&gt;
&lt;p&gt;WCF RIA Services&lt;/p&gt;
&lt;p&gt;Entity Framework v2&lt;/p&gt;
&lt;p&gt;Windows Azure&lt;/p&gt;
&lt;p&gt;SQL Azure&lt;/p&gt;
&lt;p&gt;The project will be a Point of Sale system (AzurePOS) designed based on the first example from &lt;a href="http://www.amazon.com/Object-Models-Strategies-Patterns-Applications/dp/0138401179"&gt;Peter Coad&amp;#39;s Object Modeling book&lt;/a&gt;. The goal is to have a V1 project ready to launch at Mix10. I&amp;#39;ve submitted a session to the open call for proposals. I&amp;#39;ll recap the season and launch AzurePOS on stage. I&amp;rsquo;m looking for people interested in joining the fun. Right now I can use the help from people who can fill the following roles:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;UI Designer:&lt;/strong&gt; Take a concept and make it reality. Experience with Blend and Sketchflow is a plus. Integrator skills are a huge plus! We&amp;#39;re going to put the Developer-Designer workflow through its paces. HTML/CSS/Javascript experience is good as well. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;UI Developer/Integrator:&lt;/strong&gt; Work with the designer to bring their vision into the application. Experience with Blend or a crazy XAML skills are a MUST. In addition experience with HTML/CSS/AJAX is helpful. The person in this role should be comfortable with the View Model pattern. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Backend Developer:&lt;/strong&gt; A heads down C# coder who understands good Object Oriented Design. Knowledge of Entity Framework a plus. Experience with RIA Services a HUGE plus. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Web Developer:&lt;/strong&gt; In addition to the main project, there will be some development needed for the RIAlity TV website. ASP.NET MVC 2 is the weapon of choice.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Web Content Manager:&lt;/strong&gt; There&amp;rsquo;s a lot of content that needs to be edited for the site, experience with video editing is a plus.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If this sounds interesting to you, send me an email (mike.brown at azurecoding dot net) with a subject line &amp;ldquo;RIAlity TV&amp;rdquo;. There&amp;#39;s a lot of information that I don&amp;#39;t want to share publicly but at the very least this will be an opportunity to demonstrate your skills before an audience. I want to have the first episode in the can in time for voting (January 5-15). I&amp;rsquo;ll explain all privately.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Update:&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The sessions are up on the mix site for voting, if you want to see it, add &lt;a target="_blank" href="http://visitmix.com/opencallvote/Ballot?voteFor=CATCHT041"&gt;my session to your ballot&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=5469" width="1" height="1"&gt;</description></item><item><title>What is “Lean”</title><link>http://azurecoding.com/blogs/brownie/archive/2009/12/21/what-is-lean.aspx</link><pubDate>Mon, 21 Dec 2009 07:06:40 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:5294</guid><dc:creator>Mike Brown</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;This one comes from the Lean Startup Circle again. Someone posed the question what is the difference (if any) between capital ‘L’ “Lean” and “lean”. Having had the opportunity to attend a &lt;a href="http://www.agilemanagement.net/" target="_blank"&gt;David Anderson&lt;/a&gt; presentation on the subject of &lt;a href="http://en.wikipedia.org/wiki/Lean_software_development" target="_blank"&gt;Lean Software Development&lt;/a&gt;, I was sufficiently armed to talk about the subject. Hopefully, I did justice by my instructor but any errors, omissions, or brute handed oversimplifications are purely my own fault. The summary follows. I’ve fleshed out the original email (that I wrote on my G1) to add more background and information.&lt;/p&gt;  &lt;p&gt;To understand the origins of “&lt;a href="http://en.wikipedia.org/wiki/Lean_manufacturing" target="_blank"&gt;Lean&lt;/a&gt;” we need to look at Toyota, for they are the originators of the Toyota Production System which was later referred to as Lean Manufacturing.&lt;/p&gt;  &lt;p&gt;Do a quick search on &amp;quot;&lt;a href="http://www.google.com/search?q=what+we+can+learn+from+toyota&amp;amp;sourceid=ie7&amp;amp;rls=com.microsoft:en-us:IE-SearchBox&amp;amp;ie=&amp;amp;oe=" target="_blank"&gt;what we can learn from Toyota&lt;/a&gt;&amp;quot;. You&amp;#39;ll come up with a lot of interesting information. For example, guess how many of Toyota&amp;#39;s American employees were laid off over the past decade? Past 20 years? 30? 40? Would you believe that they haven&amp;#39;t had a &lt;a href="http://www.leanblog.org/2009/01/report-toyotas-first-layoffs-since-1950.html" target="_blank"&gt;single round of layoffs in half a century&lt;/a&gt; (the layoff referenced in the previous link was &lt;a href="http://www.reuters.com/article/idUSTRE51G0WE20090217" target="_blank"&gt;averted&lt;/a&gt;)? We worry so much about preserving &amp;quot;American companies&amp;quot; when in reality Toyota employees more American workers and treats their employees with far greater respect than any of the big three. Rather than laying employees off during thin times they move them to other plants for training and improving their infrastructure (as the Reuters link mentioned, Toyota even went so far as to pay plant workers in San Antonio their FULL SALARY while the lines were shut down). Thus when times are better they have a workforce already trained to face the new challenges of the company.&lt;/p&gt;  &lt;p&gt;That’s fine and dandy you may say but what does this have to do with “Lean”? Everything! Toyota’s success goes far beyond their manufacturing processes. It is the entire philosophy at Toyota that still persists to this day even as the largest auto maker in the world. This philosophy can be embodied in one word “&lt;a href="http://en.wikipedia.org/wiki/Kaizen" target="_blank"&gt;Kaizen&lt;/a&gt;”. The idea is to make everybody responsible for improving the process instead of dictating how things are done based on theory or “because that’s how we’ve always done things”. To put it simply who is more qualified to identify a better way of laying bricks: the guy baking in the sun who wants to get his work done and doesn’t want to have to fix that section of the wall later; or the manager who hasn’t picked up a trowel in years. &lt;a href="http://en.wikipedia.org/wiki/Frank_Bunker_Gilbreth,_Sr." target="_blank"&gt;Frank Gilbreth&lt;/a&gt;, considered the father of Business Process Management based his life’s work answering that very question. Anyway, that’s another post of it’s own we’re talking about the Kaizen philosophy. Enable…correction…encourage employees to take ownership of their work, and opportunities for improved quality AND efficiency will naturally be injected into your process.&lt;/p&gt;  &lt;p&gt;Let’s shift gears from Kaizen and talk about Lean Manufacturing. Toyota&amp;#39;s approach came from necessity. They had to compete overseas against entrenched competition. There was no way they could establish a dealer network AND a service chain rapidly enough to compete. The solution? Make cars that didn&amp;#39;t fail as much. Rather than cut corners to produce cars as rapidly (and cheaply) as possible, they spent the time to make sure they released a quality product that didn&amp;#39;t require as much maintenance. There&amp;#39;s a reason Toyota has a reputation for making long lasting vehicles...they couldn&amp;#39;t afford to do otherwise.&lt;/p&gt;  &lt;p&gt;In the same regard, Toyota couldn&amp;#39;t afford to pump out cars continuously or build up a large inventory of materials. Thus they devised a system called &lt;a href="http://en.wikipedia.org/wiki/Kanban" target="_blank"&gt;Kanban&lt;/a&gt; to control the flow of supplies. The concept was adopted from observing grocery stores. A grocer can only stock as much product as he thinks his customers will purchase before it spoils or else he wastes the product (and the money spent to purchase it).    &lt;br /&gt;Toyota applied this just in time supply to their manufacturing process. And thus Lean manufacturing was born allowing Toyota to go from an upstart foreigner to the largest auto manufacturer in the US. It was a commitment to quality, process, and most importantly PEOPLE that made this possible.&lt;/p&gt;  &lt;p&gt;Make no mistake, applying Lean processes alone is not enough to ensure success. You need the right people as well and you need to engender a system of trust and excellence. You need to truly commit to the the principles. Otherwise you&amp;#39;re just falling into the &lt;a href="http://en.wikipedia.org/wiki/Cargo_cult" target="_blank"&gt;cargo cult mentality&lt;/a&gt;. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=5294" width="1" height="1"&gt;</description><category domain="http://azurecoding.com/blogs/brownie/archive/tags/startup/default.aspx">startup</category><category domain="http://azurecoding.com/blogs/brownie/archive/tags/Lean/default.aspx">Lean</category><category domain="http://azurecoding.com/blogs/brownie/archive/tags/Kanban/default.aspx">Kanban</category></item><item><title>Stealth Disease</title><link>http://azurecoding.com/blogs/brownie/archive/2009/12/19/stealth-mode-startups.aspx</link><pubDate>Sat, 19 Dec 2009 19:03:00 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:5274</guid><dc:creator>Mike Brown</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;I am a member of the &lt;a href="http://groups.google.com/group/lean-startup-circle"&gt;Lean Startup Circle group&lt;/a&gt; (was searching for the Lean Software Group which I still haven&amp;rsquo;t found). The conversations there are amazing and I highly recommend joining if you&amp;rsquo;re remotely interested in entrepreneurship (becoming one, helping one, or finding one). Anyway, a fellow group member referenced &lt;a href="http://www.techcrunch.com/2009/12/19/stealth-startupsget-over-yourselves-nobody-cares-about-your-secrets/"&gt;Eric Ries&amp;rsquo; recent interview with tech crunch&lt;/a&gt; where he states plain and simple that you&amp;rsquo;re doing yourself a disservice by having a long term &amp;ldquo;stealth mode&amp;rdquo; for your startup. It prompted me to reply as follows:&lt;/p&gt;
&lt;p&gt;I think that [keeping your idea a secret] is the first thing to get over as a startup. I see so many people saying, &amp;quot;I&amp;#39;ll tell you what I&amp;#39;m doing after you sign an NDA.&amp;quot; I&amp;#39;m sorry, I&amp;#39;m not doing that because I might already have the same idea or a similar one and I&amp;#39;m not going to preclude myself from executing on that idea because you might argue I&amp;#39;ve stolen it from you down the road.&lt;/p&gt;
&lt;p&gt;Unless you&amp;#39;re talking about some really deep technology that REALLY pushes the bounds of what we do (think Project Natal from Microsof), you most likely aren&amp;#39;t the only one doing what you&amp;#39;re doing. In fact unless you can name five competitors in your space, you should stop what you&amp;#39;re doing and find them. If you are on the lines of Natal, why the hell haven&amp;#39;t you filed a patent to protect your work?&lt;/p&gt;
&lt;p&gt;The sooner you get a working product that your users can play with. The sooner you can get feedback and in many cases ideas that will significantly improve your product. Going stealth I would argue is a Waterfall startup (opposite of Lean). Think about it in terms of software development. With Lean (or agile) one primary goal is to get a working application in front of your stakeholders quickly so that they can provide feedback as the application is evolving, it avoids the problem of spending a year working on a project only to get feedback at the end from the customer that you totally missed the mark.&lt;/p&gt;
&lt;p&gt;If you want to kill a startup, the quickest way is to spend a year developing a product that no one wants because you were in &amp;quot;stealth mode&amp;quot;. Especially when your competitor announced their product before it was even available, got feedback on the alpha a week later, and adjusted the trajectory for the beta a month later all the while building a huge viral buzz from previewers who &amp;quot;get the vision&amp;quot; and like it. By the time you&amp;#39;ve announced a product your competitor has beat you to market without you even knowing they exist.&lt;/p&gt;
&lt;p&gt;By letting people know what you&amp;#39;re doing, you&amp;#39;re likely to get a lot of feedback that you&amp;#39;d pay a lot of money to get otherwise. Such as &amp;quot;this reminds me of...[insert competitor you didn&amp;#39;t know of]&amp;quot; or &amp;quot;I&amp;#39;m building something similar, want to team up to make a unified product&amp;quot; or &amp;quot;I like [feature x] but I really wish I could do it by [method y]&amp;quot;. All of this feedback can be used to help you adjust your launch trajectory &amp;quot;how can I improve [competitor x&amp;#39;s] product&amp;quot;, &amp;quot;this guy has a great foundation this would make my product better to integrate our solutions&amp;quot;, &amp;quot;it will be simple to add that new method for achieving feature x&amp;quot; to provide a product that better meets your users&amp;#39; needs.&lt;/p&gt;
&lt;p&gt;That&amp;#39;s the true definition of Lean. And even the largest vendors (think of Google with gMail, Wave, Android, and ChromeOS) can benefit from taking this approach.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=5274" width="1" height="1"&gt;</description><category domain="http://azurecoding.com/blogs/brownie/archive/tags/startup/default.aspx">startup</category><category domain="http://azurecoding.com/blogs/brownie/archive/tags/Lean/default.aspx">Lean</category></item><item><title>I Want to Be a Duct Tape Programmer</title><link>http://azurecoding.com/blogs/brownie/archive/2009/09/30/i-want-to-be-a-duct-tape-programmer.aspx</link><pubDate>Wed, 30 Sep 2009 21:42:35 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:3013</guid><dc:creator>Mike Brown</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;I think &lt;a href="http://ayende.com/Blog/archive/2009/09/30/duct-tape-programmers.aspx" target="_blank"&gt;people misinterpreted&lt;/a&gt; Joel Spolsky&amp;#39;s post &amp;quot;&lt;a href="http://www.joelonsoftware.com/items/2009/09/23.html" target="_blank"&gt;The Duct Tape Programmer&lt;/a&gt;&amp;quot; (not the best choice of words because of the connotations of using duct tape as a &amp;quot;temporary quick fix&amp;quot; in the developer&amp;#39;s mind) but there is one key gem to take away from it. &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&amp;quot;Shipping is a feature. A really important feature. Your product must have it&amp;quot; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;His point is the same that most of his posts say (and even &lt;a href="https://gettingreal.37signals.com/" target="_blank"&gt;what the 37Signals guys tout&lt;/a&gt;). No one gives a flying fig about how your application uses the latest programming language (or &lt;a href="http://windowsclient.net/learn/videos_wpf.aspx" target="_blank"&gt;UI engine&lt;/a&gt;). What they care about is whether your product solves their problem? &lt;/p&gt;  &lt;p&gt;You can spend all day spit shining your API to make it more SOLID, or you can say &amp;quot;the feature works, let&amp;#39;s move on to the next one&amp;quot;. In the mean time, the company down the road who knows how to get things done has shipped v1 and are getting feedback from customers for V2. &lt;/p&gt;  &lt;p&gt;He also makes the distinction between the guy who can pull this off and everyone else. This is the guy who uses techniques at which he is an expert (in the &lt;a href="http://en.wikipedia.org/wiki/Dreyfus_model_of_skill_acquisition" target="_blank"&gt;Dreyfus Model&lt;/a&gt; sense of the word)&amp;#160; to tackle the task at hand rather than saying &amp;quot;here’s this new wrench (language/Framework) let&amp;#39;s see how I can use it on this go cart (enterprise app/web browser) I&amp;#39;m working on.&amp;quot; Or to bring it home better would you prefer a surgeon performing an experimental technique on you that he watched some guy perform at a seminar last week when the one he has performed 100 times over will work just as well? That&amp;#39;s what Joel means when he says duct tape programming. It might not be made of the shiny new state of the art experimental components. But it sure as hell works like a charm.&lt;/p&gt;  &lt;p&gt;No where in the talk did he mention throwing out best practices (okay he does mention not needing unit tests but he also mentions that those were extreme circumstances). In fact he suggests what should be a new best practice: don’t use something you’re not familiar with when your ass is on the line. &lt;/p&gt;  &lt;p&gt;I know a few people I would apply the Duct Tape Programmer label to but they would be too modest to accept it. And that’s what I aspire to be.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=3013" width="1" height="1"&gt;</description><category domain="http://azurecoding.com/blogs/brownie/archive/tags/Software+Engineering/default.aspx">Software Engineering</category></item><item><title>XAML Default Button</title><link>http://azurecoding.com/blogs/icbtw/archive/2009/09/02/xaml-default-button.aspx</link><pubDate>Wed, 02 Sep 2009 14:20:00 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:2401</guid><dc:creator>David Justice</dc:creator><slash:comments>2</slash:comments><description>&lt;p&gt;I was working with a client that wanted to have a default button clicked when an enter key is pressed in a textbox (password box to be more specific) within a Silverlight or WPF application. I didn&amp;#39;t think much of it. I&amp;#39;ll just listen to the event, bind to the button, and click the button on the enter key event. The listening and binding portion is not very tough with an attached property and a little Silverlight 3 element to element binding love. The tricky part came in when I wanted to cause the button click event to be raised. I ended up having to take a page from Josh Smith&amp;nbsp;&lt;a href="http://joshsmithonwpf.wordpress.com/2007/03/09/how-to-programmatically-click-a-button/"&gt;http://joshsmithonwpf.wordpress.com/2007/03/09/how-to-programmatically-click-a-button/&lt;/a&gt;. Thank you, Josh! This may not be the best way to do this, but it works for me.&lt;/p&gt;...(&lt;a href="http://azurecoding.com/blogs/icbtw/archive/2009/09/02/xaml-default-button.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=2401" width="1" height="1"&gt;</description><category domain="http://azurecoding.com/blogs/icbtw/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://azurecoding.com/blogs/icbtw/archive/tags/WPF/default.aspx">WPF</category><category domain="http://azurecoding.com/blogs/icbtw/archive/tags/Attached+Properties/default.aspx">Attached Properties</category></item><item><title>Service Locator Revisited</title><link>http://azurecoding.com/blogs/brownie/archive/2009/08/13/service-locator-revisited.aspx</link><pubDate>Thu, 13 Aug 2009 04:18:50 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:2049</guid><dc:creator>Mike Brown</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;I guess I have awakened a slumbering giant by writing the &lt;a href="http://azurecoding.net/blogs/brownie/archive/2009/08/10/service-locator-versus-di-a-clarification.aspx" target="_blank"&gt;post the other day&lt;/a&gt;. I went back to add more functionality to the Service Locator (to enable per transaction and per thread services). Before I started breaking stuff by adding new functionality, I decided to make unit tests for the existing stuff. My first test was simple enough, register and retrieve a service from the ServiceContainer (which might need to be renamed because of a collision with System.ComponentModel.Design.ServiceContainer).&lt;/p&gt;  &lt;p&gt;[TestMethod]    &lt;br /&gt;public void CanRegisterService()     &lt;br /&gt;{     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; var dummyService = new DummyService();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ServiceContainer.RegisterService&amp;lt;IDummyService&amp;gt;(dummyService);     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; var retrievedService = ServiceContainer.GetService&amp;lt;IDummyService&amp;gt;();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Assert.IsInstanceOfType(retrievedService, typeof(IDummyService),&amp;quot;The returned service is not of the correct type&amp;quot;);     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Assert.AreEqual(dummyService,retrievedService,&amp;quot;The returned service is a different instance.&amp;quot;);     &lt;br /&gt;}&lt;/p&gt;  &lt;p&gt;Simple enough right? Let’s run it and make sure it’s green and move on…to…hey why is it failing? What happened? After a quick bit of investigation, I found that the problem lay in RegisterService overload that takes the Func:&lt;/p&gt;  &lt;p&gt;public static void RegisterService&amp;lt;TService&amp;gt;(Func&amp;lt;TService&amp;gt; creator)    &lt;br /&gt;{     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; _Container.AddService(creator);     &lt;br /&gt;}&lt;/p&gt;  &lt;p&gt;Do you see it? Maybe the implementation of AddService might make it more obvious&lt;/p&gt;  &lt;pre&gt;private void AddService&amp;lt;TService&amp;gt;(TService instance)
{
    _ServicesLock.EnterUpgradeableReadLock();
    try
    { 
        if (!_Services.ContainsKey(typeof(TService))) 
        { 
            _ServicesLock.EnterWriteLock(); 
            try 
            { 
                _Services[typeof(TService)] = instance; 
            } 
            finally 
            { 
                _ServicesLock.ExitWriteLock(); 
            } 
        } 
    } 
    finally 
    {
        _ServicesLock.ExitUpgradeableReadLock(); 
    } 
}&lt;/pre&gt;

&lt;p&gt;Because of type inference, &amp;lt;TService&amp;gt; is Func&amp;lt;TService&amp;gt; when we try to retrieve it we’re looking for TService as the key, and of course we won’t find it. So there’s a lesson to be learned here. Actually there are two. &lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;It’s the simplest of changes that open the door for the most insidious bugs (not that this bug is very insidious)&lt;/li&gt;

  &lt;li&gt;If it’s worth writing it’s worth testing. No matter how small the functionality is, you should write a test for it because when it breaks you want to know.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Anyway, now that I’ve got the tests in place for the existing functionality, I’m going to go ahead and see about implementing per transaction life management. But not tonight.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=2049" width="1" height="1"&gt;</description></item><item><title>Service Locator Versus DI – A Clarification</title><link>http://azurecoding.com/blogs/brownie/archive/2009/08/10/service-locator-versus-di-a-clarification.aspx</link><pubDate>Mon, 10 Aug 2009 17:11:00 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:2004</guid><dc:creator>Mike Brown</dc:creator><slash:comments>2</slash:comments><description>&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;For some reason Community Server decided that it doesn&amp;#39;t want to display the style for the code snippet nor the IFrame for the skydrive link. &lt;a href="http://cid-2221dc39e0c749a4.skydrive.live.com/self.aspx/WPF%20Samples/ServiceContainer.cs"&gt;Here is the final file&lt;/a&gt;. Read on for explanation of what it is and what it does.&lt;/p&gt;
&lt;p&gt;Browsing though the blog of my friend and co-work, Jon Fuller, I noticed &lt;a href="http://jonfuller.codingtomusic.com/2009/03/12/dependency-injection-and-service-location/"&gt;this post on Dependency Injection and Service Location&lt;/a&gt;. Especially interesting was this quote:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;I was having a discussion with a colleague the other day about &lt;/em&gt;&lt;a href="http://jonfuller.codingtomusic.com/2009/02/11/dealing-with-dependencies-a-presentation-on-di-and-ioc/"&gt;&lt;em&gt;DI&lt;/em&gt;&lt;/a&gt;&lt;em&gt; and &lt;/em&gt;&lt;a href="http://java.sun.com/blueprints/patterns/ServiceLocator.html"&gt;&lt;em&gt;Service Location&lt;/em&gt;&lt;/a&gt;&lt;em&gt; in the context of the question (posed by a third person):&lt;/em&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Which DI container/framework should I choose?&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;His answer:&lt;/em&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;None; just roll your own and use simple Service Location&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;It definitely sounded like I&amp;rsquo;m the colleague in question here. He then goes on to argue against my love of the &lt;a href="http://martinfowler.com/articles/injection.html#UsingAServiceLocator"&gt;Service Locator pattern&lt;/a&gt;. I think I should clarify what I meant with my statement. For reference, &lt;a target="_blank" href="http://azurecoding.net/content/ServiceContainercs.aspx"&gt;here is my code for a simple service locator&lt;/a&gt;. The usage is simple, first I register a service with the Container:&lt;/p&gt;
&lt;pre class="csharpcode"&gt;ServiceContainer.RegisterService&amp;lt;ICalculatorService&amp;gt;(&lt;span class="kwrd"&gt;new&lt;/span&gt; ConcreteCalculatorService());&lt;/pre&gt;
&lt;p&gt;

&lt;/p&gt;
&lt;p&gt;Then anyone who wants an instance of the ICalculatorService can simply ask for it:&lt;/p&gt;
&lt;pre class="csharpcode"&gt;var calc = ServiceLocator.GetService&amp;lt;ICalculatorService&amp;gt;();&lt;/pre&gt;
&lt;p&gt;This method works for a vast majority of the simple cases where you want to provide a Separation of Concerns. In most cases you don&amp;rsquo;t need advanced lifetime management (e.g. a single instance of a service will do just fine). The reason I suggested rolling their own was that I assumed from the question the person had no experience with an IOC container prior. It takes time to grok an IOC container, there are a lot of moving parts, and for a simple case, this solution works just fine. &lt;/p&gt;
&lt;p&gt;So what happens when I want to allow for more intricate cases. Like different lifecycles for service (per request, per transaction, singleton, etc). Well the choice boils down to extending/enhancing your service locator implementation, or using the Common Service Locator library in conjunction with a container of your choice. You have to decide when the cost of maintaining your own outweighs the benefits. Adding support for a per request lifecycle is simple enough as well however. Here are the changes to the Service Container that supports both a single instance and per request lifecycle:&lt;/p&gt;
&lt;pre class="csharpcode"&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; TService RetrieveService&amp;lt;TService&amp;gt;()
        {
            Func&amp;lt;TService&amp;gt; retVal;
            _ServicesLock.EnterReadLock();
            &lt;span class="kwrd"&gt;try&lt;/span&gt;
            {
                retVal = (Func&amp;lt;TService&amp;gt;)_Services[&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(TService)];
            }
            &lt;span class="kwrd"&gt;catch&lt;/span&gt; (Exception)
            {
                &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; Exception(
                   String.Format(
                      &lt;span class="str"&gt;&amp;quot;Service Type {0} not registered with container.&amp;quot;&lt;/span&gt;, &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(TService).Name));
            }
            &lt;span class="kwrd"&gt;finally&lt;/span&gt;
            {
                _ServicesLock.ExitReadLock();
            }
            &lt;span class="kwrd"&gt;return&lt;/span&gt; retVal();
        }

        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; RegisterService&amp;lt;TService&amp;gt;(Func&amp;lt;TService&amp;gt; creator)
        {
            _Container.AddService(creator);
        }

        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; RegisterService&amp;lt;TService&amp;gt;(TService instance)
        {
            RegisterService(()=&amp;gt;instance);
        }&lt;/pre&gt;
&lt;p&gt;I just added an overload to the static RegisterService method that takes a Func that returns an instance of the service, I then change the original method to call the new overload and change the private RetrieveService function to do things properly. To register per request, you now make this simple call&lt;/p&gt;
&lt;pre class="csharpcode"&gt;ServiceContainer.RegisterService&amp;lt;ICalculatorService&amp;gt;(()=&amp;gt;&lt;span class="kwrd"&gt;new&lt;/span&gt; ConcreteCalculatorService());&lt;/pre&gt;
&lt;p&gt;Using the service is the same as before Now let&amp;rsquo;s address some of Jon&amp;rsquo;s concerns regarding the alleged shortcomings of the Service Locator pattern.&lt;/p&gt;
&lt;p&gt;Some of his concern stems from the API for the service locator. (Why pass in a separate key when you already have a ready made key in the form of the service type. Also, I&amp;rsquo;m assuming the &amp;ldquo;movies.txt&amp;rdquo; is the parameter for creating an instance of the concrete IMovieFinder. Again, this is not an issue because the instance is created at registration (or using the modified version, through the creator delegate).&lt;/p&gt;
&lt;p&gt;With regards to testability, when writing a unit test it&amp;rsquo;s easy enough to configure a Service Locator to return mocks. Just register the mocks in your setup and call clear on your teardown.&lt;/p&gt;
&lt;p&gt;That leaves us with discoverability for consumers of your code. Documentation is a good place to start.&amp;nbsp; Also, to me putting the dependencies in the constructor opens the door for things like this:&lt;/p&gt;
&lt;pre class="csharpcode"&gt;var lister = 
  &lt;span class="kwrd"&gt;new&lt;/span&gt; MovieLister(
    &lt;span class="kwrd"&gt;new&lt;/span&gt; CsvMovieFinder(
      &lt;span class="kwrd"&gt;new&lt;/span&gt; AzureBlobFileRetrieval(
        &lt;span class="kwrd"&gt;new&lt;/span&gt; AzureKey(&lt;span class="str"&gt;&amp;quot;account&amp;quot;&lt;/span&gt;,&lt;span class="str"&gt;&amp;quot;secretKey&amp;quot;&lt;/span&gt;));&lt;/pre&gt;
&lt;p&gt;True this could be caught in a code review. But it can also be outright prevented by using this great thing called encapsulation. When someone creates the MovieLister that uses the ServiceLocator and debugs, they will get a nice friendly message informing them that they need to register an IMovieFinder with the service container (hopefully they know to do so in the Main() function or wherever your project does it&amp;rsquo;s container configuration).&lt;/p&gt;
&lt;p&gt;To me, there is no major detriment to using either style. Rolling your own involves dealing with maintenance of that solution, but it&amp;rsquo;s easy enough to swap it out with a third-party container once you have the need for it. &lt;a target="_blank" href="http://cid-2221dc39e0c749a4.skydrive.live.com/self.aspx/WPF%20Samples/ServiceContainer.cs"&gt;Here&amp;rsquo;s the code&lt;/a&gt; for my basic service container. A lot of other scenarios are trivial to implement here as well. And I&amp;rsquo;ll share them with you in a later post.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=2004" width="1" height="1"&gt;</description><category domain="http://azurecoding.com/blogs/brownie/archive/tags/Patterns/default.aspx">Patterns</category></item><item><title>Genetic Algorithm -- Add Ur Own Func :)</title><link>http://azurecoding.com/blogs/icbtw/archive/2009/06/29/genetic-algorithm-add-ur-own-func.aspx</link><pubDate>Mon, 29 Jun 2009 08:34:00 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:1336</guid><dc:creator>David Justice</dc:creator><slash:comments>3</slash:comments><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Hi again,&lt;/p&gt;
&lt;p&gt;I was a little bored this weekend and needed to add in some GA functionality to a side project. I felt like it would be best to create a simple executer to deal with the iterative behavior of a genetic algorithm. The&amp;nbsp;&lt;span&gt;executer&amp;nbsp;&lt;/span&gt;take in funcs provided by the consumer and executes based on a simple iterative model. Below is what I came up with. Cheers!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;...(&lt;a href="http://azurecoding.com/blogs/icbtw/archive/2009/06/29/genetic-algorithm-add-ur-own-func.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=1336" width="1" height="1"&gt;</description><enclosure url="http://azurecoding.com/cfs-file.ashx/__key/CommunityServer.Components.PostAttachments/00.00.00.13.36/GA.zip" length="45494" type="application/x-zip-compressed" /><category domain="http://azurecoding.com/blogs/icbtw/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://azurecoding.com/blogs/icbtw/archive/tags/Genetic+Algorithm/default.aspx">Genetic Algorithm</category></item><item><title>.Net 4.0 Reflection vs. Dynamics vs. Property Setting With Times</title><link>http://azurecoding.com/blogs/icbtw/archive/2009/06/26/net_5F00_4_5F00_0_5F00_reflection_5F00_vs_5F00_dynamics_5F00_vs_5F00_property_5F00_setting_5F00_with_5F00_times.aspx</link><pubDate>Fri, 26 Jun 2009 16:26:00 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:1309</guid><dc:creator>David Justice</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;
&lt;p&gt;Today I found my self hanging out after a sprint review with my partner in crime&amp;nbsp;&lt;a target="_blank" title="@sundriedcoder" href="http://twitter.com/sundriedcoder"&gt;Kevin Rohling&lt;/a&gt;. &amp;nbsp;TFS was down (not tfs&amp;#39;s fault, but some other freak accident...) and I hadn&amp;#39;t installed VS 2010 yet, so it seemed like the perfect time to do such things. I got everything up and running, and Kevin and I got into a discussion about Dynamics &amp;amp; performance. We made a quick lunch bet on which is faster, reflection or dynamics for simply setting a property. I figured reflection would be quicker, while Kevin thought dynamics would be faster. Well, I owe him lunch now. The code is below.&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/p&gt;...(&lt;a href="http://azurecoding.com/blogs/icbtw/archive/2009/06/26/net_5F00_4_5F00_0_5F00_reflection_5F00_vs_5F00_dynamics_5F00_vs_5F00_property_5F00_setting_5F00_with_5F00_times.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=1309" width="1" height="1"&gt;</description><enclosure url="http://azurecoding.com/cfs-file.ashx/__key/CommunityServer.Components.PostAttachments/00.00.00.13.09/Program.zip" length="565" type="application/x-zip-compressed" /><category domain="http://azurecoding.com/blogs/icbtw/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://azurecoding.com/blogs/icbtw/archive/tags/.NET+4.0/default.aspx">.NET 4.0</category><category domain="http://azurecoding.com/blogs/icbtw/archive/tags/new+cloud+app/default.aspx">new cloud app</category></item><item><title>An Elevator Pitch for View Model</title><link>http://azurecoding.com/blogs/brownie/archive/2009/06/14/an-elevator-pitch-for-view-model.aspx</link><pubDate>Sun, 14 Jun 2009 15:57:00 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:3028</guid><dc:creator>Mike Brown</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;I recently gave a presentation on WPF and Silverlight at this year’s Indy Code Camp. During the talk, I gave a brief overview of View Model. After explaining how data binding works within WPF, I had set myself up for the ultimate punch line:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Since we have this rich data binding model within WPF, why not bind our UI to an object that represents exactly what we want our UI to do.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;To demonstrate the power of WPF Data Binding and the View Model pattern I walked through a simple RSS Reader that displayed a list of feeds allowing the user to select one and see a list of feed items and selecting one of those select display the page associated with the feed item in a Frame, all using data binding against a View Model object and zero code behind. While one can argue there are easier ways to create a simple feed reader in WPF…the code was tailored to demonstrate the power of the ViewModel pattern. I saw a number of light bulbs turn on in the audience as a result.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=3028" width="1" height="1"&gt;</description></item><item><title>Announcing Alexandria RTW</title><link>http://azurecoding.com/blogs/brownie/archive/2009/04/09/announcing-alexandria-rtw.aspx</link><pubDate>Thu, 09 Apr 2009 21:20:40 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:957</guid><dc:creator>Mike Brown</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Release to the World that is. Today at 4:33 PM my wife delivered our newest family member, Khara Alexandria Brown. She weighs in at a healthy 6 pounds 3 ounces and has a modelesque height of 19 and 1/4 inches. Happy Birthday my little princess and many more!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://azurecoding.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/brownie/KharasBirthday013_5F00_4990589F.jpg"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="Khara&amp;#39;s Birthday 013" border="0" alt="Khara&amp;#39;s Birthday 013" src="http://azurecoding.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/brownie/KharasBirthday013_5F00_thumb_5F00_4F6AFC38.jpg" width="364" height="484" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://azurecoding.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/brownie/Kharasbirthday020_5F00_4E266359.jpg"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="Khara&amp;#39;s birthday 020" border="0" alt="Khara&amp;#39;s birthday 020" src="http://azurecoding.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/brownie/Kharasbirthday020_5F00_thumb_5F00_3F0F847F.jpg" width="644" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=957" width="1" height="1"&gt;</description></item><item><title>Blend Behaviors FTW</title><link>http://azurecoding.com/blogs/brownie/archive/2009/04/06/blend-behaviors-ftw.aspx</link><pubDate>Mon, 06 Apr 2009 19:12:00 GMT</pubDate><guid isPermaLink="false">6e97e1e3-dc93-4c0d-b73f-e698f7d56013:928</guid><dc:creator>Mike Brown</dc:creator><slash:comments>5</slash:comments><description>&lt;p&gt;&lt;strong&gt;Update: &lt;/strong&gt;As promised, here&amp;rsquo;s the code read below for usage. &lt;br /&gt;(Please visit the site to view this media)&lt;/p&gt;
&lt;p&gt;Beyond SketchFlow (THE official coolest thing since sliced bread), Blend 3 has some other great features for improving the designer-developer workflow. Something I like a lot&amp;nbsp; (and most of &lt;a target="_blank" href="http://blog.galasoft.ch/archive/2009/04/05/using-a-behavior-to-magnify-your-wpf-applications.aspx"&gt;my fellow WPF Disciples&lt;/a&gt;) are Behaviors. &lt;/p&gt;
&lt;p&gt;If you recall, I spent a couple of posts a few years back talking about &lt;a target="_blank" href="http://mbrownchicago.spaces.live.com/Blog/cns!2221DC39E0C749A4!325.entry"&gt;using attached properties&lt;/a&gt; to enable adding &lt;a target="_blank" href="http://mbrownchicago.spaces.live.com/Blog/cns!2221DC39E0C749A4!331.entry"&gt;functionality to controls&lt;/a&gt; without code. Blend Behaviors take the pattern and wrap it in a simple API making it much easier to get down to the business of hacking WPF. &lt;/p&gt;
&lt;p&gt;Even more interesting than the standard attached behaviors is the new Trigger system implemented using the pattern. Including the capability of creating custom Trigger Actions. In the initial release of WPF, Trigger Actions were effectively sealed because they are abstract and the function that inheritors need to override is marked internal. This effectively stood in the way of providing a solution to this &lt;a target="_blank" href="http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/a078bab6-7068-427d-90fb-b08ee723928f/"&gt;problem in the MSDN forums&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The new Behavior-based trigger system (which works in Silverlight and WPF) opens the door for custom Trigger Actions. Now that we have custom Trigger Actions, I&amp;rsquo;m able to create an ExecuteCommandAction that allows you to invoke a Command from any trigger. The code is simple as is its usage.&lt;/p&gt;
&lt;p&gt;First we define the trigger action&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Windows;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Windows.Input;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; Microsoft.Expression.Interactivity;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.ComponentModel;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; AzureCoding.Agility.Core.Behaviors&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;{&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; ExecuteCommandAction : TriggerAction&amp;lt;FrameworkElement&amp;gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;        [Category(&lt;span class="str"&gt;&amp;quot;ExecuteCommandAction Properties&amp;quot;&lt;/span&gt;),&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;        Description(&lt;span class="str"&gt;&amp;quot;The name of the Command that will be executed by this Trigger Action&amp;quot;&lt;/span&gt;)]&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; TargetCommand&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;        {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;            get { &lt;span class="kwrd"&gt;return&lt;/span&gt; (&lt;span class="kwrd"&gt;string&lt;/span&gt;)GetValue(TargetCommandProperty); }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;            set { SetValue(TargetCommandProperty, &lt;span class="kwrd"&gt;value&lt;/span&gt;); }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;        }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;readonly&lt;/span&gt; DependencyProperty TargetCommandProperty =&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;            DependencyProperty.Register(&lt;span class="str"&gt;&amp;quot;Target Command&amp;quot;&lt;/span&gt;,&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;                                        &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(&lt;span class="kwrd"&gt;string&lt;/span&gt;),&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;                                        &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(ExecuteCommandAction),&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;                                        &lt;span class="kwrd"&gt;new&lt;/span&gt; PropertyMetadata&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;                                            (TargetCommandChanged));&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; TargetCommandChanged(DependencyObject d,&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;            DependencyPropertyChangedEventArgs e)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;        {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;        }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;        &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Invoke(&lt;span class="kwrd"&gt;object&lt;/span&gt; parameter)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;        {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;            var path = TargetCommand;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;            var dc = AssociatedObject.DataContext;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;            var targetCommand = &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;                dc.GetType().GetProperty(path).GetValue(dc, &lt;span class="kwrd"&gt;null&lt;/span&gt;) &lt;span class="kwrd"&gt;as&lt;/span&gt; ICommand;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (targetCommand != &lt;span class="kwrd"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; targetCommand.CanExecute(parameter))&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;            {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;                targetCommand.Execute(parameter);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;            }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;        }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;

&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The new Behaviors framework is defined in the Microsoft.Expression.Interactivity namespace (in the assembly by the same name). We inherit from TriggerAction, a descendant of the base behavior class and declare a dependency property for the name of the command we want invoked (lines 11 &amp;ndash; 30). Finally, we override the Invoke method from the TriggerAction class. Unfortunately, it appears that Binding does not work for TriggerActions and I haven&amp;rsquo;t heard if this will be addressed in the final version of the behaviors framework. At least for now we have to get a handle to the target command manually. Once that&amp;rsquo;s done, we just check that it can execute and then ask it to do so. The code uses the convention that the command resides on the Data Context of the object to which your trigger is attached. I also didn&amp;rsquo;t bother putting in robust error checking (so if the property doesn&amp;rsquo;t exist, you&amp;rsquo;ll get an exception).&lt;/p&gt;
&lt;p&gt;&lt;a href="http://azurecoding.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/brownie/image_5F00_21BBB0CC.png"&gt;&lt;img height="317" width="644" src="http://azurecoding.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/brownie/image_5F00_thumb_5F00_131104E7.png" alt="image" border="0" title="image" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt;&amp;nbsp; &lt;br /&gt;Once we&amp;rsquo;ve built the library and referenced it in a Blend 3 project, we can see our new behavior in the asset library&lt;/p&gt;
&lt;p&gt;&lt;a href="http://azurecoding.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/brownie/custombehaviors_5F00_4DF837B0.gif"&gt;&lt;img height="300" width="250" src="http://azurecoding.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/brownie/custombehaviors_5F00_thumb_5F00_7E3F0C66.gif" alt="custombehaviors" title="custombehaviors" style="display:inline;" /&gt;&lt;/a&gt; &lt;br /&gt;Adding it to a target is as simple as dragging it to the objects and timeline panel. From there we&amp;rsquo;re able to edit the properties using the property editor.&lt;/p&gt;
&lt;p&gt;So how do we use it? Well The convention of looking for the Command on the attached control&amp;rsquo;s data context works very well with the MVVM pattern. So let&amp;rsquo;s make a simple login control and matching View Model to drive it. Here&amp;rsquo;s the XAML for the Control&lt;/p&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;UserControl&lt;/span&gt;
&lt;span class="rem"&gt;&amp;lt;!-- A bunch of xmlns definitions&amp;mdash;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;UserControl.DataContext&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;AgVM:LoginViewModel&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;UserControl.DataContext&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt; &lt;span class="attr"&gt;x:Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;LayoutRoot&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Background&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;White&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="rem"&gt;&amp;lt;!-- A bunch of layout definitions--&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Button&lt;/span&gt; &lt;span class="attr"&gt;Margin&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;0,0,5,0&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;VerticalAlignment&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Bottom&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Grid&lt;/span&gt;.&lt;span class="attr"&gt;Column&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;1&amp;quot;&lt;/span&gt; 
                &lt;span class="attr"&gt;Grid&lt;/span&gt;.&lt;span class="attr"&gt;ColumnSpan&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;2&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Grid&lt;/span&gt;.&lt;span class="attr"&gt;Row&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;2&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Content&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Login&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;i:Interaction.Triggers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;i:EventTrigger&lt;/span&gt; &lt;span class="attr"&gt;EventName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Click&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Ag:ExecuteCommandAction&lt;/span&gt; &lt;span class="attr"&gt;TargetCommand&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;LoginCommand&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
                &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;i:EventTrigger&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;i:Interaction.Triggers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Button&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;br /&gt;&lt;span class="rem"&gt;&amp;lt;!&amp;mdash;More UI code--&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;UserControl&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;

&lt;/p&gt;
&lt;p&gt;There is no custom code-behind for the control. The ViewModel is instantiated in the XAML and all the elements are bound to properties on the ViewModel using data binding. Here is our ViewModel (or the significant parts thereof):&lt;/p&gt;
&lt;pre class="csharpcode"&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; LoginViewModel : INotifyPropertyChanged
    {
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;event&lt;/span&gt; PropertyChangedEventHandler PropertyChanged;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; LoginViewModel()
        {
            PropertyChanged += (blank, blank1) =&amp;gt; { };
            LoginCommand = &lt;span class="kwrd"&gt;new&lt;/span&gt; DelegatingCommand
                               {
                                   CanExecuteRequested = param =&amp;gt; &lt;span class="kwrd"&gt;true&lt;/span&gt;,
                                   ExecuteRequested = param =&amp;gt; ShowLogin()
                               };
        }

        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; ShowLogin()
        {
            MessageBox.Show(String.Format(&lt;span class="str"&gt;&amp;quot;Login by {0} successful&amp;quot;&lt;/span&gt;, _UserName));
        }&lt;/pre&gt;
&lt;p&gt;

&lt;/p&gt;
&lt;p&gt;Here I&amp;rsquo;m using the &lt;a target="_blank" href="http://mbrownchicago.spaces.live.com/Blog/cns!2221DC39E0C749A4!596.entry"&gt;DelegatingCommand&lt;/a&gt; to expose an ICommand as a property on my ViewModel. I&amp;rsquo;ve also exposed a UserName and Password field. Running the application gives us this.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://azurecoding.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/brownie/runningthecode_5F00_6E4FC7A2.gif"&gt;&lt;img height="436" width="552" src="http://azurecoding.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/brownie/runningthecode_5F00_thumb_5F00_2CD51549.gif" alt="runningthecode" title="runningthecode" style="display:inline;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;So now we have trigger driven command execution with zero code behind. I&amp;rsquo;ll upload the code later.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://azurecoding.com/aggbug.aspx?PostID=928" width="1" height="1"&gt;</description></item></channel></rss>