<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>HSI Developer Blog</title>
	<atom:link href="http://hsidev.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://hsidev.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<pubDate>Thu, 03 Jul 2008 20:50:07 +0000</pubDate>
	<generator>http://wordpress.org/?v=MU</generator>
	<language>en</language>
			<item>
		<title>SQL Join Resources</title>
		<link>http://hsidev.wordpress.com/2008/07/03/sql-join-resources/</link>
		<comments>http://hsidev.wordpress.com/2008/07/03/sql-join-resources/#comments</comments>
		<pubDate>Thu, 03 Jul 2008 20:50:07 +0000</pubDate>
		<dc:creator>alexw668</dc:creator>
		
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://hsidev.wordpress.com/?p=105</guid>
		<description><![CDATA[This seems to be good SQL join resource.
       ]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://rtipton.wordpress.com/2008/07/01/sql-join-resources/">This</a> seems to be good SQL join resource.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/hsidev.wordpress.com/105/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/hsidev.wordpress.com/105/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hsidev.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hsidev.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hsidev.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hsidev.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hsidev.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hsidev.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hsidev.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hsidev.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hsidev.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hsidev.wordpress.com/105/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hsidev.wordpress.com&blog=3345968&post=105&subd=hsidev&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hsidev.wordpress.com/2008/07/03/sql-join-resources/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Beginner&#8217;s Mind</title>
		<link>http://hsidev.wordpress.com/2008/07/01/beginners-mind/</link>
		<comments>http://hsidev.wordpress.com/2008/07/01/beginners-mind/#comments</comments>
		<pubDate>Wed, 02 Jul 2008 06:03:46 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hsidev.wordpress.com/2008/07/01/beginners-mind/</guid>
		<description><![CDATA[Shunryu Suzuki, one of the pioneers of Zen Buddhism in the United States, said this in one of his lectures:
&#8220;In the beginners mind there are many possibilities, in the experts mind there are few&#8221; 
This statement was part of a talk about something a bit closer to the pulse of life than the practice of [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://www.youtube.com/watch?v=pHNyCAJXUXE">Shunryu Suzuki</a>, one of the pioneers of Zen Buddhism in the United States, <a href="http://en.wikipedia.org/wiki/Shoshin">said this</a> in one of his lectures:<br />
<h3><em><strong>&#8220;In the beginners mind there are many possibilities, in the experts mind there are few&#8221;</strong></em> </h3>
<p>This statement was part of a talk about something a bit closer to the pulse of life than the practice of software development (namely about the practice of finding the pulse of life) but it is nevertheless a resonant concept when applied to any cross section of our human experience, software development included.
<p><a href="http://www.codinghorror.com/blog/archives/001124.html">Jeff Atwood</a> and <a href="http://www.hanselman.com/blog/ProfessionalismProgrammingAndPunditryAndSuccessAsAMetric.aspx">Scott Hanselman</a> write about this eloquently. Karl Seguin recently published <a href="http://codebetter.com/blogs/karlseguin/archive/2008/06/24/foundations-of-programming-ebook.aspx">an e-book about ALT.NET</a>, and in the introduction to the book relates his experience of being able to truly grow as a programmer only after shedding the illusions that he was an expert programmer.
<p>I&#8217;m not interested in driving that point home any further. The argument was made very well by the authors above and rehashed endlessly in the comments of their respective blogs.</p>
<p>However, I thought it might be interesting to describe my personal experience of coming to that realization in my own career, and how it has altered (opened up) my view of our industry. <a href="http://www.lutheranscience.org/2006-JabalAlLawz1.html"><img style="border-width:0;margin:5px;" height="212" alt="image" src="http://hsidev.files.wordpress.com/2008/07/image1.png?w=189&h=212" width="189" align="right" border="0"></a> </p>
<p>After many years of writing software for the same company with a tight focus on the task immediately at hand I decided to tune in to some of the chatter of the social web, rather than just digging through it on an as needed basis to solve one particular problem or another. I&#8217;ve always been an avid reader of technical books but technical books, especially ones about established (or even emerging) technologies, are very focused on their subject matter. They are, as advertised, about a specific technology, not about the art and practice of programming. I&#8217;ve also read a number of the classic books on the art and practice of programming, such as The Pragmatic Programmer, Code Complete, various patterns books, books on Agile, Domain Driven Design, and so on. Those are more enlightening than a technology specific book, and they help you improve your craft in a much more general way, but by and large they weren&#8217;t reflective enough to show me how little I knew.
<p>Then I started to pay attention to this gigantic, amazing conversation that is always unfolding in the &#8220;blogosphere,&#8221; and, slowly, groggily, I started to wake up, to understand how expansive and fluid the world of creating software actually is.
<p>The experience can be described as spending several years climbing a mountain you were born at the foot of, all the while assuming that the mountain was the whole world. As you near the tree line, you begin to catch glimpses of something larger flickering through the gaps between the trees, and then all at once you break through the tree line and behold the entire, sprawling mountain range extending out in all directions and any illusion you may have had about mastering your environment immediately evaporates and you find yourself in awe, and maybe a little bit frightened at the unexpected vastness.
<p>In my case I was faced, on the one hand, with the fact that the sum total of the knowledge I had acquired thus far (struggled to acquire and felt such a sense achievement for acquiring) was barely a drop in a very big bucket. On the other hand, the universe I spent most of my waking hours in just grew without warning to unimaginable size, and now I got to explore it. There are certain times in life where being humbled is the only way to continue to grow, like a rose bush that must be cut back each season before it can bloom.
<p>The first thing I noticed when I broke through the tree line, after recovering from the sheer size of it all, was that each of the other mountains, and the valleys between them, were crawling with fellow explorers. Sure, I had passed a few people on the way up <em>my</em> mountain, and a few people had passed me, but all of a sudden there were thousands upon thousands of other technologists scurrying about everywhere, sporting fanny packs, pocket protectors and laptops. Most were sweating and stomping steadily up the myriad well worn paths, but others were running far ahead, hacking through underbrush, <a href="http://www.ayende.com/Blog/Default.aspx">madly scribbling notes as they went</a>,&nbsp; tossing them over their shoulders by the&nbsp; fistful; others <a href="http://www.codinghorror.com/blog/">gave loud, grinning sermons as they strolled along while throngs of followers cheered or broke into raucous fistfights</a>, and still others would stop regularly <a href="http://martinfowler.com/">to draw detailed maps of where they had been, their theories about what lay ahead of them</a>, and very often enough take the time to give lectures and <a href="http://blog.wekeroad.com/mvc-storefront/">make screen-casts of their experiences pioneering</a> in this enormous, shared adventure of being a technologist.
<p>Personally, I find it to be quite beautiful, and tremendously inspiring.
<p>Of course, not everyone is helpful. There are plenty of angry, impatient and elitist explorers too, yelling at one another from peak to peak, certain their mountain is <a href="http://en.wikipedia.org/wiki/Biblical_Mount_Sinai">Mount Sinai</a>, the others are cheap decoys, yadda yadda. This part of the culture is best served by the <a href="http://www.codinghorror.com/blog/archives/000699.html">religion</a> <a href="http://hsidev.wordpress.com/2008/06/05/fine-soa-may-not-be-a-city-what-about-a-religion/">metaphor</a>, though, and there is no avoiding the phenomenon: humans are extremely religious creatures and programmers, to their chagrin, are not immune. How can it be helped? Human life is an absolute mystery, religion is inevitable.
<p>And of course these countless throngs have organized into cliques, tribes, nations, hold elaborate rituals, build massive idols and sprawling temples, go to war, cross-breed, and so on. The same microcosm of human society that is repeated in every other industry, or nation, or religious sect or body politic across the planet and throughout time. Obviously the universe uses design patterns, too.
<p>Anyway, mostly I wanted to relate my experience in order to express my newfound appreciation of our profession, and particularly the staggering social generosity of the luminaries, pioneers, and everyday developers who devote so much precious time and apparently limitless energy to clearing the paths and building the roads on which the rest of us are able to make such amazing progress.&nbsp;
<p>I will close this post with <a href="http://www.cuke.com/Cucumber%20Project/lectures/quotes%20from%20CC.html">another quote</a> from <a href="http://en.wikipedia.org/wiki/Shunryu_Suzuki">Suzuki Roshi</a>. This one I&#8217;ll leave up to you to interpret.<br />
<h3><em><strong>&#8220;My lecture for tonight will be very short, especially after having a good dinner of noodles, which were very long. Our transmission should be a very long, long one. And our transmission is a special noodle.&#8221;</strong></em></h3>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/hsidev.wordpress.com/103/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/hsidev.wordpress.com/103/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hsidev.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hsidev.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hsidev.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hsidev.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hsidev.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hsidev.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hsidev.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hsidev.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hsidev.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hsidev.wordpress.com/103/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hsidev.wordpress.com&blog=3345968&post=103&subd=hsidev&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hsidev.wordpress.com/2008/07/01/beginners-mind/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/plasticlizard-128.jpg" medium="image">
			<media:title type="html">Nathan</media:title>
		</media:content>

		<media:content url="http://hsidev.files.wordpress.com/2008/07/image1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>More Extension Methods&#8230;</title>
		<link>http://hsidev.wordpress.com/2008/07/01/more-extension-methods/</link>
		<comments>http://hsidev.wordpress.com/2008/07/01/more-extension-methods/#comments</comments>
		<pubDate>Tue, 01 Jul 2008 18:39:04 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
		
		<category><![CDATA[Extension Methods]]></category>

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

		<guid isPermaLink="false">http://hsidev.wordpress.com/2008/07/01/more-extension-methods/</guid>
		<description><![CDATA[Here&#8217;s another selection of nice extension methods.
       ]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://weblogs.asp.net/okloeten/archive/2008/06/19/6296904.aspx">Here&#8217;s another selection</a> of nice extension methods.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/hsidev.wordpress.com/101/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/hsidev.wordpress.com/101/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hsidev.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hsidev.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hsidev.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hsidev.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hsidev.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hsidev.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hsidev.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hsidev.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hsidev.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hsidev.wordpress.com/101/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hsidev.wordpress.com&blog=3345968&post=101&subd=hsidev&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hsidev.wordpress.com/2008/07/01/more-extension-methods/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/plasticlizard-128.jpg" medium="image">
			<media:title type="html">Nathan</media:title>
		</media:content>
	</item>
		<item>
		<title>Foundations of Programming - free ALT.NET e-book</title>
		<link>http://hsidev.wordpress.com/2008/06/27/foundations-of-programming-free-altnet-e-book/</link>
		<comments>http://hsidev.wordpress.com/2008/06/27/foundations-of-programming-free-altnet-e-book/#comments</comments>
		<pubDate>Fri, 27 Jun 2008 19:11:57 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hsidev.wordpress.com/2008/06/27/foundations-of-programming-free-altnet-e-book/</guid>
		<description><![CDATA[I am constantly amazed (and humbled) by the generosity of time experts in this field of very, very busy people continue to demonstrate over and over again. I don&#8217;t know if other professions are the same way, but it really makes this one a pleasure to work in. Here is a free e-book by Karl [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I am constantly amazed (and humbled) by the generosity of time experts in this field of very, very busy people continue to demonstrate over and over again. I don&#8217;t know if other professions are the same way, but it really makes this one a pleasure to work in. Here is a free e-book by <a href="http://codebetter.com/blogs/karlseguin/default.aspx">Karl Seguin</a> of <a href="http://codebetter.com/">CodeBetter.com</a>. I haven&#8217;t read it yet, but I very much look forward to it. From the TOC it looks like it will be a very useful resource.</p>
<p><a href="http://codebetter.com/blogs/karlseguin/archive/2008/06/24/foundations-of-programming-ebook.aspx">You can get it here.</a></p>
<p><a href="http://codebetter.com/blogs/karlseguin/archive/2008/06/24/foundations-of-programming-ebook.aspx"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="244" alt="image" src="http://hsidev.files.wordpress.com/2008/06/image3.png?w=189&h=244" width="189" border="0"></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/hsidev.wordpress.com/100/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/hsidev.wordpress.com/100/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hsidev.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hsidev.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hsidev.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hsidev.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hsidev.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hsidev.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hsidev.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hsidev.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hsidev.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hsidev.wordpress.com/100/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hsidev.wordpress.com&blog=3345968&post=100&subd=hsidev&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hsidev.wordpress.com/2008/06/27/foundations-of-programming-free-altnet-e-book/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/plasticlizard-128.jpg" medium="image">
			<media:title type="html">Nathan</media:title>
		</media:content>

		<media:content url="http://hsidev.files.wordpress.com/2008/06/image3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Baby Stepping into MSIL - creating an &#34;Event Recorder&#34; using a DynamicMethod and Reflection.Emit</title>
		<link>http://hsidev.wordpress.com/2008/06/27/baby-stepping-into-msil-creating-an-event-recorder-using-a-dynamicmethod-and-reflectionemit/</link>
		<comments>http://hsidev.wordpress.com/2008/06/27/baby-stepping-into-msil-creating-an-event-recorder-using-a-dynamicmethod-and-reflectionemit/#comments</comments>
		<pubDate>Fri, 27 Jun 2008 17:07:59 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hsidev.wordpress.com/2008/06/27/baby-stepping-into-msil-creating-an-event-recorder-using-a-dynamicmethod-and-reflectionemit/</guid>
		<description><![CDATA[I&#8217;ve often been caught between two opposing forces - the desire to find some excuse to use Reflection.Emit to dynamically generate behavior, because it has a sort of magical quality about it, and on the other hand being completely intimidated by the strange and foreboding mysteries of IL. I finally found an excuse compelling enough [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;ve often been caught between two opposing forces - the desire to find some excuse to use Reflection.Emit to dynamically generate behavior, because it has a sort of magical quality about it, and on the other hand being completely intimidated by the strange and foreboding mysteries of IL. I finally found an excuse compelling enough to brave my fears and stick my toe in the water, and it wasn&#8217;t too bad.</p>
<p>The excuse to take the plunge was, as is often the case, laziness (or perhaps impatience). I had an interface with a blue million events on it, and I wanted create some unit tests that ensured all my little events were fired the right number of times, in the right order, with the right arguments, but I didn&#8217;t want to subscribe to all the events individually and set a bunch of flags, etc. etc. (BTW - I imagine this problem has been solved by superior minds - I didn&#8217;t spend much time looking)</p>
<p>The sample code, along with unit tests and a Windows Forms app demonstrating possible usage, <a href="http://www.codeplex.com/EventRecorder">can be found here</a>.</p>
<p>Here is a typical usage:</p>
<div style="overflow:auto;">
<pre>[<span style="color:#2b91af;">Test</span>]
<span style="color:blue;">public void </span>Recorder_Will_Record_Events()
{
    <span style="color:blue;">var </span>source = <span style="color:blue;">new </span><span style="color:#2b91af;">TestEventSource</span>();
    <span style="color:blue;">using </span>(<span style="color:blue;">var </span>recorder = <span style="color:blue;">new </span><span style="color:#2b91af;">EventRecorder</span>(source))
    {
      source.FireSimpleEvent();
      source.FireSimpleEvent();
      source.FireEventWithCustomArgs(<span style="color:#a31515;">&#8220;MyTestText&#8221;</span>);
      source.FireSimpleEvent();
      source.FireEventWithCustomArgs(<span style="color:#a31515;">&#8220;NewTestText&#8221;</span>);

      <span style="color:#2b91af;">Assert</span>.That(recorder.EventHistory.Length, <span style="color:#2b91af;">Is</span>.EqualTo(5));

      <span style="color:#2b91af;">Assert</span>.That(((<span style="color:#2b91af;">TestEventArgs</span>) recorder.EventHistory[2].Args).LoveMe, <span style="color:#2b91af;">Is</span>.EqualTo(<span style="color:#a31515;">&#8220;MyTestText&#8221;</span>));
      <span style="color:#2b91af;">Assert</span>.That(((<span style="color:#2b91af;">TestEventArgs</span>) recorder.EventHistory[4].Args).LoveMe, <span style="color:#2b91af;">Is</span>.EqualTo(<span style="color:#a31515;">&#8220;NewTestText&#8221;</span>));

      <span style="color:#2b91af;">Assert</span>.That(recorder.GetInvocationsFor(<span style="color:#a31515;">&#8220;SimpleEvent&#8221;</span>).Length, <span style="color:#2b91af;">Is</span>.EqualTo(3));
      <span style="color:#2b91af;">Assert</span>.That(recorder.GetInvocationsFor(<span style="color:#a31515;">&#8220;EventWithCustomargs&#8221;</span>).Length, <span style="color:#2b91af;">Is</span>.EqualTo(2));
     }
}</pre>
</div>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>What I wanted to do was &#8220;record&#8221; all the events that were fired on a particular object during the course of some transaction, and then test that all the events that fired were the ones I was expecting, and in the appropriate order. I figured I would achieve this by creating a class called EventRecorder that could take in its constructor any other non-null object. It would then loop through each event in the objects type, subscribe to that event, and when the event fired add the name of the event and the EventArgs to a collection I could examine later. Pretty simple.</p>
<p>I though this would be a simple matter of using some plain ol&#8217; reflection, like this:</p>
<pre> <span style="color:#0000ff;">foreach</span> (EventInfo evt <span style="color:#0000ff;">in</span> eventSource.GetType().GetEvents())
 {
 	evt.AddEventHandler(eventSource,
            <span style="color:#0000ff;">new</span> EventHandler(
		(sender,args)=&gt;RecordEvent(evt.Name,args)));
 }</pre>
<p>&nbsp;</p>
<p>But alas, AddEventHandler expects a delegate that exactly matches the signature of the event, meaning if I have an event defined with EventHandler&lt;CancelEventArgs&gt;, it isn&#8217;t going to let me pass a plain EventHandler delegate. So what to do? Dynamically generate an event handler with the appropriate signature, of course, and emit a simple call to my RecordMethod. Essentially, we&#8217;ll be generating the equivalent of this:</p>
<pre><span style="color:#0000ff;">private</span> <span style="color:#0000ff;">void</span> HandleEvent(<span style="color:#0000ff;">object</span> sender,EventArgs&lt;CancelEventArgs&gt; args)
{
    <span style="color:#0000ff;">this</span>.RecordEvent(args,&#8221;<span style="color:#8b0000;">NameOfTheEvent</span>&#8220;);
}</pre>
<p>I found an MSDN article that <a href="http://msdn.microsoft.com/en-us/library/ms228976.aspx">looked like just the ticket</a>. The technique presented uses the DynamicMethod class, which you can use to create an ad hoc method and fill it full of op-codes to tell it what to do. In this case, we wanted to instantiate a DynamicMethod that matches the signature of the event handler we want to subscribe to. Then we simply needed to emit the IL to call the RecordEvent method and pass in the appropriate arguments. In the code below, EventSource refers to the object whose events we&#8217;re subscribing to, and was passed in to the constructor of the EventRecorder class.</p>
<div style="overflow:auto;">
<pre><span style="color:gray;">/// &lt;summary&gt;
/// </span><span style="color:green;">This method crates a DynamicMethod matching the signature of
</span><span style="color:gray;">/// </span><span style="color:green;">the delegate required by the passed in EventInfo. The method
</span><span style="color:gray;">/// </span><span style="color:green;">will simply pass the arguments on to the RecordEvent method.
</span><span style="color:gray;">/// &lt;/summary&gt;
/// &lt;param name=&#8221;evt&#8221;&gt;&lt;/param&gt;
</span><span style="color:blue;">protected void </span>BindToEvent(<span style="color:#2b91af;">EventInfo </span>evt)
{
    <span style="color:#2b91af;">Type </span>handlerType = evt.EventHandlerType;

    <span style="color:blue;">if </span>(handlerType == <span style="color:blue;">null</span>)
        <span style="color:blue;">throw new </span><span style="color:#2b91af;">ArgumentException</span>(<span style="color:#a31515;">&#8220;No handler could be &#8221; </span>+
                              <span style="color:#a31515;">&#8221; identified for &#8221; </span>+ evt.Name);

    <span style="color:#2b91af;">Type</span>[] handlerParams = GetDelegateParameterTypes(handlerType);

    <span style="color:green;">//Not technically required, but may be helpful if an exception is thrown
    </span><span style="color:#2b91af;">String </span>dynamicHandlerName =
        <span style="color:#2b91af;">String</span>.Format(<span style="color:#a31515;">&#8220;EventSource_{0}&#8221;</span>, evt.Name);

    <span style="color:blue;">var </span>handlerDef = <span style="color:blue;">new </span><span style="color:#2b91af;">DynamicMethod</span>(dynamicHandlerName,
                                       <span style="color:blue;">typeof</span>(<span style="color:blue;">void</span>),
                                       handlerParams,
                                       <span style="color:blue;">typeof </span>(<span style="color:#2b91af;">EventRecorder</span>));

    <span style="color:#2b91af;">MethodInfo </span>recordEvent =
        <span style="color:blue;">typeof </span>(<span style="color:#2b91af;">EventRecorder</span>).GetMethod(
            <span style="color:#a31515;">&#8220;RecordEvent&#8221;</span>,
             <span style="color:#2b91af;">BindingFlags</span>.Instance | <span style="color:#2b91af;">BindingFlags</span>.NonPublic);

    <span style="color:#2b91af;">ILGenerator </span>ilgen = handlerDef.GetILGenerator();

    <span style="color:green;">//load &#8216;this&#8217; onto the stack
    </span>ilgen.Emit(<span style="color:#2b91af;">OpCodes</span>.Ldarg_0);

    <span style="color:green;">//load the second argument (EventArgs) onto the stack
    //We&#8217;re not using the sender parameterf of the delegate,
    //so we skip emitting OpCodes.Ldarg_1
    </span>ilgen.Emit(<span style="color:#2b91af;">OpCodes</span>.Ldarg_2);

    <span style="color:green;">//Load the name of the event onto the stack
    </span>ilgen.Emit(<span style="color:#2b91af;">OpCodes</span>.Ldstr, evt.Name);

    <span style="color:green;">//Call the RecordEvent method, passing the two loaded argumetns
    //EventArgs args and String name
    </span>ilgen.Emit(<span style="color:#2b91af;">OpCodes</span>.Callvirt, recordEvent);

    <span style="color:green;">//Return control
    </span>ilgen.Emit(<span style="color:#2b91af;">OpCodes</span>.Ret);

    <span style="color:green;">//Create a delegate out of this new handler, binding to the current
    //instance as the target
    </span><span style="color:#2b91af;">Delegate </span>handler = handlerDef.CreateDelegate(handlerType,<span style="color:blue;">this</span>);

    <span style="color:blue;">try
    </span>{
        <span style="color:green;">//Register the new delegeate with the event on the event source
        </span>evt.AddEventHandler(EventSource, handler);
    }
    <span style="color:blue;">catch </span>(<span style="color:#2b91af;">Exception </span>ex)
    {
        <span style="color:green;">//Some COM objects don&#8217;t like this method. In production, you wouldn&#8217;t
        //eat this error like this, but for my example, I wanted to show events
        //on the WebBrowser control, and certain events of WebBrowser
        //don&#8217;t appreciate this dynamic approach. So&#8230;
    </span>}

    <span style="color:green;">//record this handler so we can get to it later
    //when we need to remove our registration from
    //the event source during dispose
    </span>_handlers.Add(evt.Name, <span style="color:blue;">new </span><span style="color:#2b91af;">EventRef</span>(handler,evt));
}</pre>
<p><a href="http://11011.net/software/vspaste"></a>
<pre><span style="color:gray;">/// &lt;summary&gt;
/// </span><span style="color:green;">Extract the signature of the event&#8217;s delegate
</span><span style="color:gray;">/// &lt;/summary&gt;
/// &lt;param name=&#8221;d&#8221;&gt;&lt;/param&gt;
/// &lt;returns&gt;&lt;/returns&gt;
</span><span style="color:blue;">private static </span><span style="color:#2b91af;">Type</span>[] GetDelegateParameterTypes(<span style="color:#2b91af;">Type </span>d)
{
    <span style="color:blue;">if </span>(d.BaseType != <span style="color:blue;">typeof </span>(<span style="color:#2b91af;">MulticastDelegate</span>))
        <span style="color:blue;">throw new </span><span style="color:#2b91af;">ApplicationException</span>(
            d.Name + <span style="color:#a31515;">&#8221; is not a delegate.&#8221;</span>);

    <span style="color:#2b91af;">MethodInfo </span>invoke = d.GetMethod(<span style="color:#a31515;">&#8220;Invoke&#8221;</span>);

    <span style="color:#2b91af;">ParameterInfo</span>[] parameters = invoke.GetParameters();

    <span style="color:green;">//Allocate an extra slot, see below for why
    </span><span style="color:blue;">var </span>typeParameters = <span style="color:blue;">new </span><span style="color:#2b91af;">Type</span>[parameters.Length+1];

    <span style="color:blue;">for </span>(<span style="color:blue;">int </span>i = 0; i &lt; parameters.Length; i++)
    {
        typeParameters[i+1] = parameters[i].ParameterType;
    }

    <span style="color:green;">//This is an extremely important step - we need to inject the type
    //of EventRecorder because we will be using EventRecorder as the Target
    //of the dynamic delegate that we create using the DynamicMethod. When
    //you go to convert your emitted MSIL to an actual delegate using DynamicMethod.CreateDelegate,
    //the first argument of the signature MUST match the target object you are binding
    //the delegate to.
    </span>typeParameters[0] = <span style="color:blue;">typeof </span>(<span style="color:#2b91af;">EventRecorder</span>);

    <span style="color:blue;">return </span>typeParameters;
}</pre>
<p><a href="http://11011.net/software/vspaste"></a>
<pre><span style="color:gray;">/// &lt;summary&gt;
/// </span><span style="color:green;">The internal method that gets called by the dynamically
</span><span style="color:gray;">/// </span><span style="color:green;">generated delegates we are using to bind to the EventSource&#8217;s
</span><span style="color:gray;">/// </span><span style="color:green;">events. This method will get called once for every event that fires
</span><span style="color:gray;">/// </span><span style="color:green;">on the EventSource.
</span><span style="color:gray;">/// &lt;/summary&gt;
/// &lt;param name=&#8221;args&#8221;&gt;&lt;/param&gt;
/// &lt;param name=&#8221;eventName&#8221;&gt;&lt;/param&gt;
</span><span style="color:blue;">protected virtual void </span>RecordEvent(<span style="color:#2b91af;">EventArgs </span>args, <span style="color:blue;">string </span>eventName)
{
    <span style="color:#2b91af;">EventInfo </span>evt = _handlers[eventName].Event;

    <span style="color:blue;">if </span>(evt != <span style="color:blue;">null</span>)
    {
        <span style="color:blue;">var </span>history = <span style="color:blue;">new </span><span style="color:#2b91af;">EventInvocation </span>{ Args = args, Event = evt };
        _eventHistory.Add(history);
        OnEventRecorded(history);
    }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></div>
<p>&nbsp;</p>
<p>IL is pretty close to the machine, relative to C#, so it&#8217;s entirely stack based. You load arguments onto the call stack, then perform an operation, such as calling a method. If you call a method, and the method has a signature with arguments, the arguments for the method signature are popped off the stack and consumed.</p>
<p>In this example we&#8217;re generating a dynamic method with a signature of two visible arguments - (object,MyEventArgs) - but we&#8217;re calling a method (RecordEvent) with a slightly different signature (EventArgs,string). We can discard the &#8220;object&#8221; argument of the dynamic method, which we do simply by not loading it onto the stack, which is why we don&#8217;t emit the opcode Ldarg_1, but we need to load the EventArgs and a string.</p>
<p>Looking at my source code it doesn&#8217;t quite add up though, because you can see I&#8217;m loading argument 0 (Ldarg_0) which looks like it should be &#8220;object&#8221; based on the dynamic method signature and argument 2 (Ldarg_2) which doesn&#8217;t even seem like it should exist, as the signature is (object,EventArgs) - only two arguments. Well, it turns out that all instance methods require a 0 position argument that is &#8220;this&#8221; - this argument is inserted by the compiler so you never see it, but when you say &#8220;this.DoSomething()&#8221; in your code, in IL method signature that gets created is DoSomething(MyType this). That means our call to &#8220;RecordEvent(EventArgs,string)&#8221; really looks like this: &#8220;RecordEvent(EventRecorder,EventArgs,string)&#8221;, which means we need to load 3 variables onto the stack, which we do:</p>
<blockquote>
<p>Ldarg_0 = this</p>
<p>//Ldarg_1 = object - not needed</p>
<p>Ldarg_2 = EventArgs</p>
<p>Ldsstr = EventInfo.Name</p>
</blockquote>
<p>NOT calling Ldarg_1 discards the object part of the dynamic method signature, which is OK, because that just represents EventSource anyway, and we have a reference to that already.</p>
<p>One important thing to note, though, is that when calling CreateDelegate on DynamicMethod it is <strong><em>critical</em></strong> to pass in &#8220;this&#8221; as the target - otherwise when the method you generated tries to access member variables, you&#8217;ll get illegal memory access errors. Also subtle, if you are creating a dynamic method that you intend to bind to an instance of an object, then the DynamicMethod needs to be created using the secret, full signature of MyMethod(EventRecorder,object,EventArgs) NOT just MyMethod(object,EventArgs) as you would expect. You can see this being taken care of in the GetDelegateParameterTypes method. This piece of info was not in the MSDN sample, and was a just a joy to figure out <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>By the way - a great way to figure out just what IL you need is to write the method you are hoping to generate, compile it, then view the IL in ILDASM.exe. Then you can either blindly translate the IL into Opcode.xxx calls, or you try to understand why it is doing what it is doing and modify according to your needs, but I probably never would have figured out the Ldarg_0 / Ldarg_2 mystery on my own - ILDASM saved my butt.</p>
<p>I need to find a better way of debugging this stuff, but the fact of the matters is that once you see what is going on, IL isn&#8217;t really any more complicated than anything else, it is just far more verbose and cryptic when you get it wrong <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The rest of EventRecorder is nothing special. The sample includes unit tests and a simple windows forms example.</p>
<p>Here are some resources:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/z43fsh67.aspx">DynamicMethod.CreateDelegate Method</a></p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms228976.aspx">How to hook up a delegate using reflection</a> </p>
<p><a href="http://www.albahari.com/nutshell/ch17.html">Reflection.Emit tidbits</a></p>
<p><a href="http://geekswithblogs.net/johnsperfblog/articles/49829.aspx">Introduction to creating types with Reflection.Emit, DymamicMethod</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/hsidev.wordpress.com/98/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/hsidev.wordpress.com/98/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hsidev.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hsidev.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hsidev.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hsidev.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hsidev.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hsidev.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hsidev.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hsidev.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hsidev.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hsidev.wordpress.com/98/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hsidev.wordpress.com&blog=3345968&post=98&subd=hsidev&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hsidev.wordpress.com/2008/06/27/baby-stepping-into-msil-creating-an-event-recorder-using-a-dynamicmethod-and-reflectionemit/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/plasticlizard-128.jpg" medium="image">
			<media:title type="html">Nathan</media:title>
		</media:content>
	</item>
		<item>
		<title>SimpleServiceBus Getting Started Guide</title>
		<link>http://hsidev.wordpress.com/2008/06/24/simpleservicebus-geting-started-guide/</link>
		<comments>http://hsidev.wordpress.com/2008/06/24/simpleservicebus-geting-started-guide/#comments</comments>
		<pubDate>Tue, 24 Jun 2008 22:57:16 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
		
		<category><![CDATA[ESB]]></category>

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

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

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

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

		<category><![CDATA[Simple Service Bus]]></category>

		<guid isPermaLink="false">http://hsidev.wordpress.com/2008/06/24/simpleservicebus-geting-started-guide/</guid>
		<description><![CDATA[A &#8220;getting-started&#8221; tutorial on how to get up and running with Simple Service Bus is available here. The guide explains various methods of configuring endpoints, how to define, send and publish messages, how to create and register message handlers, as well as how to setup the endpoint health monitoring system that is part of the [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=SimpleServiceBus&amp;DownloadId=37587"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="200" alt="image" src="http://hsidev.files.wordpress.com/2008/06/image2.png?w=240&h=200" width="240" align="left" border="0"></a>A &#8220;getting-started&#8221; tutorial on how to get up and running with Simple Service Bus <a href="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=SimpleServiceBus&amp;DownloadId=37587">is available here</a>. The guide explains various methods of configuring endpoints, how to define, send and publish messages, how to create and register message handlers, as well as how to setup the endpoint health monitoring system that is part of the framework. Much of what is presented will also apply to nServiceBus, since until you start getting into extensibility SSB hasn&#8217;t made many changes, but the syntax and configuration does differ in a number of places, so adjustments would need to be made.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/hsidev.wordpress.com/97/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/hsidev.wordpress.com/97/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hsidev.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hsidev.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hsidev.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hsidev.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hsidev.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hsidev.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hsidev.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hsidev.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hsidev.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hsidev.wordpress.com/97/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hsidev.wordpress.com&blog=3345968&post=97&subd=hsidev&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hsidev.wordpress.com/2008/06/24/simpleservicebus-geting-started-guide/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/plasticlizard-128.jpg" medium="image">
			<media:title type="html">Nathan</media:title>
		</media:content>

		<media:content url="http://hsidev.files.wordpress.com/2008/06/image2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Test Patterns: State vs Behavior Verification</title>
		<link>http://hsidev.wordpress.com/2008/06/24/test-patterns-state-vs-behavior-verification/</link>
		<comments>http://hsidev.wordpress.com/2008/06/24/test-patterns-state-vs-behavior-verification/#comments</comments>
		<pubDate>Tue, 24 Jun 2008 17:09:40 +0000</pubDate>
		<dc:creator>seanconnelly</dc:creator>
		
		<category><![CDATA[TDD]]></category>

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

		<guid isPermaLink="false">http://hsidev.wordpress.com/?p=95</guid>
		<description><![CDATA[This site gives a good definition of State Verification and Behavior Verification as it concerns our efforts to establish unit tests for all new functionality.
State Verification
Behavior Verification
Heres the one line definition for each if you want the 50,000 foot view.
State Verification: We inspect the state of the system under test (SUT) after it has been [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This site gives a good definition of State Verification and Behavior Verification as it concerns our efforts to establish unit tests for all new functionality.</p>
<p><a href="http://xunitpatterns.com/State%20Verification.html">State Verification</a><br />
<a>Behavior Verification</a></p>
<p>Heres the one line definition for each if you want the 50,000 foot view.</p>
<p>State Verification: We inspect the state of the system under test (SUT) after it has been exercised and compare it to the expected state.</p>
<p><img src="http://xunitpatterns.com/State%20Verification.gif" alt="State Verification" /></p>
<p>Behavior Verification: We capture the indirect outputs of the SUT as they occur and compare them to the expected behavior.</p>
<p><img src="http://xunitpatterns.com/Behavior%20Verification.gif" alt="Behavior Verification" /></p>
<p>Its a subtle but important distinction in that with state verification you may run a series of method call or processes and verify the expected state of the system after all the call have been made. With behavior verification you are interested in verifying that individual method calls are made to components within the system under test including dependent components utilized by the system under test.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/hsidev.wordpress.com/95/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/hsidev.wordpress.com/95/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hsidev.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hsidev.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hsidev.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hsidev.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hsidev.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hsidev.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hsidev.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hsidev.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hsidev.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hsidev.wordpress.com/95/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hsidev.wordpress.com&blog=3345968&post=95&subd=hsidev&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hsidev.wordpress.com/2008/06/24/test-patterns-state-vs-behavior-verification/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/seanconnelly-128.jpg" medium="image">
			<media:title type="html">seanconnelly</media:title>
		</media:content>

		<media:content url="http://xunitpatterns.com/State%20Verification.gif" medium="image">
			<media:title type="html">State Verification</media:title>
		</media:content>

		<media:content url="http://xunitpatterns.com/Behavior%20Verification.gif" medium="image">
			<media:title type="html">Behavior Verification</media:title>
		</media:content>
	</item>
		<item>
		<title>SimpleServiceBus Overview &#38; Architectural Description</title>
		<link>http://hsidev.wordpress.com/2008/06/23/simple-service-bus-overview-architectural-description/</link>
		<comments>http://hsidev.wordpress.com/2008/06/23/simple-service-bus-overview-architectural-description/#comments</comments>
		<pubDate>Mon, 23 Jun 2008 19:21:43 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
		
		<category><![CDATA[ESB]]></category>

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

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

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

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

		<category><![CDATA[Simple Service Bus]]></category>

		<guid isPermaLink="false">http://hsidev.wordpress.com/2008/06/23/simple-service-bus-overview-architectural-description/</guid>
		<description><![CDATA[I have posted a comprehensive overview of Simple Service Bus, including an architectural description, in the form of a PDF document available here. A few images from this document are included below.
 
       ]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I have posted a comprehensive overview of Simple Service Bus, including an architectural description, in the form of <a href="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=SimpleServiceBus&amp;DownloadId=37516">a PDF document available here</a>. A few images from this document are included below.</p>
<p><a href="http://hsidev.files.wordpress.com/2008/06/image.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" src="http://hsidev.files.wordpress.com/2008/06/image-thumb.png?w=600&h=561" border="0" alt="image" width="600" height="561" /></a> <a href="http://hsidev.files.wordpress.com/2008/06/image1.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" src="http://hsidev.files.wordpress.com/2008/06/image-thumb1.png?w=600&h=655" border="0" alt="image" width="600" height="655" /></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/hsidev.wordpress.com/94/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/hsidev.wordpress.com/94/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hsidev.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hsidev.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hsidev.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hsidev.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hsidev.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hsidev.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hsidev.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hsidev.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hsidev.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hsidev.wordpress.com/94/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hsidev.wordpress.com&blog=3345968&post=94&subd=hsidev&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hsidev.wordpress.com/2008/06/23/simple-service-bus-overview-architectural-description/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/plasticlizard-128.jpg" medium="image">
			<media:title type="html">Nathan</media:title>
		</media:content>

		<media:content url="http://hsidev.files.wordpress.com/2008/06/image-thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://hsidev.files.wordpress.com/2008/06/image-thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>SimpleServiceBus on CodePlex (a fork of nServiceBus)</title>
		<link>http://hsidev.wordpress.com/2008/06/17/simple-service-bus-on-codeplex-a-fork-of-nservicebus/</link>
		<comments>http://hsidev.wordpress.com/2008/06/17/simple-service-bus-on-codeplex-a-fork-of-nservicebus/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 05:51:25 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
		
		<category><![CDATA[ESB]]></category>

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

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

		<category><![CDATA[Open Source]]></category>

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

		<guid isPermaLink="false">http://hsidev.wordpress.com/2008/06/17/simple-service-bus-on-codeplex-a-fork-of-nservicebus/</guid>
		<description><![CDATA[[UPDATE] A pdf document providing a comprehensive overview of the project is now available here.[/Update]
I have posted a new project on CodePlex, Simple Service Bus. Simple Service Bus is a derivative of Udi Dahan&#8217;s nServiceBus, which I&#8217;ve mentioned before. I&#8217;ll be posting some more extended samples and documentation for using the new library, but first [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><em>[UPDATE] A pdf document providing a comprehensive overview of the project </em><a href="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=SimpleServiceBus&amp;DownloadId=37516"><em>is now available here</em></a><em>.[/Update]</em></p>
<p>I have posted a new project on CodePlex, <a href="http://www.codeplex.com/SimpleServiceBus">Simple Service Bus</a>. Simple Service Bus is a derivative of <a href="http://udidahan.weblogs.us/">Udi Dahan&#8217;s</a> <a href="http://www.nservicebus.com/">nServiceBus</a>, which <a href="http://hsidev.wordpress.com/2008/06/03/esbs-for-the-microsoft-net-platform/">I&#8217;ve mentioned before</a>. I&#8217;ll be posting some more extended samples and documentation for using the new library, but first I wanted to document my motivations. nServiceBus is a very solid, very useful, very easy to use piece of software for building asynchronous, messaging based service endpoints, and it&#8217;s creator is a well respected SOA guru, at least in .NET circles. I, of course, have no such pedigree, which is why I chose to start with nServiceBus as a foundation rather than starting from scratch.</p>
<p>So what is wrong with nServiceBus that required us to fork it? Well, nothing. My take on nServiceBus and the direction Udi Dahan seems to take the project is that it is a library designed to provide just enough rope to get the job done, but not enough rope for us developers or architects to hang ourselves from a scalability and reliability perspective as we wade into the asynchronous, messaging based waters for the first time. This is a very useful trait for a library to have. However, such an approach comes with some tradeoffs, namely when it comes to extensibility and customization, and I&#8217;m a lego brick kind of guy, maybe stemming from control issues, who knows <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>In service, I believe, of the protective and prescriptive nature of the project, nServiceBus has many of its most interesting parts &#8220;soldered to the motherboard&#8221; - their implementation is blended in with the default implementation of the framework itself, which means that if you want to customize how certain things work, you have to diverge from the codebase. Now, to be fair, this is only true to a certain extent. nServiceBus has several major pieces that can be swapped out, such as IBus and ITransport, but within the responsibilities of the default implementations of IBus or ITransport are a number of smaller components that can&#8217;t easily be customized.</p>
<p>It hardly seems necessary to go so far as to fork the project when custom IBus and ITransport implementations could have accomplished 95% of the flexibility I was going for. And, in reality, it probably wasn&#8217;t necessary - but once the thing was already on the operating table, I couldn&#8217;t resist making some preference based changes to the IBus API, and I wanted to add custom headers to the message envelope (which crosses between IBus and ITransport) and at that point there really wasn&#8217;t any turning back.</p>
<p>Another question would be, well, if nServiceBus didn&#8217;t have the extensibility you were after, why not choose Mass Transit? It is extensible. And, in fact, it is - but it is still fairly young, and we&#8217;ll be going into production very soon. nServiceBus has been through the fires a few times, and I figured I could add the hooks I needed without altering the fundamental design of how nServiceBus operates, which I quite like and I&#8217;ll sleep better at night because of it. My belief, though, that if it was six or eight months from now, Mass Transit would have been the direction I&#8217;d have taken. Also, I already had a project, NsbExtensions, that implemented endpoint health &amp; performance monitoring features on top of nServiceBus, and I wanted to be able to reuse all that code.</p>
<h3>Here are the design goals of Simple Service Bus - most but not all of which are realized but not thoroughly tested in the version currently posted to CodePlex:</h3>
<p><strong>* Small DLL footprint</strong> - nServiceBus (for valid architectural reasons) is split up into eleven thousand, two hundred and nine different DLL&#8217;s. That may be an exaggeration, but many of the dll&#8217;s have only one or two code files in them, with only a few lines of code each. Simple Service Bus comes in three DLL&#8217;s for a normal endpoint, and add&#8217;s a fourth to implement an Endpoint Health Monitoring Server. Also, required third party dependencies are kept to a minimum (0).</p>
<p><strong>* Custom headers in the Message Envelope</strong> - I wanted to be able to attach bits of information that are necessary for the messaging system to function properly, like authentication tokens or endpoint ID&#8217;s, without having to include those pieces of irrelevant data on the otherwise domain-oriented messages themselves. This results in a somewhat cleaner set of message contracts, but it also allows you to do some content based routing or authentication checks on a message before the payload ever has to waste the CPU&#8217;s time on deserialization. If a message is going to be blocked due to lack of authorization, or re-directed to a different endpoint, or simply written to disk as part of an audit process, there is no need to send the payload through the de-serialization / messaging handling process.</p>
<p><strong>* Send and Receive Pipeline Pattern for Message Processing </strong>- instead of having a hard-coded path from Transport through final Handling, Simple Service Bus provides a configurable Pipeline approach, where each interesting step in the messaging processing process is implemented as a pipeline component. This allows programmers to add, for example, a content based message router ahead of the payload deserialization component, or to add a statistics gathering component at various places within the pipeline. Additionally, a rich set of events are fired while a pipeline is processing a message, allowing fine grained performance monitoring or logging if required.</p>
<p><strong>* Replaceable Subsystems</strong> - each major concern of the bus has been factored into a simple subsystem as defined by an interface. The default implementation of any subsystem can easily be replaced. For example there is a Message Dispatcher subsystem, a Subscription Manager subsystem, a Message Serialization subsystem, a Message Type to Message Handler Resolution subsystem&#8230;etc. In this way, if you want to implement a Subscription Manager that can evaluate publisher-side expressions to determine whether or not to send a message to a particular subscriber using a custom DSL or any other expression evaluator, you can easily swap out the existing subscription manager with your enhanced one. And you can do it for just one endpoint, if only one endpoint needs that special functionality.</p>
<p><strong>* IoC supported, but not required</strong>. The building of objects is handled by subsystem as well, and the default implementation can be given a reference to an IoC container to build all objects and services, or it can use simple reflection if no IoC is provided. To accommodate this, a Service Locator was used rather than a pure dependency injection approach, but the services registered with the Service Locator can optionally be built with an IoC. Also, of course, all Message Handlers and Pipeline Components will be constructed on demand using an IoC if provided, or simple reflection otherwise.</p>
<p><strong>* Polymorphic Message Handlers </strong>- the default Message Handler Resolution Service allows message handlers to be defined for interfaces or base classes, allowing the creation of message handlers for families or categories of messages rather than just individual messages. This also applies to subscriptions, meaning that an endpoint can, for instance, subscribe to IEventMessage, and receive all messages that implement that interface, instead of being required to subscribe to each concrete message type.</p>
<p><strong>* Endpoint Health &amp; Performance Monitoring built into the core library </strong>- all endpoints can be configured to provide status reports to a monitor service with a few lines in the configuration file.</p>
<p><strong>* Simplified Configuration</strong> - this is debatable, because Udi Dahan has gone to significant lengths to partition &#8220;programmer configuration&#8221; from &#8220;administrator configuration&#8221; - the former being accomplished in code and the latter being accomplished in a configuration file. This is probably a wise, experienced based approach, but I myself like the option to configure everything in a single, simple block of XML, if XML is being used. So that is how Simple Service Bus does configuration, in a more traditional manner.</p>
<p><strong>* Abstract base classes</strong> provided for easily creating custom Transports, Pipeline Components, Performance Probes, etc., abstracting much of the ugly details and allowing the system to be extended by overriding a few simple, targeted methods.</p>
<p><strong>* Fully Unit Tested</strong> - this isn&#8217;t finished yet (I&#8217;m still trying to get the hang of TDD, so the tests weren&#8217;t written first in this case) but the idea is to have unit tests for each piece of the system, allowing modifications or customizations to be done in a safe, controlled manner.</p>
<p><strong>*object based API</strong>. I removed the IMessage marker interface for Simple Service Bus because (perhaps mostly for aesthetic reasons) I wanted our Message Definition dll&#8217;s to be as clean and reference free as possible. So now Send, Publish, etc. operate on System.Object rather than IMessage.</p>
<p>And that&#8217;s about it. I fell in love with Gregor Hohpe&#8217;s &#8220;Enterprise Integration Patterns&#8221; and wanted to apply those patterns to my own evolving messaging system, so this effort is sort of centered around enabling nServiceBus to accommodate that desire in a clean, plug and play way. We&#8217;ll see how it goes.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/hsidev.wordpress.com/88/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/hsidev.wordpress.com/88/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hsidev.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hsidev.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hsidev.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hsidev.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hsidev.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hsidev.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hsidev.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hsidev.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hsidev.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hsidev.wordpress.com/88/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hsidev.wordpress.com&blog=3345968&post=88&subd=hsidev&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hsidev.wordpress.com/2008/06/17/simple-service-bus-on-codeplex-a-fork-of-nservicebus/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/plasticlizard-128.jpg" medium="image">
			<media:title type="html">Nathan</media:title>
		</media:content>
	</item>
		<item>
		<title>A new ISB (Internet Service Bus) in beta testing - Linxter</title>
		<link>http://hsidev.wordpress.com/2008/06/11/a-new-isb-internet-service-bus-in-beta-testing-linxter/</link>
		<comments>http://hsidev.wordpress.com/2008/06/11/a-new-isb-internet-service-bus-in-beta-testing-linxter/#comments</comments>
		<pubDate>Thu, 12 Jun 2008 05:11:11 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
		
		<category><![CDATA[API]]></category>

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

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

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

		<guid isPermaLink="false">http://hsidev.wordpress.com/2008/06/11/a-new-isb-internet-service-bus-in-beta-testing-linxter/</guid>
		<description><![CDATA[
Similar to BizTalk services, minus the workflow/identity piece but plus a fairly robust security model and web based management dashboard, Linxter(http://www.linxter.com) provides a secure, queued transport for .NET applications. Essentially the service acts as a hosted messaging queue with an extremely simple (in a good way) API and an interesting ability to optionally send file [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://linxter.com/"><img alt="Home" src="http://linxter.com/files/Linxter_logo.png"></a></p>
<p>Similar to BizTalk services, minus the workflow/identity piece but plus a fairly robust security model and web based management dashboard, <a href="http://linxter.com/">Linxter</a>(http://www.linxter.com) provides a secure, queued transport for .NET applications. Essentially the service acts as a hosted messaging queue with an extremely simple (in a good way) API and an interesting ability to optionally send file attachments with your messages, which right off the bat gives it an edge over MSMQ over HTTP in my mind. Applications using this API will request registration with a central account on startup and security settings determine if the connection is automatically granted or if an administrator has to manually grant access to your bus to the endpoint. Once access is granted, endpoints (via the Linxter SDK) can send messages and receive messages in either an &#8220;on-demand&#8221; pull model or an event based push model. The service also supports broadcasting messages to multiple endpoints.</p>
<p>This isn&#8217;t something that could act <em>as</em> an ESB, but it could certainly act as a transport for an ESB. The service doesn&#8217;t have any pricing announced and the user agreement forbids production or commercial use, but it is something to watch if such a service would be useful to you.</p>
<p>In our case it would be perfect for connecting client systems to our hosted solutions without having to deal with ensuring MSMQ w/HTTP support is properly installed on each endpoint machine, and ensuring the proper queues are set up, etc. Much easier deployment and maintenance for remote nodes not in our firewall. If all your endpoints are inside your firewall, a hosted queuing service may be of little value, but if you have endpoints in the wooly wild, a service like this could be invaluable, taking care of endpoint authorization, identification, and all the rest.</p>
<p><a href="http://linxter.com/releaseSchedule">Here is a link to the current stage of development, which appears to be nearing the end of Beta 2</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/hsidev.wordpress.com/87/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/hsidev.wordpress.com/87/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hsidev.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hsidev.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hsidev.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hsidev.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hsidev.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hsidev.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hsidev.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hsidev.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hsidev.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hsidev.wordpress.com/87/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hsidev.wordpress.com&blog=3345968&post=87&subd=hsidev&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://hsidev.wordpress.com/2008/06/11/a-new-isb-internet-service-bus-in-beta-testing-linxter/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/plasticlizard-128.jpg" medium="image">
			<media:title type="html">Nathan</media:title>
		</media:content>

		<media:content url="http://linxter.com/files/Linxter_logo.png" medium="image">
			<media:title type="html">Home</media:title>
		</media:content>
	</item>
	</channel>
</rss>