<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" version="2.0">
  <channel>
    <title>Eleutian SpeakENG Development Blog</title>
    <link>http://blog.eleutian.com/</link>
    <description />
    <language>en-us</language>
    <copyright>Eleutian Technology</copyright>
    <lastBuildDate>Mon, 27 Oct 2008 01:12:55 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.0.7226.0</generator>
    <managingEditor>aaron@eleutian.com</managingEditor>
    <webMaster>aaron@eleutian.com</webMaster>
    <item>
      <trackback:ping>http://blog.eleutian.com/Trackback.aspx?guid=f418a230-f873-408c-ad4a-f24492c0da20</trackback:ping>
      <pingback:server>http://blog.eleutian.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eleutian.com/PermaLink,guid,f418a230-f873-408c-ad4a-f24492c0da20.aspx</pingback:target>
      <dc:creator>Aaron</dc:creator>
      <wfw:comment>http://blog.eleutian.com/CommentView,guid,f418a230-f873-408c-ad4a-f24492c0da20.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eleutian.com/SyndicationService.asmx/GetEntryCommentsRss?guid=f418a230-f873-408c-ad4a-f24492c0da20</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="166" alt="myImage (1)" src="http://blog.eleutian.com/content/binary/WindowsLiveWriter/RapidUIMockupswithBalsamiq_10007/myImage%20(1)_3.png" width="231" align="right" border="0" />I
recently came across <a href="http://balsamiq.com/">Balsamiq</a>, a very well done
application for quickly mocking up UI prototypes. With simple drag and drops you can
quickly create some pretty slick prototypes. The prototypes have a sketch like look
which allows the viewer to use more of their imagination, something I think is a subtle,
yet powerful advantage.
</p>
        <p>
          <img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px; border-right-width: 0px" height="158" alt="mockups_fpa" src="http://blog.eleutian.com/content/binary/WindowsLiveWriter/RapidUIMockupswithBalsamiq_10007/mockups_fpa_3.jpg" width="204" align="left" border="0" />It's
been a while since I've been so impressed with an app right out of the box... especially
a Flash app. Just about everything works as I'd expect, right down to common keyboard
shortcuts. It's got good organization in it's "ribbon" and so far it's had just about
every type of thing I need. It looks like it has JIRA and Confluence support, though
that's a bit on the pricey side. The Desktop version is reasonably priced though,
and the web version seems to be free to use if you can put up with a nag every 5 minutes.
</p>
        <p>
Nothing beats a whiteboard if you're all in the same office, but I'd say this is a
close second. Certainly better than Visio :)
</p>
        <img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=f418a230-f873-408c-ad4a-f24492c0da20" />
      </body>
      <title>Rapid UI Mockups with Balsamiq</title>
      <guid isPermaLink="false">http://blog.eleutian.com/PermaLink,guid,f418a230-f873-408c-ad4a-f24492c0da20.aspx</guid>
      <link>http://blog.eleutian.com/2008/10/27/RapidUIMockupsWithBalsamiq.aspx</link>
      <pubDate>Mon, 27 Oct 2008 01:12:55 GMT</pubDate>
      <description>&lt;p&gt;
&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="166" alt="myImage (1)" src="http://blog.eleutian.com/content/binary/WindowsLiveWriter/RapidUIMockupswithBalsamiq_10007/myImage%20(1)_3.png" width="231" align="right" border="0"&gt;I
recently came across &lt;a href="http://balsamiq.com/"&gt;Balsamiq&lt;/a&gt;, a very well done
application for quickly mocking up UI prototypes. With simple drag and drops you can
quickly create some pretty slick prototypes. The prototypes have a sketch like look
which allows the viewer to use more of their imagination, something I think is a subtle,
yet powerful advantage.
&lt;/p&gt;
&lt;p&gt;
&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px; border-right-width: 0px" height="158" alt="mockups_fpa" src="http://blog.eleutian.com/content/binary/WindowsLiveWriter/RapidUIMockupswithBalsamiq_10007/mockups_fpa_3.jpg" width="204" align="left" border="0"&gt;It's
been a while since I've been so impressed with an app right out of the box... especially
a Flash app. Just about everything works as I'd expect, right down to common keyboard
shortcuts. It's got good organization in it's "ribbon" and so far it's had just about
every type of thing I need. It looks like it has JIRA and Confluence support, though
that's a bit on the pricey side. The Desktop version is reasonably priced though,
and the web version seems to be free to use if you can put up with a nag every 5 minutes.
&lt;/p&gt;
&lt;p&gt;
Nothing beats a whiteboard if you're all in the same office, but I'd say this is a
close second. Certainly better than Visio :)
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=f418a230-f873-408c-ad4a-f24492c0da20" /&gt;</description>
      <comments>http://blog.eleutian.com/CommentView,guid,f418a230-f873-408c-ad4a-f24492c0da20.aspx</comments>
      <category>random</category>
    </item>
    <item>
      <trackback:ping>http://blog.eleutian.com/Trackback.aspx?guid=25fb3904-3f89-4e28-9296-2b5eb127ecf5</trackback:ping>
      <pingback:server>http://blog.eleutian.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eleutian.com/PermaLink,guid,25fb3904-3f89-4e28-9296-2b5eb127ecf5.aspx</pingback:target>
      <dc:creator>Aaron</dc:creator>
      <wfw:comment>http://blog.eleutian.com/CommentView,guid,25fb3904-3f89-4e28-9296-2b5eb127ecf5.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eleutian.com/SyndicationService.asmx/GetEntryCommentsRss?guid=25fb3904-3f89-4e28-9296-2b5eb127ecf5</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Assembla was annoying us for a variety of reasons so we <a href="http://github.com/machine/machine/tree/master">moved
Machine to github</a>.
</p>
        <pre>git clone git://github.com/machine/machine.git</pre>
        <p>
The astute may notice a few other repositories in the machine account... Jacob's been
busy. We'll announce those projects in due time...
</p>
        <img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=25fb3904-3f89-4e28-9296-2b5eb127ecf5" />
      </body>
      <title>Machine has moved</title>
      <guid isPermaLink="false">http://blog.eleutian.com/PermaLink,guid,25fb3904-3f89-4e28-9296-2b5eb127ecf5.aspx</guid>
      <link>http://blog.eleutian.com/2008/10/22/MachineHasMoved.aspx</link>
      <pubDate>Wed, 22 Oct 2008 19:57:32 GMT</pubDate>
      <description>&lt;p&gt;
Assembla was annoying us for a variety of reasons so we &lt;a href="http://github.com/machine/machine/tree/master"&gt;moved
Machine to github&lt;/a&gt;.
&lt;/p&gt;
&lt;pre&gt;git clone git://github.com/machine/machine.git&lt;/pre&gt;
&lt;p&gt;
The astute may notice a few other repositories in the machine account... Jacob's been
busy. We'll announce those projects in due time...
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=25fb3904-3f89-4e28-9296-2b5eb127ecf5" /&gt;</description>
      <comments>http://blog.eleutian.com/CommentView,guid,25fb3904-3f89-4e28-9296-2b5eb127ecf5.aspx</comments>
      <category>machine</category>
    </item>
    <item>
      <trackback:ping>http://blog.eleutian.com/Trackback.aspx?guid=23994350-beff-46f3-ba72-c072e0ea0417</trackback:ping>
      <pingback:server>http://blog.eleutian.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eleutian.com/PermaLink,guid,23994350-beff-46f3-ba72-c072e0ea0417.aspx</pingback:target>
      <dc:creator>Aaron</dc:creator>
      <wfw:comment>http://blog.eleutian.com/CommentView,guid,23994350-beff-46f3-ba72-c072e0ea0417.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eleutian.com/SyndicationService.asmx/GetEntryCommentsRss?guid=23994350-beff-46f3-ba72-c072e0ea0417</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <h2>Does ReSharper want to make your specs look like this?
</h2>
        <img height="384" alt="Superfluous privates, indentation and warnings" src="http://content.screencast.com/users/ajensen/folders/Jing/media/5626ca97-5e0c-43d8-9db1-c1f7bac75fb9/2008-10-19_1449.png" width="613" border="0" />
        <h2>But you want your specs to look like this?
</h2>
        <img height="386" alt="clean text with less noise" src="http://content.screencast.com/users/ajensen/folders/Jing/media/56b442ae-5b4d-4577-9807-762412ae5fbc/2008-10-19_1503.png" width="556" border="0" />
        <h2>Just follow these easy steps:
</h2>
        <ol style="font-size: 1.6em">
          <li>
            <p>
Go to Resharper&gt;Options
</p>
            <img height="270" src="http://content.screencast.com/users/ajensen/folders/Jing/media/6812b390-e28c-4ff5-b47e-c4a803a44f94/2008-10-19_1454.png" width="226" border="0" />
          </li>
          <li>
            <p>
Go to Languages&gt;C#&gt;Formatting Style&gt;Other
</p>
            <img height="490" src="http://content.screencast.com/users/ajensen/folders/Jing/media/689e080c-83e2-479b-88fd-00b1578d5695/2008-10-19_1455.png" width="190" border="0" />
          </li>
          <li>
            <p>
Uncheck Modifiers&gt;Use explicit private modifier
</p>
            <img height="101" src="http://content.screencast.com/users/ajensen/folders/Jing/media/d1209891-e09b-4312-a545-f00a1cef1149/2008-10-19_1456.png" width="444" border="0" />
          </li>
          <li>
            <p>
Uncheck Other&gt;Indent anonymous method body and hit OK
</p>
            <img height="158" src="http://content.screencast.com/users/ajensen/folders/Jing/media/a652911f-6e7c-4ee1-ae8b-7f63f605dbde/2008-10-19_1458.png" width="390" border="0" />
          </li>
          <li>
            <p>
Go to your project properties&gt;Build and suppress warning 169
</p>
            <img height="363" src="http://content.screencast.com/users/ajensen/folders/Jing/media/74e14bde-982d-456d-9512-f45c29015661/2008-10-19_1511.png" width="493" border="0" />
          </li>
          <li>
            <p>
Enjoy!
</p>
          </li>
        </ol>
        <img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=23994350-beff-46f3-ba72-c072e0ea0417" />
      </body>
      <title>Getting ReSharper and VS to play nice with MSpec</title>
      <guid isPermaLink="false">http://blog.eleutian.com/PermaLink,guid,23994350-beff-46f3-ba72-c072e0ea0417.aspx</guid>
      <link>http://blog.eleutian.com/2008/10/19/GettingReSharperAndVSToPlayNiceWithMSpec.aspx</link>
      <pubDate>Sun, 19 Oct 2008 22:18:25 GMT</pubDate>
      <description>&lt;h2&gt;Does ReSharper want to make your specs look like this?
&lt;/h2&gt;
&lt;img height="384" alt="Superfluous privates, indentation and warnings" src="http://content.screencast.com/users/ajensen/folders/Jing/media/5626ca97-5e0c-43d8-9db1-c1f7bac75fb9/2008-10-19_1449.png" width="613" border="0" /&gt; 
&lt;h2&gt;But you want your specs to look like this?
&lt;/h2&gt;
&lt;img height="386" alt="clean text with less noise" src="http://content.screencast.com/users/ajensen/folders/Jing/media/56b442ae-5b4d-4577-9807-762412ae5fbc/2008-10-19_1503.png" width="556" border="0" /&gt; 
&lt;h2&gt;Just follow these easy steps:
&lt;/h2&gt;
&lt;ol style="font-size: 1.6em"&gt;
&lt;li&gt;
&lt;p&gt;
Go to Resharper&amp;gt;Options
&lt;/p&gt;
&lt;img height="270" src="http://content.screencast.com/users/ajensen/folders/Jing/media/6812b390-e28c-4ff5-b47e-c4a803a44f94/2008-10-19_1454.png" width="226" border="0" /&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
Go to Languages&amp;gt;C#&amp;gt;Formatting Style&amp;gt;Other
&lt;/p&gt;
&lt;img height="490" src="http://content.screencast.com/users/ajensen/folders/Jing/media/689e080c-83e2-479b-88fd-00b1578d5695/2008-10-19_1455.png" width="190" border="0" /&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
Uncheck Modifiers&amp;gt;Use explicit private modifier
&lt;/p&gt;
&lt;img height="101" src="http://content.screencast.com/users/ajensen/folders/Jing/media/d1209891-e09b-4312-a545-f00a1cef1149/2008-10-19_1456.png" width="444" border="0" /&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
Uncheck Other&amp;gt;Indent anonymous method body and hit OK
&lt;/p&gt;
&lt;img height="158" src="http://content.screencast.com/users/ajensen/folders/Jing/media/a652911f-6e7c-4ee1-ae8b-7f63f605dbde/2008-10-19_1458.png" width="390" border="0" /&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
Go to your project properties&amp;gt;Build and suppress warning 169
&lt;/p&gt;
&lt;img height="363" src="http://content.screencast.com/users/ajensen/folders/Jing/media/74e14bde-982d-456d-9512-f45c29015661/2008-10-19_1511.png" width="493" border="0" /&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
Enjoy!
&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=23994350-beff-46f3-ba72-c072e0ea0417" /&gt;</description>
      <comments>http://blog.eleutian.com/CommentView,guid,23994350-beff-46f3-ba72-c072e0ea0417.aspx</comments>
      <category>bdd</category>
      <category>mspec</category>
      <category>resharper</category>
    </item>
    <item>
      <trackback:ping>http://blog.eleutian.com/Trackback.aspx?guid=3d64e14f-379a-4bf1-b167-6d6eb8ae0f33</trackback:ping>
      <pingback:server>http://blog.eleutian.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eleutian.com/PermaLink,guid,3d64e14f-379a-4bf1-b167-6d6eb8ae0f33.aspx</pingback:target>
      <dc:creator>Aaron</dc:creator>
      <wfw:comment>http://blog.eleutian.com/CommentView,guid,3d64e14f-379a-4bf1-b167-6d6eb8ae0f33.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eleutian.com/SyndicationService.asmx/GetEntryCommentsRss?guid=3d64e14f-379a-4bf1-b167-6d6eb8ae0f33</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Unlike vanilla TDD, the artifacts produced by BDD can and should be read by more than
just developers. Most of us who practice TDD name our tests more or less like this:
</p>
        <pre>MessageBoardControllerTests.Index_WithTenMessages_ReturnsFiveMostRecentFromRepository()</pre>
        <p>
Shifting into Context/Specification style testing, one may be tempted to write specs
like this:
</p>
        <pre>MessageBoardController, when invoking index action when there are ten messages, 
  should return five most recent messages from the repository</pre>
        <p>
The problem with this spec is subtle but important. You often want these specs to
be readable and understandable by a normal person, someone in your business that can
provide you feedback on your specs. Using words like "invoking", "index",
"action" and "repository" are clear indicators that your audience
is another developer. You should use the time writing specs to speak in the language
of the business and to clarify your ubiquitous language. Here's how I'd rewrite this:
</p>
        <pre>Message Board, when viewed
  should show only the five most recent messages</pre>
        <p>
Again, the difference is subtle, but notice how I could show this to anyone in the
company and they would understand exactly what is happening.
</p>
        <p>
There are times for developer speak in specs I believe. If you are specing an API
to be consumed by other developers I think it's ok to use words like "throw"
and "return" because that is what the developers care about when integrating
with an API.
</p>
        <p>
Most of the time however, especially when writing the more UI/System Behavior level
specs, you should consider who your audience is and try to speak like them. The code
itself will provide the detail a developer needs to understand it.
</p>
        <p>
As an aside, this is one of the many reasons I prefer the Context/Specification style
to Given/When/Then style of BDD. Because people already don't speak in Given/When/Then
prose in real life, it makes it even more difficult to write your specs for the intended
audience. It also leads you to use magic numbers and other magic state in your prose
rather than formalizing business concepts and improving your ubiquitous language.
</p>
        <img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=3d64e14f-379a-4bf1-b167-6d6eb8ae0f33" />
      </body>
      <title>BDD &amp;ndash; Consider your audience</title>
      <guid isPermaLink="false">http://blog.eleutian.com/PermaLink,guid,3d64e14f-379a-4bf1-b167-6d6eb8ae0f33.aspx</guid>
      <link>http://blog.eleutian.com/2008/10/19/BDDNdashConsiderYourAudience.aspx</link>
      <pubDate>Sun, 19 Oct 2008 17:24:03 GMT</pubDate>
      <description>&lt;p&gt;
Unlike vanilla TDD, the artifacts produced by BDD can and should be read by more than
just developers. Most of us who practice TDD name our tests more or less like this:
&lt;/p&gt;
&lt;pre&gt;MessageBoardControllerTests.Index_WithTenMessages_ReturnsFiveMostRecentFromRepository()&lt;/pre&gt;
&lt;p&gt;
Shifting into Context/Specification style testing, one may be tempted to write specs
like this:
&lt;/p&gt;
&lt;pre&gt;MessageBoardController, when invoking index action when there are ten messages, 
  should return five most recent messages from the repository&lt;/pre&gt;
&lt;p&gt;
The problem with this spec is subtle but important. You often want these specs to
be readable and understandable by a normal person, someone in your business that can
provide you feedback on your specs. Using words like &amp;quot;invoking&amp;quot;, &amp;quot;index&amp;quot;,
&amp;quot;action&amp;quot; and &amp;quot;repository&amp;quot; are clear indicators that your audience
is another developer. You should use the time writing specs to speak in the language
of the business and to clarify your ubiquitous language. Here's how I'd rewrite this:
&lt;/p&gt;
&lt;pre&gt;Message Board, when viewed
  should show only the five most recent messages&lt;/pre&gt;
&lt;p&gt;
Again, the difference is subtle, but notice how I could show this to anyone in the
company and they would understand exactly what is happening.
&lt;/p&gt;
&lt;p&gt;
There are times for developer speak in specs I believe. If you are specing an API
to be consumed by other developers I think it's ok to use words like &amp;quot;throw&amp;quot;
and &amp;quot;return&amp;quot; because that is what the developers care about when integrating
with an API.
&lt;/p&gt;
&lt;p&gt;
Most of the time however, especially when writing the more UI/System Behavior level
specs, you should consider who your audience is and try to speak like them. The code
itself will provide the detail a developer needs to understand it.
&lt;/p&gt;
&lt;p&gt;
As an aside, this is one of the many reasons I prefer the Context/Specification style
to Given/When/Then style of BDD. Because people already don't speak in Given/When/Then
prose in real life, it makes it even more difficult to write your specs for the intended
audience. It also leads you to use magic numbers and other magic state in your prose
rather than formalizing business concepts and improving your ubiquitous language.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=3d64e14f-379a-4bf1-b167-6d6eb8ae0f33" /&gt;</description>
      <comments>http://blog.eleutian.com/CommentView,guid,3d64e14f-379a-4bf1-b167-6d6eb8ae0f33.aspx</comments>
      <category>bdd</category>
    </item>
    <item>
      <trackback:ping>http://blog.eleutian.com/Trackback.aspx?guid=2abf494c-72e0-4417-87ac-161040a7ce40</trackback:ping>
      <pingback:server>http://blog.eleutian.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eleutian.com/PermaLink,guid,2abf494c-72e0-4417-87ac-161040a7ce40.aspx</pingback:target>
      <dc:creator>Aaron</dc:creator>
      <wfw:comment>http://blog.eleutian.com/CommentView,guid,2abf494c-72e0-4417-87ac-161040a7ce40.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eleutian.com/SyndicationService.asmx/GetEntryCommentsRss?guid=2abf494c-72e0-4417-87ac-161040a7ce40</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Jacob and I just got back from Austin, TX where we were fortunate enough to attend
the week long, lengthily titled <a href="http://www.headspringsystems.com/soa/">Advanced
Distributed Systems Design using SOA &amp; DDD with Udi Dahan, The Software Simplist</a>.
</p>
        <p>
Awesome. Just awesome. We’d been meaning to delve into messaging at Eleutian after
multiple discussions with and blog posts from <a href="http://codebetter.com/blogs/gregyoung/">Greg
Young</a> and <a href="http://www.udidahan.com/">Udi Dahan</a> in the past. We weren’t
entirely sure where to start, how to start, what tools to use, how to use them, etc.
Being able to sit in a room with Udi for an entire week while he described exactly
how, why and what he does to tackle a massive enterprise system was invaluable to
say the least. 
</p>
        <p>
We now have a much better direction and, more importantly, have the confidence we
need to start introducing these powerful concepts into production at Eleutian.
</p>
        <p>
If Udi’s ever in your area giving this course and you’ve got a company that cares
about their scalability, reliability and maintainability enough to see the value in
such an offering, I’d strongly advise giving it a go.
</p>
        <img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=2abf494c-72e0-4417-87ac-161040a7ce40" />
      </body>
      <title>Udi Dahan&amp;rsquo;s SOA Bootcamp</title>
      <guid isPermaLink="false">http://blog.eleutian.com/PermaLink,guid,2abf494c-72e0-4417-87ac-161040a7ce40.aspx</guid>
      <link>http://blog.eleutian.com/2008/10/19/UdiDahanrsquosSOABootcamp.aspx</link>
      <pubDate>Sun, 19 Oct 2008 15:52:18 GMT</pubDate>
      <description>&lt;p&gt;
Jacob and I just got back from Austin, TX where we were fortunate enough to attend
the week long, lengthily titled &lt;a href="http://www.headspringsystems.com/soa/"&gt;Advanced
Distributed Systems Design using SOA &amp;amp; DDD with Udi Dahan, The Software Simplist&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Awesome. Just awesome. We’d been meaning to delve into messaging at Eleutian after
multiple discussions with and blog posts from &lt;a href="http://codebetter.com/blogs/gregyoung/"&gt;Greg
Young&lt;/a&gt; and &lt;a href="http://www.udidahan.com/"&gt;Udi Dahan&lt;/a&gt; in the past. We weren’t
entirely sure where to start, how to start, what tools to use, how to use them, etc.
Being able to sit in a room with Udi for an entire week while he described exactly
how, why and what he does to tackle a massive enterprise system was invaluable to
say the least. 
&lt;/p&gt;
&lt;p&gt;
We now have a much better direction and, more importantly, have the confidence we
need to start introducing these powerful concepts into production at Eleutian.
&lt;/p&gt;
&lt;p&gt;
If Udi’s ever in your area giving this course and you’ve got a company that cares
about their scalability, reliability and maintainability enough to see the value in
such an offering, I’d strongly advise giving it a go.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=2abf494c-72e0-4417-87ac-161040a7ce40" /&gt;</description>
      <comments>http://blog.eleutian.com/CommentView,guid,2abf494c-72e0-4417-87ac-161040a7ce40.aspx</comments>
      <category>soa</category>
      <category>training</category>
    </item>
    <item>
      <trackback:ping>http://blog.eleutian.com/Trackback.aspx?guid=1ae1cf90-fcc9-452d-ac1a-218de4d3fe1d</trackback:ping>
      <pingback:server>http://blog.eleutian.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eleutian.com/PermaLink,guid,1ae1cf90-fcc9-452d-ac1a-218de4d3fe1d.aspx</pingback:target>
      <dc:creator>Aaron</dc:creator>
      <wfw:comment>http://blog.eleutian.com/CommentView,guid,1ae1cf90-fcc9-452d-ac1a-218de4d3fe1d.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eleutian.com/SyndicationService.asmx/GetEntryCommentsRss?guid=1ae1cf90-fcc9-452d-ac1a-218de4d3fe1d</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://blog.codeville.net/">Steve Sanderson</a> is apparently writing <a href="http://apress.com/community/mvc">two
Apress books</a> on <a href="http://www.asp.net/mvc/">ASP.NET MVC</a>. While doing
so, he’s been digging deep into the framework and inventing/discovering some pretty
amazing things. My favorites thus far are:
</p>
        <p>
          <a href="http://blog.codeville.net/2008/10/14/partial-requests-in-aspnet-mvc/">Partial
Requests in ASP.NET MVC</a>
        </p>
        <p>
          <a href="http://blog.codeville.net/2008/10/15/partial-output-caching-in-aspnet-mvc/">Partial
Output Caching in ASP.NET MVC</a>
        </p>
        <p>
I’m yet to use it seriously, but I’m pretty sure this is a big part of what I’ve been
looking for when it comes to components in MVC. Definitely going to keep an eye on
his <a href="http://blog.codeville.net/2008/10/15/partial-output-caching-in-aspnet-mvc/">blog</a>.
</p>
        <img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=1ae1cf90-fcc9-452d-ac1a-218de4d3fe1d" />
      </body>
      <title>Want to do cool things with ASP.NET MVC?</title>
      <guid isPermaLink="false">http://blog.eleutian.com/PermaLink,guid,1ae1cf90-fcc9-452d-ac1a-218de4d3fe1d.aspx</guid>
      <link>http://blog.eleutian.com/2008/10/19/WantToDoCoolThingsWithASPNETMVC.aspx</link>
      <pubDate>Sun, 19 Oct 2008 15:41:01 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://blog.codeville.net/"&gt;Steve Sanderson&lt;/a&gt; is apparently writing &lt;a href="http://apress.com/community/mvc"&gt;two
Apress books&lt;/a&gt; on &lt;a href="http://www.asp.net/mvc/"&gt;ASP.NET MVC&lt;/a&gt;. While doing
so, he’s been digging deep into the framework and inventing/discovering some pretty
amazing things. My favorites thus far are:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.codeville.net/2008/10/14/partial-requests-in-aspnet-mvc/"&gt;Partial
Requests in ASP.NET MVC&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.codeville.net/2008/10/15/partial-output-caching-in-aspnet-mvc/"&gt;Partial
Output Caching in ASP.NET MVC&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
I’m yet to use it seriously, but I’m pretty sure this is a big part of what I’ve been
looking for when it comes to components in MVC. Definitely going to keep an eye on
his &lt;a href="http://blog.codeville.net/2008/10/15/partial-output-caching-in-aspnet-mvc/"&gt;blog&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=1ae1cf90-fcc9-452d-ac1a-218de4d3fe1d" /&gt;</description>
      <comments>http://blog.eleutian.com/CommentView,guid,1ae1cf90-fcc9-452d-ac1a-218de4d3fe1d.aspx</comments>
      <category>asp.net mvc</category>
    </item>
    <item>
      <trackback:ping>http://blog.eleutian.com/Trackback.aspx?guid=ff788dca-fce2-4ad7-856d-c1a7745a2517</trackback:ping>
      <pingback:server>http://blog.eleutian.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eleutian.com/PermaLink,guid,ff788dca-fce2-4ad7-856d-c1a7745a2517.aspx</pingback:target>
      <dc:creator>Aaron</dc:creator>
      <wfw:comment>http://blog.eleutian.com/CommentView,guid,ff788dca-fce2-4ad7-856d-c1a7745a2517.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eleutian.com/SyndicationService.asmx/GetEntryCommentsRss?guid=ff788dca-fce2-4ad7-856d-c1a7745a2517</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
It's been a while, but we've gotten several new things into Machine.Specifications
(MSpec). I'm excited to finally release them for everyone to start playing with. You
can grab the bits <a href="http://www.assembla.com/spaces/machine/documents/aNW0n0Etir3yXNab7jnrAJ/download/mspec-0.2.zip">here</a>.
</p>
        <p>
Let's talk about what's new though. Here's an example of a new context/spec:
</p>
        <pre class="c-sharp" name="code">  [Concern("Console runner")]
  public class when_specifying_a_missing_assembly_on_the_command_line
  {
    Establish context = ()=&gt;
    {
      console = new FakeConsole();
      program = new Program(console);
    };

    Because of = ()=&gt;
      exitCode = program.Run(new string[] {missingAssemblyName});

    It should_output_an_error_message_with_the_name_of_the_missing_assembly = ()=&gt;
      console.Lines.ShouldContain(string.Format(Resources.MissingAssemblyError, 
      missingAssemblyName));

    It should_return_the_Error_exit_code = ()=&gt;
      exitCode.ShouldEqual(ExitCode.Error);

    const string missingAssemblyName = "Some.Missing.Assembly.dll";
    public static ExitCode exitCode;
    public static Program program;
    public static FakeConsole console;
  }
</pre>
        <p>
          <strong>There have been a few semantic changes</strong>
        </p>
        <ul>
          <li>
The Description attribute has been removed. There is now an optional Concern attribute
that allows you to specify a type and/or a string that the context/spec is concerned
with. 
</li>
          <li>
            <strong>Context before_each</strong> is now <strong>Establish context</strong>. 
</li>
          <li>
            <strong>Context before_all</strong> is now <strong>Establish context_once</strong>. 
</li>
          <li>
            <strong>Context after_each </strong>is now <strong>Cleanup after_each</strong>. 
</li>
          <li>
            <strong>Context after_all</strong> is now <strong>Cleanup after_each</strong>. 
</li>
          <li>
            <strong>When {...}</strong> is now <strong>Because of</strong>. This is closer to
SpecUnit.NET's verbage, and doesn't force you to specify the "when" twice. 
</li>
        </ul>
        <p>
          <strong>There is now a console runner</strong>
        </p>
        <p>
We don't quite have all the options we want yet, but the basics of the runner are
working. Here's the help from the runner:
</p>
        <img height="163" src="http://content.screencast.com/users/ajensen/folders/Jing/media/0b6d7837-d45c-4124-93f7-38bc37a7fa7b/2008-09-02_1429.png" width="588" border="0" />
        <p>
We also stole Bellware's SpecUnit.NET reporting stuff and ported it over. You can
now generate a report on your specs with the --html 
<file.html>
switch. Here's an example run:
</file.html></p>
        <img height="355" src="http://content.screencast.com/users/ajensen/folders/Jing/media/aef95516-cf4e-4df0-b428-a890624abcfe/2008-09-02_1436.png" width="588" border="0" />
        <p>
          <a href="http://blog.eleutian.com/download/mspec-0.2run.html">This is the report it
generates.</a>
        </p>
        <p>
Want to try it out?
</p>
        <ol>
          <li>
Grab the drop <a href="http://www.assembla.com/spaces/machine/documents/aNW0n0Etir3yXNab7jnrAJ/download/mspec-0.2.zip">here</a>. 
</li>
          <li>
Extract it somewhere. Put it somewhere semi-permanent because the <a href="http://testdriven.net/">TestDriven.NET</a> runner
will need a static location for the MSpec TDNet Runner. 
</li>
          <li>
If you want TestDriven.NET support, run <strong>InstallTDNetRunner.bat</strong></li>
          <li>
Check out the example in <strong>Machine.Specifications.Example</strong>. Note that
you can run with TD.NET. 
</li>
          <li>
Create a project of your own. Just add <strong>Machine.Specifications.dll</strong> and
get started. 
</li>
          <li>
Send me feedback! Leave comments, email me, <a href="http://twitter.com/aaronjensen">tweet
me</a>, whatever. 
</li>
        </ol>
        <p>
Also, this is part of <a href="http://www.assembla.com/wiki/show/machine">Machine</a>,
so feel free to take a <a href="http://svn2.assembla.com/svn/machine/trunk/">look
at the code</a> and/or submit patches. There's also a <a href="http://www.gallio.org/">Gallio</a> adapter
in there, but I didn't include it in the release as it's not quite polished enough
yet. If you're interested in it, talk to me. Special thanks to <a href="http://twitter.com/sbellware">Scott
Bellware</a>, <a href="http://blog.bits-in-motion.com/">Jeff Brown</a> and <a href="http://weblogs.asp.net/nunitaddin/default.aspx">Jamie
Cansdale</a> for their help and support. Also, extra special thanks to Eleutian's
newest dev, Jeff Olson for much of the recent work that has gone into MSpec!
</p>
        <img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=ff788dca-fce2-4ad7-856d-c1a7745a2517" />
      </body>
      <title>MSpec v0.2</title>
      <guid isPermaLink="false">http://blog.eleutian.com/PermaLink,guid,ff788dca-fce2-4ad7-856d-c1a7745a2517.aspx</guid>
      <link>http://blog.eleutian.com/2008/09/02/MSpecV02.aspx</link>
      <pubDate>Tue, 02 Sep 2008 21:49:51 GMT</pubDate>
      <description>&lt;p&gt;
It's been a while, but we've gotten several new things into Machine.Specifications
(MSpec). I'm excited to finally release them for everyone to start playing with. You
can grab the bits &lt;a href="http://www.assembla.com/spaces/machine/documents/aNW0n0Etir3yXNab7jnrAJ/download/mspec-0.2.zip"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Let's talk about what's new though. Here's an example of a new context/spec:
&lt;/p&gt;
&lt;pre class="c-sharp" name="code"&gt;  [Concern("Console runner")]
  public class when_specifying_a_missing_assembly_on_the_command_line
  {
    Establish context = ()=&amp;gt;
    {
      console = new FakeConsole();
      program = new Program(console);
    };

    Because of = ()=&amp;gt;
      exitCode = program.Run(new string[] {missingAssemblyName});

    It should_output_an_error_message_with_the_name_of_the_missing_assembly = ()=&amp;gt;
      console.Lines.ShouldContain(string.Format(Resources.MissingAssemblyError, 
      missingAssemblyName));

    It should_return_the_Error_exit_code = ()=&amp;gt;
      exitCode.ShouldEqual(ExitCode.Error);

    const string missingAssemblyName = "Some.Missing.Assembly.dll";
    public static ExitCode exitCode;
    public static Program program;
    public static FakeConsole console;
  }
&lt;/pre&gt;
&lt;p&gt;
&lt;strong&gt;There have been a few semantic changes&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
The Description attribute has been removed. There is now an optional Concern attribute
that allows you to specify a type and/or a string that the context/spec is concerned
with. 
&lt;li&gt;
&lt;strong&gt;Context before_each&lt;/strong&gt; is now &lt;strong&gt;Establish context&lt;/strong&gt;. 
&lt;li&gt;
&lt;strong&gt;Context before_all&lt;/strong&gt; is now &lt;strong&gt;Establish context_once&lt;/strong&gt;. 
&lt;li&gt;
&lt;strong&gt;Context after_each &lt;/strong&gt;is now &lt;strong&gt;Cleanup after_each&lt;/strong&gt;. 
&lt;li&gt;
&lt;strong&gt;Context after_all&lt;/strong&gt; is now &lt;strong&gt;Cleanup after_each&lt;/strong&gt;. 
&lt;li&gt;
&lt;strong&gt;When {...}&lt;/strong&gt; is now &lt;strong&gt;Because of&lt;/strong&gt;. This is closer to
SpecUnit.NET's verbage, and doesn't force you to specify the "when" twice. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;There is now a console runner&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
We don't quite have all the options we want yet, but the basics of the runner are
working. Here's the help from the runner:
&lt;/p&gt;
&lt;img height="163" src="http://content.screencast.com/users/ajensen/folders/Jing/media/0b6d7837-d45c-4124-93f7-38bc37a7fa7b/2008-09-02_1429.png" width="588" border="0"&gt; 
&lt;p&gt;
We also stole Bellware's SpecUnit.NET reporting stuff and ported it over. You can
now generate a report on your specs with the --html 
&lt;file.html&gt;
switch. Here's an example run:
&lt;/p&gt;
&lt;img height="355" src="http://content.screencast.com/users/ajensen/folders/Jing/media/aef95516-cf4e-4df0-b428-a890624abcfe/2008-09-02_1436.png" width="588" border="0"&gt; 
&lt;p&gt;
&lt;a href="http://blog.eleutian.com/download/mspec-0.2run.html"&gt;This is the report it
generates.&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Want to try it out?
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Grab the drop &lt;a href="http://www.assembla.com/spaces/machine/documents/aNW0n0Etir3yXNab7jnrAJ/download/mspec-0.2.zip"&gt;here&lt;/a&gt;. 
&lt;li&gt;
Extract it somewhere. Put it somewhere semi-permanent because the &lt;a href="http://testdriven.net/"&gt;TestDriven.NET&lt;/a&gt; runner
will need a static location for the MSpec TDNet Runner. 
&lt;li&gt;
If you want TestDriven.NET support, run &lt;strong&gt;InstallTDNetRunner.bat&lt;/strong&gt; 
&lt;li&gt;
Check out the example in &lt;strong&gt;Machine.Specifications.Example&lt;/strong&gt;. Note that
you can run with TD.NET. 
&lt;li&gt;
Create a project of your own. Just add &lt;strong&gt;Machine.Specifications.dll&lt;/strong&gt; and
get started. 
&lt;li&gt;
Send me feedback! Leave comments, email me, &lt;a href="http://twitter.com/aaronjensen"&gt;tweet
me&lt;/a&gt;, whatever. 
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Also, this is part of &lt;a href="http://www.assembla.com/wiki/show/machine"&gt;Machine&lt;/a&gt;,
so feel free to take a &lt;a href="http://svn2.assembla.com/svn/machine/trunk/"&gt;look
at the code&lt;/a&gt; and/or submit patches. There's also a &lt;a href="http://www.gallio.org/"&gt;Gallio&lt;/a&gt; adapter
in there, but I didn't include it in the release as it's not quite polished enough
yet. If you're interested in it, talk to me. Special thanks to &lt;a href="http://twitter.com/sbellware"&gt;Scott
Bellware&lt;/a&gt;, &lt;a href="http://blog.bits-in-motion.com/"&gt;Jeff Brown&lt;/a&gt; and &lt;a href="http://weblogs.asp.net/nunitaddin/default.aspx"&gt;Jamie
Cansdale&lt;/a&gt; for their help and support. Also, extra special thanks to Eleutian's
newest dev, Jeff Olson for much of the recent work that has gone into MSpec!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=ff788dca-fce2-4ad7-856d-c1a7745a2517" /&gt;</description>
      <comments>http://blog.eleutian.com/CommentView,guid,ff788dca-fce2-4ad7-856d-c1a7745a2517.aspx</comments>
      <category>bdd</category>
      <category>frameworks</category>
    </item>
    <item>
      <trackback:ping>http://blog.eleutian.com/Trackback.aspx?guid=2bacd3f9-be27-4029-87e9-1f8111a1145b</trackback:ping>
      <pingback:server>http://blog.eleutian.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eleutian.com/PermaLink,guid,2bacd3f9-be27-4029-87e9-1f8111a1145b.aspx</pingback:target>
      <dc:creator>Aaron</dc:creator>
      <wfw:comment>http://blog.eleutian.com/CommentView,guid,2bacd3f9-be27-4029-87e9-1f8111a1145b.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eleutian.com/SyndicationService.asmx/GetEntryCommentsRss?guid=2bacd3f9-be27-4029-87e9-1f8111a1145b</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Mikel Lindsaar recently <a href="http://www.lindsaar.net/2008/6/24/tip-24-being-clever-in-specs-is-for-dummies">posted
a tip</a> encouraging rSpec users to not use before :each, and set up the context
in every "it" specification. 
</p>
        <p>
I'm afraid I disagree. By pushing context setup into your specifications, you're
allowing your contexts to become artificial and anemic and your specifications to
become fat and more than just specifications. 
<br /><br />
Ultimately, this means that your reports will read poorly and it will be easy to introduce
specifications in a context that do not match the others.<br /><br />
Mikel arrives at the following specs at the end of his post: 
</p>
        <pre name="code" class="ruby">describe "when not logged in" do
  it "should redirect if we are not logged in" do
    get :index
    response.should redirect_to login_path
  end
end

describe "when logged in" do
  def given_a_logged_in_user
    session[:logged_in] = true
    session[:user_id] = 99
  end

  it "should let be a success" do
    given_a_logged_in_user
    get :index
    response.should be_success
  end

  it "should render the index template" do
    given_a_logged_in_user
    get :index
    response.should render_template('people/index')
  end
end</pre>
"when logged in" is not what I would consider a valid description of Mikel's
context in these specs. I would call it something along the lines of "when visiting
the index page while logged in". *That* is the context you are specifying against.
Compare:<br /><br />
when logged in, it should render the index template<br /><br />
vs.<br /><br />
when visiting the index page while logged in, it should render the index template<br /><br />
The first is clearly missing something. Unless rendering the index template is a direct
result of just *being* logged in, the spec is flawed.<br /><br />
With that in mind, as soon as you describe your context, there's no reason to
not pull that context setup into a single before method. It forces you to use that
context in every specification contained within your describe. It also makes your
tests easier to read. You establish your context, and then you make one line specifications
against that context. 
<br /><br />
I do agree that DRY should not be taken too far in tests. Base classes, helper methods,
all that sort of thing can quickly obfuscate them, but do not forsake the context
setup. <img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=2bacd3f9-be27-4029-87e9-1f8111a1145b" /></body>
      <title>Don't take RY (Repeat Yourself) in specs too far</title>
      <guid isPermaLink="false">http://blog.eleutian.com/PermaLink,guid,2bacd3f9-be27-4029-87e9-1f8111a1145b.aspx</guid>
      <link>http://blog.eleutian.com/2008/07/02/DontTakeRYRepeatYourselfInSpecsTooFar.aspx</link>
      <pubDate>Wed, 02 Jul 2008 03:04:07 GMT</pubDate>
      <description>&lt;p&gt;
Mikel Lindsaar recently &lt;a href="http://www.lindsaar.net/2008/6/24/tip-24-being-clever-in-specs-is-for-dummies"&gt;posted
a tip&lt;/a&gt; encouraging rSpec users to not use before :each, and set up the context
in every &amp;quot;it&amp;quot; specification. 
&lt;/p&gt;
&lt;p&gt;
I&amp;#39;m afraid I disagree. By pushing context setup into your specifications, you&amp;#39;re
allowing your contexts to become artificial and anemic and your specifications to
become fat and more than just specifications. 
&lt;br /&gt;
&lt;br /&gt;
Ultimately, this means that your reports will read poorly and it will be easy to introduce
specifications in a context that do not match the others.&lt;br /&gt;
&lt;br /&gt;
Mikel arrives at the following specs at the end of his post: 
&lt;/p&gt;
&lt;pre name="code" class="ruby"&gt;describe &amp;quot;when not logged in&amp;quot; do
  it &amp;quot;should redirect if we are not logged in&amp;quot; do
    get :index
    response.should redirect_to login_path
  end
end

describe &amp;quot;when logged in&amp;quot; do
  def given_a_logged_in_user
    session[:logged_in] = true
    session[:user_id] = 99
  end

  it &amp;quot;should let be a success&amp;quot; do
    given_a_logged_in_user
    get :index
    response.should be_success
  end

  it &amp;quot;should render the index template&amp;quot; do
    given_a_logged_in_user
    get :index
    response.should render_template(&amp;#39;people/index&amp;#39;)
  end
end&lt;/pre&gt;
&amp;quot;when logged in&amp;quot; is not what I would consider a valid description of Mikel&amp;#39;s
context in these specs. I would call it something along the lines of &amp;quot;when visiting
the index page while logged in&amp;quot;. *That* is the context you are specifying against.
Compare:&lt;br /&gt;
&lt;br /&gt;
when logged in, it should render the index template&lt;br /&gt;
&lt;br /&gt;
vs.&lt;br /&gt;
&lt;br /&gt;
when visiting the index page while logged in, it should render the index template&lt;br /&gt;
&lt;br /&gt;
The first is clearly missing something. Unless rendering the index template is a direct
result of just *being* logged in, the spec is flawed.&lt;br /&gt;
&lt;br /&gt;
With that in mind, as soon as you describe your context, there&amp;#39;s no reason to
not pull that context setup into a single before method. It forces you to use that
context in every specification contained within your describe. It also makes your
tests easier to read. You establish your context, and then you make one line specifications
against that context. 
&lt;br /&gt;
&lt;br /&gt;
I do agree that DRY should not be taken too far in tests. Base classes, helper methods,
all that sort of thing can quickly obfuscate them, but do not forsake the context
setup. &lt;img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=2bacd3f9-be27-4029-87e9-1f8111a1145b" /&gt;</description>
      <comments>http://blog.eleutian.com/CommentView,guid,2bacd3f9-be27-4029-87e9-1f8111a1145b.aspx</comments>
      <category>bdd</category>
      <category>rspec</category>
      <category>dry</category>
    </item>
    <item>
      <trackback:ping>http://blog.eleutian.com/Trackback.aspx?guid=b9a23177-84da-4932-894c-877f59e8ca0f</trackback:ping>
      <pingback:server>http://blog.eleutian.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eleutian.com/PermaLink,guid,b9a23177-84da-4932-894c-877f59e8ca0f.aspx</pingback:target>
      <dc:creator>Aaron</dc:creator>
      <wfw:comment>http://blog.eleutian.com/CommentView,guid,b9a23177-84da-4932-894c-877f59e8ca0f.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eleutian.com/SyndicationService.asmx/GetEntryCommentsRss?guid=b9a23177-84da-4932-894c-877f59e8ca0f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Just wanted to quickly note that I tracked down the performance issue in Rhino.Mocks
and <a href="http://rhino-tools.svn.sourceforge.net/viewvc/rhino-tools?view=rev&amp;revision=1382">patched
it</a>. I also updated the <a href="http://blog.eleutian.com/2008/05/08/MockFrameworkBenchmarks.aspx">original
post</a> with the new numbers. Enjoy!
</p>
        <img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=b9a23177-84da-4932-894c-877f59e8ca0f" />
      </body>
      <title>Rhino.Mocks Performance Issue Fixed</title>
      <guid isPermaLink="false">http://blog.eleutian.com/PermaLink,guid,b9a23177-84da-4932-894c-877f59e8ca0f.aspx</guid>
      <link>http://blog.eleutian.com/2008/05/09/RhinoMocksPerformanceIssueFixed.aspx</link>
      <pubDate>Fri, 09 May 2008 05:56:48 GMT</pubDate>
      <description>&lt;p&gt;
Just wanted to quickly note that I tracked down the performance issue in Rhino.Mocks
and &lt;a href="http://rhino-tools.svn.sourceforge.net/viewvc/rhino-tools?view=rev&amp;amp;revision=1382"&gt;patched
it&lt;/a&gt;. I also updated the &lt;a href="http://blog.eleutian.com/2008/05/08/MockFrameworkBenchmarks.aspx"&gt;original
post&lt;/a&gt; with the new numbers. Enjoy!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=b9a23177-84da-4932-894c-877f59e8ca0f" /&gt;</description>
      <comments>http://blog.eleutian.com/CommentView,guid,b9a23177-84da-4932-894c-877f59e8ca0f.aspx</comments>
      <category>development</category>
      <category>frameworks</category>
      <category>mocking</category>
    </item>
    <item>
      <trackback:ping>http://blog.eleutian.com/Trackback.aspx?guid=96b7cc98-7d7d-4aae-8734-42347fcf8464</trackback:ping>
      <pingback:server>http://blog.eleutian.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eleutian.com/PermaLink,guid,96b7cc98-7d7d-4aae-8734-42347fcf8464.aspx</pingback:target>
      <dc:creator>Aaron</dc:creator>
      <wfw:comment>http://blog.eleutian.com/CommentView,guid,96b7cc98-7d7d-4aae-8734-42347fcf8464.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eleutian.com/SyndicationService.asmx/GetEntryCommentsRss?guid=96b7cc98-7d7d-4aae-8734-42347fcf8464</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <strong>UPDATE: I tracked down the issue
and committed a patch to Rhino.Mocks. Rhino.Mocks is now much more competetive performance
wise, our CI build time nearly halved, and about 4 minutes out of 7 of our test time
has disappeared. New numbers below.</strong>
        <p>
I've complained before that <a href="http://blog.eleutian.com/2007/12/15/MockingIsSlow.aspx">Mocking
is Slow</a> but I never really dove further into it. Today I decided to actually compare
Rhino.Mocks to other mock frameworks on a pure performance basis to see if it was
a global problem. I timed 2000 unit tests across 100 classes with 20 tests each. The
results were a bit surprising:
</p>
        <table>
          <tbody>
            <tr>
              <th>
Framework</th>
              <th>
                <a href="http://testdriven.net/">TD.NET</a> Time</th>
              <th>
nunit-console Time</th>
            </tr>
            <tr>
              <td>
                <a href="http://www.ayende.com/projects/rhino-mocks.aspx">Rhino.Mocks</a> old trunk</td>
              <td>
57.36s</td>
              <td>
28.82s</td>
            </tr>
            <tr>
              <td>
                <a href="http://www.ayende.com/projects/rhino-mocks.aspx">Rhino.Mocks</a> new trunk</td>
              <td>
22.94s</td>
              <td>
7.59s</td>
            </tr>
            <tr>
              <td>
                <a href="http://code.google.com/p/moq/">Moq</a> trunk</td>
              <td>
18.30s</td>
              <td>
5.91s</td>
            </tr>
            <tr>
              <td>
                <a href="http://www.typemock.com/">TypeMock</a> 4.2.3 Reflective Mocks</td>
              <td>
15.36s</td>
              <td>
9.35s</td>
            </tr>
            <tr>
              <td>
                <a href="http://www.typemock.com/">TypeMock</a> 4.2.3 Natural Mocks</td>
              <td>
16.92s</td>
              <td>
9.56s</td>
            </tr>
          </tbody>
        </table>
        <p>
That's right, according to these tests, <a href="http://www.ayende.com/projects/rhino-mocks.aspx">Rhino.Mocks</a> is
at least 3 times slower than the other frameworks when under heavy load in TD.NET
and five times slower in the console according to these tests. It's also interesting
to note that <a href="http://www.typemock.com/">TypeMock</a> is faster than <a href="http://code.google.com/p/moq/">Moq</a> in
TD.NET, but slower in the console runner.
</p>
        <p>
While running the Rhino.Mocks tests it is very clear that there is a degrading performance
issue. All the other frameworks executed tests with a near constant speed per test,
but Rhino.Mocks slowed down noticeably about half way through.
</p>
        <p>
Please feel free to try it yourself, grab the project <a href="http://blog.eleutian.com/download/BenchMock.zip">here</a>.
You should be able to just run the 4 strategy .bat files (run-rhino, run-moq, run-tmock-reflective,
run-tmock-natural). Let me know if you find anything interesting.
</p>
        <img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=96b7cc98-7d7d-4aae-8734-42347fcf8464" />
      </body>
      <title>Mock Framework Benchmarks</title>
      <guid isPermaLink="false">http://blog.eleutian.com/PermaLink,guid,96b7cc98-7d7d-4aae-8734-42347fcf8464.aspx</guid>
      <link>http://blog.eleutian.com/2008/05/08/MockFrameworkBenchmarks.aspx</link>
      <pubDate>Thu, 08 May 2008 15:52:30 GMT</pubDate>
      <description>&lt;strong&gt;UPDATE: I tracked down the issue and committed a patch to Rhino.Mocks. Rhino.Mocks
is now much more competetive performance wise, our CI build time nearly halved, and
about 4 minutes out of 7 of our test time has disappeared. New numbers below.&lt;/strong&gt; 
&lt;p&gt;
I've complained before that &lt;a href="http://blog.eleutian.com/2007/12/15/MockingIsSlow.aspx"&gt;Mocking
is Slow&lt;/a&gt; but I never really dove further into it. Today I decided to actually compare
Rhino.Mocks to other mock frameworks on a pure performance basis to see if it was
a global problem. I timed 2000 unit tests across 100 classes with 20 tests each. The
results were a bit surprising:
&lt;/p&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th&gt;
Framework&lt;/th&gt;
&lt;th&gt;
&lt;a href="http://testdriven.net/"&gt;TD.NET&lt;/a&gt; Time&lt;/th&gt;
&lt;th&gt;
nunit-console Time&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;a href="http://www.ayende.com/projects/rhino-mocks.aspx"&gt;Rhino.Mocks&lt;/a&gt; old trunk&lt;/td&gt;
&lt;td&gt;
57.36s&lt;/td&gt;
&lt;td&gt;
28.82s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;a href="http://www.ayende.com/projects/rhino-mocks.aspx"&gt;Rhino.Mocks&lt;/a&gt; new trunk&lt;/td&gt;
&lt;td&gt;
22.94s&lt;/td&gt;
&lt;td&gt;
7.59s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;a href="http://code.google.com/p/moq/"&gt;Moq&lt;/a&gt; trunk&lt;/td&gt;
&lt;td&gt;
18.30s&lt;/td&gt;
&lt;td&gt;
5.91s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;a href="http://www.typemock.com/"&gt;TypeMock&lt;/a&gt; 4.2.3 Reflective Mocks&lt;/td&gt;
&lt;td&gt;
15.36s&lt;/td&gt;
&lt;td&gt;
9.35s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;a href="http://www.typemock.com/"&gt;TypeMock&lt;/a&gt; 4.2.3 Natural Mocks&lt;/td&gt;
&lt;td&gt;
16.92s&lt;/td&gt;
&lt;td&gt;
9.56s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
That's right, according to these tests, &lt;a href="http://www.ayende.com/projects/rhino-mocks.aspx"&gt;Rhino.Mocks&lt;/a&gt; is
at least 3 times slower than the other frameworks when under heavy load in TD.NET
and five times slower in the console according to these tests. It's also interesting
to note that &lt;a href="http://www.typemock.com/"&gt;TypeMock&lt;/a&gt; is faster than &lt;a href="http://code.google.com/p/moq/"&gt;Moq&lt;/a&gt; in
TD.NET, but slower in the console runner.
&lt;/p&gt;
&lt;p&gt;
While running the Rhino.Mocks tests it is very clear that there is a degrading performance
issue. All the other frameworks executed tests with a near constant speed per test,
but Rhino.Mocks slowed down noticeably about half way through.
&lt;/p&gt;
&lt;p&gt;
Please feel free to try it yourself, grab the project &lt;a href="http://blog.eleutian.com/download/BenchMock.zip"&gt;here&lt;/a&gt;.
You should be able to just run the 4 strategy .bat files (run-rhino, run-moq, run-tmock-reflective,
run-tmock-natural). Let me know if you find anything interesting.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=96b7cc98-7d7d-4aae-8734-42347fcf8464" /&gt;</description>
      <comments>http://blog.eleutian.com/CommentView,guid,96b7cc98-7d7d-4aae-8734-42347fcf8464.aspx</comments>
      <category>development</category>
      <category>frameworks</category>
      <category>mocking</category>
    </item>
    <item>
      <trackback:ping>http://blog.eleutian.com/Trackback.aspx?guid=2e4f933f-e00c-445e-ab64-17bf9a64d96f</trackback:ping>
      <pingback:server>http://blog.eleutian.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eleutian.com/PermaLink,guid,2e4f933f-e00c-445e-ab64-17bf9a64d96f.aspx</pingback:target>
      <dc:creator>Aaron</dc:creator>
      <wfw:comment>http://blog.eleutian.com/CommentView,guid,2e4f933f-e00c-445e-ab64-17bf9a64d96f.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eleutian.com/SyndicationService.asmx/GetEntryCommentsRss?guid=2e4f933f-e00c-445e-ab64-17bf9a64d96f</wfw:commentRss>
      <slash:comments>8</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
As some of you who follow <a href="http://twitter.com/aaronjensen">me on twitter</a> know,
I've been working on Yet Another Context/Specification Framework as an experiment.
Yeah, I know we already have <a href="http://nspec.tigris.org/">NSpec</a> and <a href="http://nbehave.org/">NBehave</a>,
and they're great and all, but MSpec takes things on from a slightly different angle,
and it's just an experiment (for now). Here's a sample Description:
</p>
        <pre name="code">[Description]
public class Transferring_between_from_account_and_to_account
{
  static Account fromAccount;
  static Account toAccount;

  Context before_each =()=&gt;
  {
    fromAccount = new Account {Balance = 1m};
    toAccount = new Account {Balance = 1m};
  };
  
  When the_transfer_is_made =()=&gt;
  {
    fromAccount.Transfer(1m, toAccount);
  };
   
  It should_debit_the_from_account_by_the_amount_transferred =()=&gt;
  {
    fromAccount.Balance.ShouldEqual(0m);
  };

  It should_credit_the_to_account_by_the_amount_transferred =()=&gt;
  {
    toAccount.Balance.ShouldEqual(2m);
  };
}
</pre>
        <p>
And a TestDriven.NET run:
</p>
        <pre>------ Test started: Assembly: Machine.Specifications.Example.dll ------

Transferring between from account and to account
  When the transfer is made
    * It should debit the from account by the amount transferred
    * It should credit the to account by the amount transferred


2 passed, 0 failed, 0 skipped, took 0.79 seconds.
</pre>
        <br />
        <h3>Err, What?
</h3>
        <p>
Different eh? The idea was heavily inspired by <a href="http://twitter.com/sbellware">Scott
Bellware</a>'s SpecUnit.Net framework he showed at the ALT.NET conference. It also
took heavy cues from <a href="http://rspec.info/">RSpec</a> and my insanity. I realize
that the the code doesn't look much like C# code and I'm OK with that. Many have and
will ask why I don't just use Boo or RSpec w/ IronRuby eventually or even one of the
existing Context/Spec/BDD frameworks. Those are good questions, but my main motivations
are tooling and syntax. I enjoy the tooling I get in C# and I personally like the
syntax in this library considering the limitations imposed by C#.
</p>
        <h3>How's it work?
</h3>
        <p>
The simplest way to describe it is to compare it to a normal *Unit style testing framework: 
</p>
        <ul>
          <li>
Description = TestContext 
</li>
          <li>
Context before_each = SetUp 
</li>
          <li>
Context before_all = SetUpFixture 
</li>
          <li>
Context after_each = TearDown 
</li>
          <li>
Context after_all = TearDownFixture 
</li>
          <li>
When = Also SetUp, but happens after Context before_each 
</li>
          <li>
It = Test 
</li>
        </ul>
        <p>
Rather than methods and attributes, MSpec uses named delegates and anonymous functions.
The only reason for this is readability. You'll also notice that the fields used in
the context are static. This is necessary so that the anonymous functions in the field
initializers can access them. Probably the first thing you noticed is the =()=&gt;
construct. I won't mention the names that this was given on twitter, but I think it's
an acceptable thing to have to deal with in exchange for the cleanliness of the rest
of the syntax.
</p>
        <h3>Ok, you're crazy, but how do I try it?
</h3>
        <p>
First, this is a very rough cut. Everything is subject to change as we experiment
with the language. That said, here's how you play with it:
</p>
        <ol>
          <li>
Grab the drop <a href="http://blog.eleutian.com/download/mspec-0.1.zip">here</a>. 
</li>
          <li>
Extract it somewhere. Put it somewhere semi-permanent because the <a href="http://testdriven.net/">TestDriven.NET</a> runner
will need a static location for the MSpec TDNet Runner. 
</li>
          <li>
If you want TestDriven.NET support, run <strong>InstallTDNetRunner.bat</strong></li>
          <li>
Check out the example in <strong>Machine.Specifications.Example</strong>. Note that
you can run with TD.NET. 
</li>
          <li>
Create a project of your own. Just add <strong>Machine.Specifications.dll</strong> and
get started. 
</li>
          <li>
Send me feedback! Leave comments, email me, <a href="http://twitter.com/aaronjensen">tweet
me</a>, whatever. 
</li>
        </ol>
        <p>
Also, this is part of <a href="http://www.assembla.com/wiki/show/machine">Machine</a>,
so feel free to take a <a href="http://svn2.assembla.com/svn/machine/trunk/">look
at the code</a> and/or submit patches. There's also a <a href="http://www.gallio.org/">Gallio</a> adapter
in there, but I didn't include it in the release as it's not quite polished enough
yet. If you're interested in it, talk to me. Special thanks to <a href="http://twitter.com/sbellware">Scott
Bellware</a>, <a href="http://blog.bits-in-motion.com/">Jeff Brown</a> and <a href="http://weblogs.asp.net/nunitaddin/default.aspx">Jamie
Cansdale</a> for their help and support.
</p>
        <img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=2e4f933f-e00c-445e-ab64-17bf9a64d96f" />
      </body>
      <title>Introducing Machine.Specifications (or MSpec for short)</title>
      <guid isPermaLink="false">http://blog.eleutian.com/PermaLink,guid,2e4f933f-e00c-445e-ab64-17bf9a64d96f.aspx</guid>
      <link>http://blog.eleutian.com/2008/05/08/IntroducingMachineSpecificationsOrMSpecForShort.aspx</link>
      <pubDate>Thu, 08 May 2008 07:11:27 GMT</pubDate>
      <description>&lt;p&gt;
As some of you who follow &lt;a href="http://twitter.com/aaronjensen"&gt;me on twitter&lt;/a&gt; know,
I've been working on Yet Another Context/Specification Framework as an experiment.
Yeah, I know we already have &lt;a href="http://nspec.tigris.org/"&gt;NSpec&lt;/a&gt; and &lt;a href="http://nbehave.org/"&gt;NBehave&lt;/a&gt;,
and they're great and all, but MSpec takes things on from a slightly different angle,
and it's just an experiment (for now). Here's a sample Description:
&lt;/p&gt;
&lt;pre name="code"&gt;[Description]
public class Transferring_between_from_account_and_to_account
{
  static Account fromAccount;
  static Account toAccount;

  Context before_each =()=&amp;gt;
  {
    fromAccount = new Account {Balance = 1m};
    toAccount = new Account {Balance = 1m};
  };
  
  When the_transfer_is_made =()=&amp;gt;
  {
    fromAccount.Transfer(1m, toAccount);
  };
   
  It should_debit_the_from_account_by_the_amount_transferred =()=&amp;gt;
  {
    fromAccount.Balance.ShouldEqual(0m);
  };

  It should_credit_the_to_account_by_the_amount_transferred =()=&amp;gt;
  {
    toAccount.Balance.ShouldEqual(2m);
  };
}
&lt;/pre&gt;
&lt;p&gt;
And a TestDriven.NET run:
&lt;/p&gt;
&lt;pre&gt;------ Test started: Assembly: Machine.Specifications.Example.dll ------

Transferring between from account and to account
  When the transfer is made
    * It should debit the from account by the amount transferred
    * It should credit the to account by the amount transferred


2 passed, 0 failed, 0 skipped, took 0.79 seconds.
&lt;/pre&gt;
&lt;br&gt;
&lt;h3&gt;Err, What?
&lt;/h3&gt;
&lt;p&gt;
Different eh? The idea was heavily inspired by &lt;a href="http://twitter.com/sbellware"&gt;Scott
Bellware&lt;/a&gt;'s SpecUnit.Net framework he showed at the ALT.NET conference. It also
took heavy cues from &lt;a href="http://rspec.info/"&gt;RSpec&lt;/a&gt; and my insanity. I realize
that the the code doesn't look much like C# code and I'm OK with that. Many have and
will ask why I don't just use Boo or RSpec w/ IronRuby eventually or even one of the
existing Context/Spec/BDD frameworks. Those are good questions, but my main motivations
are tooling and syntax. I enjoy the tooling I get in C# and I personally like the
syntax in this library considering the limitations imposed by C#.
&lt;/p&gt;
&lt;h3&gt;How's it work?
&lt;/h3&gt;
&lt;p&gt;
The simplest way to describe it is to compare it to a normal *Unit style testing framework: 
&lt;ul&gt;
&lt;li&gt;
Description = TestContext 
&lt;li&gt;
Context before_each = SetUp 
&lt;li&gt;
Context before_all = SetUpFixture 
&lt;li&gt;
Context after_each = TearDown 
&lt;li&gt;
Context after_all = TearDownFixture 
&lt;li&gt;
When = Also SetUp, but happens after Context before_each 
&lt;li&gt;
It = Test 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Rather than methods and attributes, MSpec uses named delegates and anonymous functions.
The only reason for this is readability. You'll also notice that the fields used in
the context are static. This is necessary so that the anonymous functions in the field
initializers can access them. Probably the first thing you noticed is the =()=&amp;gt;
construct. I won't mention the names that this was given on twitter, but I think it's
an acceptable thing to have to deal with in exchange for the cleanliness of the rest
of the syntax.
&lt;/p&gt;
&lt;h3&gt;Ok, you're crazy, but how do I try it?
&lt;/h3&gt;
&lt;p&gt;
First, this is a very rough cut. Everything is subject to change as we experiment
with the language. That said, here's how you play with it:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Grab the drop &lt;a href="http://blog.eleutian.com/download/mspec-0.1.zip"&gt;here&lt;/a&gt;. 
&lt;li&gt;
Extract it somewhere. Put it somewhere semi-permanent because the &lt;a href="http://testdriven.net/"&gt;TestDriven.NET&lt;/a&gt; runner
will need a static location for the MSpec TDNet Runner. 
&lt;li&gt;
If you want TestDriven.NET support, run &lt;strong&gt;InstallTDNetRunner.bat&lt;/strong&gt; 
&lt;li&gt;
Check out the example in &lt;strong&gt;Machine.Specifications.Example&lt;/strong&gt;. Note that
you can run with TD.NET. 
&lt;li&gt;
Create a project of your own. Just add &lt;strong&gt;Machine.Specifications.dll&lt;/strong&gt; and
get started. 
&lt;li&gt;
Send me feedback! Leave comments, email me, &lt;a href="http://twitter.com/aaronjensen"&gt;tweet
me&lt;/a&gt;, whatever. 
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Also, this is part of &lt;a href="http://www.assembla.com/wiki/show/machine"&gt;Machine&lt;/a&gt;,
so feel free to take a &lt;a href="http://svn2.assembla.com/svn/machine/trunk/"&gt;look
at the code&lt;/a&gt; and/or submit patches. There's also a &lt;a href="http://www.gallio.org/"&gt;Gallio&lt;/a&gt; adapter
in there, but I didn't include it in the release as it's not quite polished enough
yet. If you're interested in it, talk to me. Special thanks to &lt;a href="http://twitter.com/sbellware"&gt;Scott
Bellware&lt;/a&gt;, &lt;a href="http://blog.bits-in-motion.com/"&gt;Jeff Brown&lt;/a&gt; and &lt;a href="http://weblogs.asp.net/nunitaddin/default.aspx"&gt;Jamie
Cansdale&lt;/a&gt; for their help and support.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=2e4f933f-e00c-445e-ab64-17bf9a64d96f" /&gt;</description>
      <comments>http://blog.eleutian.com/CommentView,guid,2e4f933f-e00c-445e-ab64-17bf9a64d96f.aspx</comments>
      <category>development</category>
      <category>frameworks</category>
      <category>open source</category>
      <category>test driven development</category>
    </item>
    <item>
      <trackback:ping>http://blog.eleutian.com/Trackback.aspx?guid=3446a5e2-83a1-4cf9-9a2c-9b65d08be8be</trackback:ping>
      <pingback:server>http://blog.eleutian.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eleutian.com/PermaLink,guid,3446a5e2-83a1-4cf9-9a2c-9b65d08be8be.aspx</pingback:target>
      <dc:creator>Jacob</dc:creator>
      <wfw:comment>http://blog.eleutian.com/CommentView,guid,3446a5e2-83a1-4cf9-9a2c-9b65d08be8be.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eleutian.com/SyndicationService.asmx/GetEntryCommentsRss?guid=3446a5e2-83a1-4cf9-9a2c-9b65d08be8be</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <h4>
          <strong>Introduction</strong>
        </h4>
        <p>
We used ActiveRecord migrations at Eleutian for a number of months. Everything was
right with the world and we had no major complaints until we started running into
a problem with our more complex migration scenarios. Usually, we see two kinds of
migrations:
</p>
        <ul>
          <li>
            <strong>Schema</strong> - Add/remove/rename columns, manipulate tables, and general
schema related changes. 
</li>
          <li>
            <strong>Data</strong> - Refactoring data into new schemas and major data reorganization
or population. 
</li>
        </ul>
        <p>
Schema migrations are handled great by most of the migration frameworks out there.
One problem we were running into was it's typically easier to write the data migrations
in C# directly using our entities and services. As a result we had two different ways
of migrating and this made our frequent publishes problematic. We decided to consolidate
the two operations.
</p>
        <p>
On the outside there's nothing really new in Machine.Migrations that you haven't seen
elsewhere. Most of the changes are internal. Migrations are numbered right now, although
we've talked of moving to time-stamping them a la the newer ruby ActiveRecord. What
Machine.Migrations does allow you to do is heavily tweak your migrations to fit your
project. In our project we have a custom MsBuild task that extends the default implementation
to provide access to our DaoFactory and other goodies. If this is something that interests
you, then read on. If you're happy with your current migration scenario then you probably
don't have a huge need for Machine.Migrations.
</p>
        <h4>
          <strong>A Simple Migration</strong>
        </h4>
        <p>
I'll start with the actual migrations. Here is an example that creates a table:
</p>
        <pre class="c-sharp" name="code">using System;
using System.Collections.Generic;
using Machine.Migrations;

public class CreateUserTable : SimpleMigration
{
  public override void Up()
  {
    Schema.AddTable("users", new Column[] {
      new Column("Id", typeof(Int32), 4, true, false),
      new Column("Name", typeof (string), 64, false, false),
      new Column("Email", typeof (string), 64, false, false),
      new Column("Login", typeof (string), 64, false, false),
      new Column("Password", typeof (string), 64, false, false),
    });
  }

  public override void Down()
  {
    Schema.DropTable("users");
  }
}</pre>
        <p>
Machine.Migrations does enforce a file naming/class naming restriction so the file
for this migration would be named <font face="Courier New">001_create_user_table.cs</font>.
We inherit from <font face="Courier New">SimpleMigration</font>, which is built-in
and provides access to Schema manipulations and raw Database queries through those
properties respectively. We have a solution and project for our migrations so that
we can get IntelliSense while writing them. This can be helpful if you forget the
syntax.
</p>
        <p>
When you run Machine.Migrations it will only compile the migrations that it needs
to apply. This is very handy if you are doing high-level migrations including your
entities because then you don't have to maintain them after they've been applied to
your live database. <strong>But</strong>, this does mean you won't be able to migrate
from the beginning to the end because migrations will become outdated. This has been
a minor problem for us because we snapshot our live database and run that in development.
I do think a better long term solution is required though, in order to make creating
a brand new database easier. Perhaps flagging migrations as data migrations and not
running them if they don't compile? I am not sure.
</p>
        <p>
There is also a Boo migration factory that you can use if you don't want to write
your migrations in C#. Internally, the infrastructure is there if you want to add
other languages as well.
</p>
        <p>
Another interesting thing I should note is that each migration is run inside its own
transaction, so if you mess up it'll just rollback. This is <strong>very</strong> nice
under SQL Server because schema changes are rolled back as well.
</p>
        <h4>
          <strong>How Do I Start Using It?</strong>
        </h4>
        <p>
If you just want to use Machine.Migrations out of the box (a good first step) it's
fairly straightforward:
</p>
        <ol>
          <li>
Copy Machine.Migrations and its dependencies into your project. Be sure to include
the Machine.Migrations.targets file which has the default MsBuild task and target. 
</li>
          <li>
You can then drop the following XML into your MsBuild file (check all your paths!): 
<br /><pre class="xml" name="code">&lt;Import Project="Libraries\Machine\Machine.Migrations.targets" /&gt;

&lt;PropertyGroup&gt;
  &lt;MigrationConnectionString&gt;Data Source=127.0.0.1;Initial Catalog=MyDb;Integrated Security=SSPI&lt;/MigrationConnectionString&gt;
&lt;/PropertyGroup&gt;

&lt;Target Name="Migrate" DependsOnTargets="MigrateDatabase"&gt;
&lt;/Target&gt;</pre></li>
          <li>
All that's happening here is we're importing the targets file, defining a connection
string to use when migrating, and then making a target that depends on the target
we imported. 
</li>
          <li>
By default it will look for your migrations in a subdirectory named Migrations. 
</li>
          <li>
Then it's just a matter of running <font face="Courier New" size="2">MsBuild YourProject.proj
/t:Migrate</font> where YourProject.proj is your MsBuild file. 
</li>
        </ol>
        <p>
One thing you may notice is that sometimes your migrations will fail to compile because
of a missing dependency. In order to ensure your own or third party assemblies are
referenced you add them to the MigrationReferences ItemGroup, like so:
</p>
        <pre class="xml" name="code">&lt;ItemGroup&gt;
  &lt;MigrationReferences Include="System.Xml.dll"&gt;
    &lt;InProject&gt;false&lt;/InProject&gt;
  &lt;/MigrationReferences&gt;
&lt;/ItemGroup&gt;</pre>
        <p>
When Machine.Migrations compiles it will include those assemblies in the references
list.
</p>
        <p>
          <strong>What Next?</strong>
        </p>
        <p>
I'm going to hold off on explaining how to extend the default migration scenario until
later because this post is already pretty long. For anyone feeling ambitious it basically
amounts to extending SimpleMigration in your own code and inheriting from that. (Be
sure to include your assembly in MigrationReferences). We go a step further and wrap
the MsBuild task as well, which may or may not be necessary for you.
</p>
        <p>
I can't stress enough that going down this road isn't for everybody. There is an argument
for keeping migrations simple and making those complex data migrations something else's
concern. For now, this is what we're doing and it has worked nicely. I'm sure there
will be lots of questions as well, please feel free to comment and offer up suggestions.
As far as I know we're the only people using this code, so I'm sure there are quirks.
</p>
        <img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=3446a5e2-83a1-4cf9-9a2c-9b65d08be8be" />
      </body>
      <title>A First Look At Machine.Migrations</title>
      <guid isPermaLink="false">http://blog.eleutian.com/PermaLink,guid,3446a5e2-83a1-4cf9-9a2c-9b65d08be8be.aspx</guid>
      <link>http://blog.eleutian.com/2008/04/25/AFirstLookAtMachineMigrations.aspx</link>
      <pubDate>Fri, 25 Apr 2008 20:37:26 GMT</pubDate>
      <description>&lt;h4&gt;&lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h4&gt;
&lt;p&gt;
We used ActiveRecord migrations at Eleutian for a number of months. Everything was
right with the world and we had no major complaints until we started running into
a problem with our more complex migration scenarios. Usually, we see two kinds of
migrations:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Schema&lt;/strong&gt; - Add/remove/rename columns, manipulate tables, and general
schema related changes. 
&lt;li&gt;
&lt;strong&gt;Data&lt;/strong&gt; - Refactoring data into new schemas and major data reorganization
or population. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Schema migrations are handled great by most of the migration frameworks out there.
One problem we were running into was it's typically easier to write the data migrations
in C# directly using our entities and services. As a result we had two different ways
of migrating and this made our frequent publishes problematic. We decided to consolidate
the two operations.
&lt;/p&gt;
&lt;p&gt;
On the outside there's nothing really new in Machine.Migrations that you haven't seen
elsewhere. Most of the changes are internal. Migrations are numbered right now, although
we've talked of moving to time-stamping them a la the newer ruby ActiveRecord. What
Machine.Migrations does allow you to do is heavily tweak your migrations to fit your
project. In our project we have a custom MsBuild task that extends the default implementation
to provide access to our DaoFactory and other goodies. If this is something that interests
you, then read on. If you're happy with your current migration scenario then you probably
don't have a huge need for Machine.Migrations.
&lt;/p&gt;
&lt;h4&gt;&lt;strong&gt;A Simple Migration&lt;/strong&gt;
&lt;/h4&gt;
&lt;p&gt;
I'll start with the actual migrations. Here is an example that creates a table:
&lt;/p&gt;
&lt;pre class="c-sharp" name="code"&gt;using System;
using System.Collections.Generic;
using Machine.Migrations;

public class CreateUserTable : SimpleMigration
{
  public override void Up()
  {
    Schema.AddTable("users", new Column[] {
      new Column("Id", typeof(Int32), 4, true, false),
      new Column("Name", typeof (string), 64, false, false),
      new Column("Email", typeof (string), 64, false, false),
      new Column("Login", typeof (string), 64, false, false),
      new Column("Password", typeof (string), 64, false, false),
    });
  }

  public override void Down()
  {
    Schema.DropTable("users");
  }
}&lt;/pre&gt;
&lt;p&gt;
Machine.Migrations does enforce a file naming/class naming restriction so the file
for this migration would be named &lt;font face="Courier New"&gt;001_create_user_table.cs&lt;/font&gt;.
We inherit from &lt;font face="Courier New"&gt;SimpleMigration&lt;/font&gt;, which is built-in
and provides access to Schema manipulations and raw Database queries through those
properties respectively. We have a solution and project for our migrations so that
we can get IntelliSense while writing them. This can be helpful if you forget the
syntax.
&lt;/p&gt;
&lt;p&gt;
When you run Machine.Migrations it will only compile the migrations that it needs
to apply. This is very handy if you are doing high-level migrations including your
entities because then you don't have to maintain them after they've been applied to
your live database. &lt;strong&gt;But&lt;/strong&gt;, this does mean you won't be able to migrate
from the beginning to the end because migrations will become outdated. This has been
a minor problem for us because we snapshot our live database and run that in development.
I do think a better long term solution is required though, in order to make creating
a brand new database easier. Perhaps flagging migrations as data migrations and not
running them if they don't compile? I am not sure.
&lt;/p&gt;
&lt;p&gt;
There is also a Boo migration factory that you can use if you don't want to write
your migrations in C#. Internally, the infrastructure is there if you want to add
other languages as well.
&lt;/p&gt;
&lt;p&gt;
Another interesting thing I should note is that each migration is run inside its own
transaction, so if you mess up it'll just rollback. This is &lt;strong&gt;very&lt;/strong&gt; nice
under SQL Server because schema changes are rolled back as well.
&lt;/p&gt;
&lt;h4&gt;&lt;strong&gt;How Do I Start Using It?&lt;/strong&gt;
&lt;/h4&gt;
&lt;p&gt;
If you just want to use Machine.Migrations out of the box (a good first step) it's
fairly straightforward:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Copy Machine.Migrations and its dependencies into your project. Be sure to include
the Machine.Migrations.targets file which has the default MsBuild task and target. 
&lt;li&gt;
You can then drop the following XML into your MsBuild file (check all your paths!): 
&lt;br&gt;
&lt;pre class="xml" name="code"&gt;&amp;lt;Import Project="Libraries\Machine\Machine.Migrations.targets" /&amp;gt;

&amp;lt;PropertyGroup&amp;gt;
  &amp;lt;MigrationConnectionString&amp;gt;Data Source=127.0.0.1;Initial Catalog=MyDb;Integrated Security=SSPI&amp;lt;/MigrationConnectionString&amp;gt;
&amp;lt;/PropertyGroup&amp;gt;

&amp;lt;Target Name="Migrate" DependsOnTargets="MigrateDatabase"&amp;gt;
&amp;lt;/Target&amp;gt;&lt;/pre&gt;
&lt;li&gt;
All that's happening here is we're importing the targets file, defining a connection
string to use when migrating, and then making a target that depends on the target
we imported. 
&lt;li&gt;
By default it will look for your migrations in a subdirectory named Migrations. 
&lt;li&gt;
Then it's just a matter of running &lt;font face="Courier New" size="2"&gt;MsBuild YourProject.proj
/t:Migrate&lt;/font&gt; where YourProject.proj is your MsBuild file. 
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
One thing you may notice is that sometimes your migrations will fail to compile because
of a missing dependency. In order to ensure your own or third party assemblies are
referenced you add them to the MigrationReferences ItemGroup, like so:
&lt;/p&gt;
&lt;pre class="xml" name="code"&gt;&amp;lt;ItemGroup&amp;gt;
  &amp;lt;MigrationReferences Include="System.Xml.dll"&amp;gt;
    &amp;lt;InProject&amp;gt;false&amp;lt;/InProject&amp;gt;
  &amp;lt;/MigrationReferences&amp;gt;
&amp;lt;/ItemGroup&amp;gt;&lt;/pre&gt;
&lt;p&gt;
When Machine.Migrations compiles it will include those assemblies in the references
list.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;What Next?&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
I'm going to hold off on explaining how to extend the default migration scenario until
later because this post is already pretty long. For anyone feeling ambitious it basically
amounts to extending SimpleMigration in your own code and inheriting from that. (Be
sure to include your assembly in MigrationReferences). We go a step further and wrap
the MsBuild task as well, which may or may not be necessary for you.
&lt;/p&gt;
&lt;p&gt;
I can't stress enough that going down this road isn't for everybody. There is an argument
for keeping migrations simple and making those complex data migrations something else's
concern. For now, this is what we're doing and it has worked nicely. I'm sure there
will be lots of questions as well, please feel free to comment and offer up suggestions.
As far as I know we're the only people using this code, so I'm sure there are quirks.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=3446a5e2-83a1-4cf9-9a2c-9b65d08be8be" /&gt;</description>
      <comments>http://blog.eleutian.com/CommentView,guid,3446a5e2-83a1-4cf9-9a2c-9b65d08be8be.aspx</comments>
    </item>
    <item>
      <trackback:ping>http://blog.eleutian.com/Trackback.aspx?guid=5349636c-dfca-447e-aa82-fd6f5eecb9e7</trackback:ping>
      <pingback:server>http://blog.eleutian.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eleutian.com/PermaLink,guid,5349636c-dfca-447e-aa82-fd6f5eecb9e7.aspx</pingback:target>
      <dc:creator>Jacob</dc:creator>
      <wfw:comment>http://blog.eleutian.com/CommentView,guid,5349636c-dfca-447e-aa82-fd6f5eecb9e7.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eleutian.com/SyndicationService.asmx/GetEntryCommentsRss?guid=5349636c-dfca-447e-aa82-fd6f5eecb9e7</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
One idea I've been thinking about lately is that good tools get out of your way. I
started thinking about this after reading <a href="http://www.kenrockwell.com/tech/notcamera.htm">an
article</a> about photography and fancy equipment. A few days later I was upgrading
my <a href="http://www.jetbrains.com/resharper/">ReSharper</a> to the latest EAP and
started thinking about how the same principal applies to my tools in software development.
</p>
        <p>
I've been a huge fan of ReSharper for a long time. It and ViEmu are an absolute necessity
for me when doing any kind of work with C#. After we first installed it at work we
would joke that it just knows what you want to do. When I use a new tool I usually
don't see the value right away and to help others see the value faster I'm going to
give a short list of the features I personally use constantly. Here is my list for
ReSharper:
</p>
        <ol>
          <li>
            <strong>
              <a href="http://www.jetbrains.com/resharper/documentation/help20/AdvEditing/errorHighlighting.html">Error
Highlighting</a>
            </strong>: Anything that saves me from a failed build saves me tons
of time. 
</li>
          <li>
            <strong>
              <a href="http://www.jetbrains.com/resharper/documentation/help20/AdvEditing/quickFixes.html">Quick-Fix</a> (Alt-Enter)</strong>:
Import Type and Initialize field from constructor(s) parameter. I use one of these
every minute it seems. I also like that I can disable things. For example, I disable
"Redundant this qualifier", that's how I roll. 
</li>
          <li>
            <strong>
              <a href="http://www.jetbrains.com/resharper/documentation/help20/AdvEditing/altinsert.html">Generate</a> (Alt-Ins)</strong>:
I usually generate properties and constructors with field initializers. 
</li>
          <li>
            <strong>Refactor</strong>: <a href="http://www.jetbrains.com/resharper/documentation/help20/Refactoring/moveType.html">Move
Type to File</a>, <a href="http://www.jetbrains.com/resharper/documentation/help20/Refactoring/renaming.html#renameClass">Rename</a></li>
          <li>
            <strong>
              <a href="http://www.jetbrains.com/resharper/documentation/help20/AdvEditing/codeCompletionTypeName.html">Ctrl-Alt-Space</a>
            </strong>:
Complete Type Name from any namespace, imported or not. 
</li>
          <li>
            <strong>
            </strong>
            <a href="http://www.jetbrains.com/resharper/documentation/help20/UsageSearch/findResultsWindow.html">Find
Usages:</a> I like that it keeps a history of past searches and that I can group things
by project/namespace. It crosses usages out when I change things too, which is helpful. 
</li>
        </ol>
        <p>
          <a href="http://blog.excastle.com/2007/01/31/blog-event-the-31-days-of-resharper/">It
can do a lot more than this</a>. What's particularly important is that I never know
I'm using another tool. I rarely see dialogs popup and break my flow, that sort of
thing. It gets out of my way. I'm always looking at my code. That's important because
it's what I'm <strong>doing</strong>. Do your favorite tools get out of your way?
While I have an audience I'm going to ask for a couple of things:
</p>
        <ol>
          <li>
I would love to be able to set my IntelliSense to <strong>default</strong> to Ctrl-Alt-Space
mode when completing a type name. I'm trying to avoid having to go into that mode
manually. 
</li>
          <li>
When generating code (properties, constructors, etc...) there's a second dialog now
that lets you set properties on the generated members. I would like to disable this
second dialog, I'll never use it. It's much faster for me to manually tweak the generated
code using my Vim-Fu. 
</li>
        </ol>
        <p>
Are either of these things possible already? Also, before you go, I think it's good
to know which specific things people find particularly useful about their tools. If
you have any features of any tool that you use <strong>several</strong> times a day,
I'd love to hear what they are. Maybe I'm missing out on something.
</p>
        <p>
Also, I'll be in Seattle for ALT.NET so come up and shake my hand!
</p>
        <img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=5349636c-dfca-447e-aa82-fd6f5eecb9e7" />
      </body>
      <title>Good Tools and ReSharper 4 EAP Thoughts</title>
      <guid isPermaLink="false">http://blog.eleutian.com/PermaLink,guid,5349636c-dfca-447e-aa82-fd6f5eecb9e7.aspx</guid>
      <link>http://blog.eleutian.com/2008/04/16/GoodToolsAndReSharper4EAPThoughts.aspx</link>
      <pubDate>Wed, 16 Apr 2008 23:42:40 GMT</pubDate>
      <description>&lt;p&gt;
One idea I've been thinking about lately is that good tools get out of your way. I
started thinking about this after reading &lt;a href="http://www.kenrockwell.com/tech/notcamera.htm"&gt;an
article&lt;/a&gt; about photography and fancy equipment. A few days later I was upgrading
my &lt;a href="http://www.jetbrains.com/resharper/"&gt;ReSharper&lt;/a&gt; to the latest EAP and
started thinking about how the same principal applies to my tools in software development.
&lt;/p&gt;
&lt;p&gt;
I've been a huge fan of ReSharper for a long time. It and ViEmu are an absolute necessity
for me when doing any kind of work with C#. After we first installed it at work we
would joke that it just knows what you want to do. When I use a new tool I usually
don't see the value right away and to help others see the value faster I'm going to
give a short list of the features I personally use constantly. Here is my list for
ReSharper:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="http://www.jetbrains.com/resharper/documentation/help20/AdvEditing/errorHighlighting.html"&gt;Error
Highlighting&lt;/a&gt;&lt;/strong&gt;: Anything that saves me from a failed build saves me tons
of time. 
&lt;li&gt;
&lt;strong&gt;&lt;a href="http://www.jetbrains.com/resharper/documentation/help20/AdvEditing/quickFixes.html"&gt;Quick-Fix&lt;/a&gt; (Alt-Enter)&lt;/strong&gt;:
Import Type and Initialize field from constructor(s) parameter. I use one of these
every minute it seems. I also like that I can disable things. For example, I disable
"Redundant this qualifier", that's how I roll. 
&lt;li&gt;
&lt;strong&gt;&lt;a href="http://www.jetbrains.com/resharper/documentation/help20/AdvEditing/altinsert.html"&gt;Generate&lt;/a&gt; (Alt-Ins)&lt;/strong&gt;:
I usually generate properties and constructors with field initializers. 
&lt;li&gt;
&lt;strong&gt;Refactor&lt;/strong&gt;: &lt;a href="http://www.jetbrains.com/resharper/documentation/help20/Refactoring/moveType.html"&gt;Move
Type to File&lt;/a&gt;, &lt;a href="http://www.jetbrains.com/resharper/documentation/help20/Refactoring/renaming.html#renameClass"&gt;Rename&lt;/a&gt; 
&lt;li&gt;
&lt;strong&gt;&lt;a href="http://www.jetbrains.com/resharper/documentation/help20/AdvEditing/codeCompletionTypeName.html"&gt;Ctrl-Alt-Space&lt;/a&gt;&lt;/strong&gt;:
Complete Type Name from any namespace, imported or not. 
&lt;li&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;a href="http://www.jetbrains.com/resharper/documentation/help20/UsageSearch/findResultsWindow.html"&gt;Find
Usages:&lt;/a&gt; I like that it keeps a history of past searches and that I can group things
by project/namespace. It crosses usages out when I change things too, which is helpful. 
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
&lt;a href="http://blog.excastle.com/2007/01/31/blog-event-the-31-days-of-resharper/"&gt;It
can do a lot more than this&lt;/a&gt;. What's particularly important is that I never know
I'm using another tool. I rarely see dialogs popup and break my flow, that sort of
thing. It gets out of my way. I'm always looking at my code. That's important because
it's what I'm &lt;strong&gt;doing&lt;/strong&gt;. Do your favorite tools get out of your way?
While I have an audience I'm going to ask for a couple of things:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
I would love to be able to set my IntelliSense to &lt;strong&gt;default&lt;/strong&gt; to Ctrl-Alt-Space
mode when completing a type name. I'm trying to avoid having to go into that mode
manually. 
&lt;li&gt;
When generating code (properties, constructors, etc...) there's a second dialog now
that lets you set properties on the generated members. I would like to disable this
second dialog, I'll never use it. It's much faster for me to manually tweak the generated
code using my Vim-Fu. 
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Are either of these things possible already? Also, before you go, I think it's good
to know which specific things people find particularly useful about their tools. If
you have any features of any tool that you use &lt;strong&gt;several&lt;/strong&gt; times a day,
I'd love to hear what they are. Maybe I'm missing out on something.
&lt;/p&gt;
&lt;p&gt;
Also, I'll be in Seattle for ALT.NET so come up and shake my hand!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=5349636c-dfca-447e-aa82-fd6f5eecb9e7" /&gt;</description>
      <comments>http://blog.eleutian.com/CommentView,guid,5349636c-dfca-447e-aa82-fd6f5eecb9e7.aspx</comments>
    </item>
    <item>
      <trackback:ping>http://blog.eleutian.com/Trackback.aspx?guid=40a71cf3-47c7-49ac-bb9c-ab9074adf0d1</trackback:ping>
      <pingback:server>http://blog.eleutian.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eleutian.com/PermaLink,guid,40a71cf3-47c7-49ac-bb9c-ab9074adf0d1.aspx</pingback:target>
      <dc:creator>Aaron</dc:creator>
      <wfw:comment>http://blog.eleutian.com/CommentView,guid,40a71cf3-47c7-49ac-bb9c-ab9074adf0d1.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eleutian.com/SyndicationService.asmx/GetEntryCommentsRss?guid=40a71cf3-47c7-49ac-bb9c-ab9074adf0d1</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Currently in Rhino.Mocks, making mocks fire events and ensuring that an event on your
SUT was fired are both awkward and verbose at best. Here is an example of both things
at once:
</p>
        <pre class="c-sharp" name="code">[Test]
public void ViewFiresBeginDrag_Always_FiresChangedEvent()
{
  IEventRaiser raiser;
  bool eventFired = false;
  using (Record)
  {
    The&lt;ICardView&gt;().BeginDrag += null;
    raiser = LastCall.IgnoreArguments().GetEventRaiser();

    Target.Changed += (x,y) =&gt; eventFired = true;
  }

  using (Playback)
  {
    raiser.Raise(The&lt;ICardView&gt;(), EventArgs.Empty);
    Assert.IsTrue(eventFired);
  }
}</pre>
        <p>
Nice eh? First, is there a better way to do either of these things that I'm missing?
Please tell me if so. Next, if not, what can we do to clean this up?
</p>
        <p>
Well, Ayende and I <a href="http://www.ayende.com/Blog/archive/2007/06/09/Rhino-Mocks-Events-Twisting-the-Syntax.aspx">discussed
this</a> in the past and Ayende spiked it and <a href="http://www.ayende.com/Blog/archive/2007/06/23/Natural-Event-Syntax-for-Rhino-Mocks.aspx">asked
for feedback</a>. The feedback was mixed and for one reason or another it never made
it into Rhino.Mocks that I know of.
</p>
        <p>
Well, today while I was working on <a href="http://svn2.assembla.com/svn/machine/trunk/Machine.Testing/">Machine.Testing</a> and
another side project, I decided to give something else a shot. What I ended up with
is this:
</p>
        <pre class="c-sharp" name="code">[Test]
public void ViewFiresBeginDrag_Always_FiresChangedEvent()
{
  using (Record)
  {
    PrimeEventFiringOn&lt;ICardView&gt;(x =&gt; x.BeginDrag += null);
    Target.Changed += NewEventFireExpectation&lt;EventHandler&gt;();
  }

  using (Playback)
  {
    FireEventOn&lt;ICardView&gt;(EventArgs.Empty);
  }
}</pre>
        <p>
Better, but I still don't think it's perfect. Also, it probably requires some explanation,
so let's pick it apart piece by piece:
</p>
        <pre class="c-sharp" name="code">    PrimeEventFiringOn&lt;ICardView&gt;(x =&gt; x.BeginDrag += null);</pre>
        <p>
=&gt; +=??? Ugly huh? I really wish we could just refer to an event somehow without
having to do +=/-=. At least I'm <a href="http://twitter.com/jbogard/statuses/788133552">not
using vb though</a>... Alas, we cannot access them easily so we're stuck hacking away
like this. So this particular method will basically get the mock or stub ICardView.BeginDrag
ready to be fired. This needs to be done during the record phase it seems. You can
only prime one event at a time per mock, so if you need to do more than one you can
revert to the normal Rhino.Mocks syntax.
</p>
        <pre class="c-sharp" name="code">    Target.Changed += NewEventFireExpectation&lt;EventHandler&gt;();</pre>
        <p>
This was a fun method. This method actually creates a new DynamicMethod in the signature
required by the event and creates a new delegate. The method tracks whether or not
it was fired, and at the end of the Playback phase in my fixture it will assert that
all of the events were actually fired.
</p>
        <pre class="c-sharp" name="code">    FireEventOn&lt;ICardView&gt;(EventArgs.Empty);</pre>
        <p>
This actually fires the event we set up in the Prime call. It can only be called after
you've primed an event.
</p>
        <p>
So, the whole thing is kind of "magic", but it's less code if you can accept the magic.
I think we can make things even better though, but it'd require changes to Rhino.Mocks
and it's time for bed so maybe Ayende can swing by the Eleutian office while in Seattle
and we can work on it. Here's what I'm thinking:
</p>
        <pre class="c-sharp" name="code">[Test]
public void ViewFiresBeginDrag_Always_FiresChangedEvent()
{
  using (Record)
  {
    Target.Changed += Mocks.CreateEventHandler&lt;EventHandler&gt;();
  }

  using (Playback)
  {
    EventRaiser.Raise(() =&gt; The<icardview>
().BeginDrag += null, The&lt;ICardView&gt;(), EventArgs.Empty); } }
</icardview></pre>
        <p>
There's probably more you can do with the CreateEventHandler syntax like add more
specific expectations, assert its not fired, assert that it's fired X times, etc.
The EventRaiser syntax is ugly, but it doesn't involve strings or the fire from the
right hand side like the syntax I mentioned at the beginning of the post.
</p>
        <p>
You can get the source <a href="http://svn2.assembla.com/svn/machine/trunk/Machine.Testing/">here</a>,
but I warn you it's first draft and there are hacky bits.
</p>
        <p>
Oh, and here's some example tests using the TestsFor fixture:
</p>
        <pre class="c-sharp" name="code">[TestFixture]
public class CardPresenterTests : TestsFor&lt;CardPresenter&gt;
{
  private Card _card;

  public override void SetupContainer()
  {
    Override&lt;ICardView&gt;(With.Stub);
  }

  public override void BeforeEachTest()
  {
    _card = new Card(0);
  }

  [Test]
  public void OnBeginDrag_Always_SetsIsInFluxToTrue()
  {
    using (Record)
    {
      PrimeEventFiringOn&lt;ICardView&gt;(x =&gt; x.BeginDrag += null);
    }

    using (Playback)
    {
      FireEventOn<icardview>
(EventArgs.Empty); Assert.That(The&lt;ICardView&gt;().IsInFlux, Is.True); } } [Test]
public void OnBeginDrag_Always_FiresChangedEvent() { using (Record) { PrimeEventFiringOn&lt;ICardView&gt;(x
=&gt; x.BeginDrag += null); Target.Changed += NewEventFireExpectation&lt;EventHandler&gt;();
} using (Playback) { FireEventOn&lt;ICardView&gt;(EventArgs.Empty); } } }
</icardview></pre>
        <img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=40a71cf3-47c7-49ac-bb9c-ab9074adf0d1" />
      </body>
      <title>Mocking Events</title>
      <guid isPermaLink="false">http://blog.eleutian.com/PermaLink,guid,40a71cf3-47c7-49ac-bb9c-ab9074adf0d1.aspx</guid>
      <link>http://blog.eleutian.com/2008/04/13/MockingEvents.aspx</link>
      <pubDate>Sun, 13 Apr 2008 08:30:10 GMT</pubDate>
      <description>&lt;p&gt;
Currently in Rhino.Mocks, making mocks fire events and ensuring that an event on your
SUT was fired are both awkward and verbose at best. Here is an example of both things
at once:
&lt;/p&gt;
&lt;pre class="c-sharp" name="code"&gt;[Test]
public void ViewFiresBeginDrag_Always_FiresChangedEvent()
{
  IEventRaiser raiser;
  bool eventFired = false;
  using (Record)
  {
    The&amp;lt;ICardView&amp;gt;().BeginDrag += null;
    raiser = LastCall.IgnoreArguments().GetEventRaiser();

    Target.Changed += (x,y) =&amp;gt; eventFired = true;
  }

  using (Playback)
  {
    raiser.Raise(The&amp;lt;ICardView&amp;gt;(), EventArgs.Empty);
    Assert.IsTrue(eventFired);
  }
}&lt;/pre&gt;
&lt;p&gt;
Nice eh? First, is there a better way to do either of these things that I'm missing?
Please tell me if so. Next, if not, what can we do to clean this up?
&lt;/p&gt;
&lt;p&gt;
Well, Ayende and I &lt;a href="http://www.ayende.com/Blog/archive/2007/06/09/Rhino-Mocks-Events-Twisting-the-Syntax.aspx"&gt;discussed
this&lt;/a&gt; in the past and Ayende spiked it and &lt;a href="http://www.ayende.com/Blog/archive/2007/06/23/Natural-Event-Syntax-for-Rhino-Mocks.aspx"&gt;asked
for feedback&lt;/a&gt;. The feedback was mixed and for one reason or another it never made
it into Rhino.Mocks that I know of.
&lt;/p&gt;
&lt;p&gt;
Well, today while I was working on &lt;a href="http://svn2.assembla.com/svn/machine/trunk/Machine.Testing/"&gt;Machine.Testing&lt;/a&gt; and
another side project, I decided to give something else a shot. What I ended up with
is this:
&lt;/p&gt;
&lt;pre class="c-sharp" name="code"&gt;[Test]
public void ViewFiresBeginDrag_Always_FiresChangedEvent()
{
  using (Record)
  {
    PrimeEventFiringOn&amp;lt;ICardView&amp;gt;(x =&amp;gt; x.BeginDrag += null);
    Target.Changed += NewEventFireExpectation&amp;lt;EventHandler&amp;gt;();
  }

  using (Playback)
  {
    FireEventOn&amp;lt;ICardView&amp;gt;(EventArgs.Empty);
  }
}&lt;/pre&gt;
&lt;p&gt;
Better, but I still don't think it's perfect. Also, it probably requires some explanation,
so let's pick it apart piece by piece:
&lt;/p&gt;
&lt;pre class="c-sharp" name="code"&gt;    PrimeEventFiringOn&amp;lt;ICardView&amp;gt;(x =&amp;gt; x.BeginDrag += null);&lt;/pre&gt;
&lt;p&gt;
=&amp;gt; +=??? Ugly huh? I really wish we could just refer to an event somehow without
having to do +=/-=. At least I'm &lt;a href="http://twitter.com/jbogard/statuses/788133552"&gt;not
using vb though&lt;/a&gt;... Alas, we cannot access them easily so we're stuck hacking away
like this. So this particular method will basically get the mock or stub ICardView.BeginDrag
ready to be fired. This needs to be done during the record phase it seems. You can
only prime one event at a time per mock, so if you need to do more than one you can
revert to the normal Rhino.Mocks syntax.
&lt;/p&gt;
&lt;pre class="c-sharp" name="code"&gt;    Target.Changed += NewEventFireExpectation&amp;lt;EventHandler&amp;gt;();&lt;/pre&gt;
&lt;p&gt;
This was a fun method. This method actually creates a new DynamicMethod in the signature
required by the event and creates a new delegate. The method tracks whether or not
it was fired, and at the end of the Playback phase in my fixture it will assert that
all of the events were actually fired.
&lt;/p&gt;
&lt;pre class="c-sharp" name="code"&gt;    FireEventOn&amp;lt;ICardView&amp;gt;(EventArgs.Empty);&lt;/pre&gt;
&lt;p&gt;
This actually fires the event we set up in the Prime call. It can only be called after
you've primed an event.
&lt;/p&gt;
&lt;p&gt;
So, the whole thing is kind of "magic", but it's less code if you can accept the magic.
I think we can make things even better though, but it'd require changes to Rhino.Mocks
and it's time for bed so maybe Ayende can swing by the Eleutian office while in Seattle
and we can work on it. Here's what I'm thinking:
&lt;/p&gt;
&lt;pre class="c-sharp" name="code"&gt;[Test]
public void ViewFiresBeginDrag_Always_FiresChangedEvent()
{
  using (Record)
  {
    Target.Changed += Mocks.CreateEventHandler&amp;lt;EventHandler&amp;gt;();
  }

  using (Playback)
  {
    EventRaiser.Raise(() =&amp;gt; The&lt;icardview&gt;
().BeginDrag += null, The&amp;lt;ICardView&amp;gt;(), EventArgs.Empty); } }
&lt;/pre&gt;
&lt;p&gt;
There's probably more you can do with the CreateEventHandler syntax like add more
specific expectations, assert its not fired, assert that it's fired X times, etc.
The EventRaiser syntax is ugly, but it doesn't involve strings or the fire from the
right hand side like the syntax I mentioned at the beginning of the post.
&lt;/p&gt;
&lt;p&gt;
You can get the source &lt;a href="http://svn2.assembla.com/svn/machine/trunk/Machine.Testing/"&gt;here&lt;/a&gt;,
but I warn you it's first draft and there are hacky bits.
&lt;/p&gt;
&lt;p&gt;
Oh, and here's some example tests using the TestsFor fixture:
&lt;/p&gt;
&lt;pre class="c-sharp" name="code"&gt;[TestFixture]
public class CardPresenterTests : TestsFor&amp;lt;CardPresenter&amp;gt;
{
  private Card _card;

  public override void SetupContainer()
  {
    Override&amp;lt;ICardView&amp;gt;(With.Stub);
  }

  public override void BeforeEachTest()
  {
    _card = new Card(0);
  }

  [Test]
  public void OnBeginDrag_Always_SetsIsInFluxToTrue()
  {
    using (Record)
    {
      PrimeEventFiringOn&amp;lt;ICardView&amp;gt;(x =&amp;gt; x.BeginDrag += null);
    }

    using (Playback)
    {
      FireEventOn&lt;icardview&gt;
(EventArgs.Empty); Assert.That(The&amp;lt;ICardView&amp;gt;().IsInFlux, Is.True); } } [Test]
public void OnBeginDrag_Always_FiresChangedEvent() { using (Record) { PrimeEventFiringOn&amp;lt;ICardView&amp;gt;(x
=&amp;gt; x.BeginDrag += null); Target.Changed += NewEventFireExpectation&amp;lt;EventHandler&amp;gt;();
} using (Playback) { FireEventOn&amp;lt;ICardView&amp;gt;(EventArgs.Empty); } } }
&lt;/pre&gt;
&lt;img width="0" height="0" src="http://blog.eleutian.com/aggbug.ashx?id=40a71cf3-47c7-49ac-bb9c-ab9074adf0d1" /&gt;</description>
      <comments>http://blog.eleutian.com/CommentView,guid,40a71cf3-47c7-49ac-bb9c-ab9074adf0d1.aspx</comments>
      <category>development</category>
      <category>frameworks</category>
      <category>mocking</category>
    </item>
  </channel>
</rss>