<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>The Dynamic Programmer</title>
    <link>http://blog.dynamicprogrammer.com/</link>
    <description>-</description>
    <language>en-us</language>
    <copyright>Hernan Garcia</copyright>
    <lastBuildDate>Wed, 03 Feb 2010 04:45:36 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.1.8102.813</generator>
    <managingEditor>hernifootball@yahoo.com</managingEditor>
    <webMaster>hernifootball@yahoo.com</webMaster>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/TheDynamicProgrammer" /><feedburner:info uri="thedynamicprogrammer" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
      <trackback:ping>http://blog.dynamicprogrammer.com/Trackback.aspx?guid=d0a61fd3-2800-4390-b3e2-82121ab202bd</trackback:ping>
      <pingback:server>http://blog.dynamicprogrammer.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.dynamicprogrammer.com/PermaLink,guid,d0a61fd3-2800-4390-b3e2-82121ab202bd.aspx</pingback:target>
      <dc:creator>Hernan</dc:creator>
      <wfw:comment>http://blog.dynamicprogrammer.com/CommentView,guid,d0a61fd3-2800-4390-b3e2-82121ab202bd.aspx</wfw:comment>
      <wfw:commentRss>http://blog.dynamicprogrammer.com/SyndicationService.asmx/GetEntryCommentsRss?guid=d0a61fd3-2800-4390-b3e2-82121ab202bd</wfw:commentRss>
      
      <title>Using SpecFlow + WatiN or BDD for web applications without leaving the CLR.</title>
      <guid isPermaLink="false">http://blog.dynamicprogrammer.com/PermaLink,guid,d0a61fd3-2800-4390-b3e2-82121ab202bd.aspx</guid>
      <link>http://feedproxy.google.com/~r/TheDynamicProgrammer/~3/-yqwql0Xk0Y/UsingSpecFlowWatiNOrBDDForWebApplicationsWithoutLeavingTheCLR.aspx</link>
      <pubDate>Wed, 03 Feb 2010 04:45:36 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
Last week I wrote about using cucumber to test your web applications outside in. In&#xD;
the post I showed a simple example (actually comes with cucumber) to open a browser,&#xD;
go to a site and perform some actions.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I showed the same to my team at work and they mention that could be nice to been able&#xD;
to use c# and Visual Studio to do something similar.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
After thinking about it I decided to give another try to a tool I check a few month&#xD;
ago. &lt;a href="http://www.specflow.org/" target="_blank"&gt;SpecFlow&lt;/a&gt;.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
SpecFlow is a tool and a set of libraries to write specifications using &lt;a href="http://wiki.github.com/aslakhellesoy/cucumber/gherkin" target="_blank"&gt;Gherkin&lt;/a&gt;.&#xD;
You can check the &lt;a href="http://www.specflow.org/specflow/screencast.aspx" target="_blank"&gt;screencast&#xD;
here&lt;/a&gt; or read &lt;a href="http://ryanlanciaux.com/ryanlanciaux/post/Gherkin-style-BDD-testing-in-NET.aspx" target="_blank"&gt;this&#xD;
post&lt;/a&gt; from Ryan Lanciaux. SpecFlow can use either NUnit or MsTest as the engine.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Now I needed something to drive the browser. &lt;a href="http://watin.sourceforge.net/" target="_blank"&gt;WatiN&lt;/a&gt; is&#xD;
the .Net port of &lt;a href="http://watir.com/" target="_blank"&gt;WatiR&lt;/a&gt; and is very&#xD;
easy to use. The problem is that needs to run in a single thread process, so when&#xD;
called from inside an NUnit test we need to add the STAThreadAttribute to the Test&#xD;
method.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Of course, this is not a problem when you are writing the Test methods yourself but&#xD;
the way SpecFlow works is that the actual Test method is generated by a tool from&#xD;
your .feature file. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/UsingSpecFlowWatiNorBDDforwebapplicatio_14C77/001_features.png"&gt;&#xD;
            &lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="001_features" border="0" alt="001_features" src="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/UsingSpecFlowWatiNorBDDforwebapplicatio_14C77/001_features_thumb.png" width="244" height="157"&gt;&lt;/img&gt;&#xD;
          &lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
The code looks like this (actually I edited it a little bit to make it nicer).&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/UsingSpecFlowWatiNorBDDforwebapplicatio_14C77/002_features.png"&gt;&#xD;
            &lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="002_features" border="0" alt="002_features" src="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/UsingSpecFlowWatiNorBDDforwebapplicatio_14C77/002_features_thumb.png" width="609" height="344"&gt;&lt;/img&gt;&#xD;
          &lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
So you need to add the &lt;a href="http://msdn.microsoft.com/en-us/library/system.stathreadattribute%28VS.80%29.aspx" target="_blank"&gt;STAThreadAttribute&lt;/a&gt; to&#xD;
this method.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/UsingSpecFlowWatiNorBDDforwebapplicatio_14C77/003_features.png"&gt;&#xD;
            &lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="003_features" border="0" alt="003_features" src="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/UsingSpecFlowWatiNorBDDforwebapplicatio_14C77/003_features_thumb.png" width="432" height="115"&gt;&lt;/img&gt;&#xD;
          &lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
This works great and I was able to drive the browser and write a few test in no time.&#xD;
The problem is that &lt;strike&gt;if you edit&lt;/strike&gt; every time you edit the .feature&#xD;
file this class will be re-generated and you will have to re-add this attribute. (Note: &lt;a href="http://github.com/hgarcia/SpecFlow" target="_blank"&gt;I&#xD;
forked the repo on GitHub&lt;/a&gt;, made a change to the source code and sent a pull request&#xD;
to add this attribute by default, not sure if it will be accepted or not).&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I think that the integration from SpecFlow with VS is great. If you or your team feel&#xD;
very strong on using VS this is a very good tool (there are versions for both VS 2008&#xD;
and 2010). After writing the features and running the test you will have hints and&#xD;
code to copy and paste from the TestRunner into the specification class.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/UsingSpecFlowWatiNorBDDforwebapplicatio_14C77/005_features.png"&gt;&#xD;
            &lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="005_features" border="0" alt="005_features" src="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/UsingSpecFlowWatiNorBDDforwebapplicatio_14C77/005_features_thumb.png" width="729" height="351"&gt;&lt;/img&gt;&#xD;
          &lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
 &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
You will generate the specification from an item template.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/UsingSpecFlowWatiNorBDDforwebapplicatio_14C77/004_features.png"&gt;&#xD;
            &lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="004_features" border="0" alt="004_features" src="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/UsingSpecFlowWatiNorBDDforwebapplicatio_14C77/004_features_thumb.png" width="508" height="149"&gt;&lt;/img&gt;&#xD;
          &lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;h5&gt;Conclusion:&#xD;
&lt;/h5&gt;&#xD;
        &lt;p&gt;&#xD;
I think that this is a great tool, specially if you are using it to develop desktop&#xD;
apps or library code in c#. You can use tools like R# to generate your classes and&#xD;
methods from the step definition class directly.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
For using with WatiN or similar tools to drive the browser I will probably keep using&#xD;
pure cucumber with Ruby at least until the &lt;a href="http://msdn.microsoft.com/en-us/library/system.stathreadattribute%28VS.80%29.aspx" target="_blank"&gt;STAThread&lt;/a&gt; issue&#xD;
gets solved.&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://blog.dynamicprogrammer.com/aggbug.ashx?id=d0a61fd3-2800-4390-b3e2-82121ab202bd"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/CwkGO-BX0W8UlMC2G62Z2xjaM_c/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CwkGO-BX0W8UlMC2G62Z2xjaM_c/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/CwkGO-BX0W8UlMC2G62Z2xjaM_c/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CwkGO-BX0W8UlMC2G62Z2xjaM_c/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheDynamicProgrammer/~4/-yqwql0Xk0Y" height="1" width="1"/&gt;</description>
      <comments>http://blog.dynamicprogrammer.com/CommentView,guid,d0a61fd3-2800-4390-b3e2-82121ab202bd.aspx</comments>
      <category>Programming</category>
      <category>Tools</category>
    <feedburner:origLink>http://blog.dynamicprogrammer.com/2010/02/03/UsingSpecFlowWatiNOrBDDForWebApplicationsWithoutLeavingTheCLR.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.dynamicprogrammer.com/Trackback.aspx?guid=a6ac40ea-5116-44f3-af01-f745df463fa3</trackback:ping>
      <pingback:server>http://blog.dynamicprogrammer.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.dynamicprogrammer.com/PermaLink,guid,a6ac40ea-5116-44f3-af01-f745df463fa3.aspx</pingback:target>
      <dc:creator>Hernan</dc:creator>
      <wfw:comment>http://blog.dynamicprogrammer.com/CommentView,guid,a6ac40ea-5116-44f3-af01-f745df463fa3.aspx</wfw:comment>
      <wfw:commentRss>http://blog.dynamicprogrammer.com/SyndicationService.asmx/GetEntryCommentsRss?guid=a6ac40ea-5116-44f3-af01-f745df463fa3</wfw:commentRss>
      <slash:comments>1</slash:comments>
      
      <title>Test driven outside in, starting with Cucumber and RubyMine.</title>
      <guid isPermaLink="false">http://blog.dynamicprogrammer.com/PermaLink,guid,a6ac40ea-5116-44f3-af01-f745df463fa3.aspx</guid>
      <link>http://feedproxy.google.com/~r/TheDynamicProgrammer/~3/HCXvqf2r-40/TestDrivenOutsideInStartingWithCucumberAndRubyMine.aspx</link>
      <pubDate>Thu, 28 Jan 2010 05:02:27 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
On my new project I want to start using end to end testing.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
The idea is to write an specification run it against an outer interface. Gui, Web&#xD;
service, etc. It fails. So you start implementing the feature using TDD until the&#xD;
Spec pass. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
You write a second scenario and you start again. If everything works as supposed I&#xD;
should have a fairly well tested application, not only at the unit level but at the&#xD;
integration and user acceptance level as well.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Since the application will be written in c# I look around for some tool to write the&#xD;
Scenarios in the same language. There are some options but none of them was as elegant&#xD;
as using Cucumber. So I tried cuke4nuke but I have no luck with it. I kept getting&#xD;
an error about server not running or something. It looks like a permission problems&#xD;
with win 7. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I’m sure I could have figure it out (some confidence I have on my abilities :-)) but&#xD;
after giving it a second though I decided to go with Cucumber and RSpec for those&#xD;
test. Drive the browser with Watir and hit the web services end points with webrat,&#xD;
sometimes even script the UI with webrat when the browser is not really need it.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Installing all the gems is easy just &#xD;
&lt;/p&gt;&#xD;
        &lt;table style="background-color: #000000; color: #ffffff" border="1"&gt;&#xD;
          &lt;tbody&gt;&#xD;
            &lt;tr&gt;&#xD;
              &lt;td&gt;&#xD;
                &lt;pre&gt;gem install cucumber&lt;/pre&gt;&#xD;
                &lt;pre&gt;gem install webrat&lt;/pre&gt;&#xD;
                &lt;pre&gt;gem install mechanizer&lt;/pre&gt;&#xD;
                &lt;pre&gt;gem install watir&lt;/pre&gt;&#xD;
                &lt;pre&gt;gem install rspec &lt;/pre&gt;&#xD;
              &lt;/td&gt;&#xD;
            &lt;/tr&gt;&#xD;
          &lt;/tbody&gt;&#xD;
        &lt;/table&gt;&#xD;
        &lt;p&gt;&#xD;
 &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
and you are done (at least in my case). Of course you need to have ruby installed&#xD;
in your system. I have 1.8.6&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Since I haven’t really used Cucumber before and my Ruby is still very flaky, I decided&#xD;
to use RubyMine as my IDE to write the specs, specially because you can generate the&#xD;
step definitions from the features in a similar way as how you generate code with&#xD;
R# in VS.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
You start writing an Spec with one scenario like this:&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/Testdrivenoutsidein_14256/ScreenShot001_2.png"&gt;&#xD;
            &lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ScreenShot001" border="0" alt="ScreenShot001" src="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/Testdrivenoutsidein_14256/ScreenShot001_thumb.png" width="379" height="173"&gt;&lt;/img&gt;&#xD;
          &lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Then you run it via the console and have this result.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/Testdrivenoutsidein_14256/ScreenShot008_2.png"&gt;&#xD;
            &lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ScreenShot008" border="0" alt="ScreenShot008" src="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/Testdrivenoutsidein_14256/ScreenShot008_thumb.png" width="459" height="395"&gt;&lt;/img&gt;&#xD;
          &lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Note the yellow squiggly lines on the step definitions for the scenario? If you move&#xD;
the mouse over them a prompt will indicate that the step haven’t been created yet:&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/Testdrivenoutsidein_14256/ScreenShot002_2.png"&gt;&#xD;
            &lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ScreenShot002" border="0" alt="ScreenShot002" src="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/Testdrivenoutsidein_14256/ScreenShot002_thumb.png" width="382" height="190"&gt;&lt;/img&gt;&#xD;
          &lt;/a&gt;  &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Hit Alt+Enter to see a suggested solution:&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/Testdrivenoutsidein_14256/ScreenShot003_2.png"&gt;&#xD;
            &lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ScreenShot003" border="0" alt="ScreenShot003" src="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/Testdrivenoutsidein_14256/ScreenShot003_thumb.png" width="377" height="138"&gt;&lt;/img&gt;&#xD;
          &lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Click enter and you have some options, to use an existing step definition file or&#xD;
create a new. If you hit create a new one and you don’t have an step_definitions folder&#xD;
RubyMine will create it for you.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/Testdrivenoutsidein_14256/ScreenShot004_2.png"&gt;&#xD;
            &lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ScreenShot004" border="0" alt="ScreenShot004" src="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/Testdrivenoutsidein_14256/ScreenShot004_thumb.png" width="315" height="202"&gt;&lt;/img&gt;&#xD;
          &lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
In this case I select the existing bing_steps.rb file&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/Testdrivenoutsidein_14256/ScreenShot005_2.png"&gt;&#xD;
            &lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ScreenShot005" border="0" alt="ScreenShot005" src="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/Testdrivenoutsidein_14256/ScreenShot005_thumb.png" width="344" height="99"&gt;&lt;/img&gt;&#xD;
          &lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Notice that the values between quotes are replaced by a regular expression, hit tab&#xD;
to modify the different tokens of the method template. After generating all the methods&#xD;
and adding the necessary code, this is the result.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/Testdrivenoutsidein_14256/ScreenShot006_2.png"&gt;&#xD;
            &lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ScreenShot006" border="0" alt="ScreenShot006" src="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/Testdrivenoutsidein_14256/ScreenShot006_thumb.png" width="354" height="202"&gt;&lt;/img&gt;&#xD;
          &lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
And when running via the console this is the result:&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;a href="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/Testdrivenoutsidein_14256/ScreenShot007_2.png"&gt;&#xD;
            &lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="ScreenShot007" border="0" alt="ScreenShot007" src="http://blog.dynamicprogrammer.com/content/binary/WindowsLiveWriter/Testdrivenoutsidein_14256/ScreenShot007_thumb.png" width="403" height="185"&gt;&lt;/img&gt;&#xD;
          &lt;/a&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
In this case we are running this specs against an existing piece of software, in my&#xD;
case I will run this against a new un-written site. So to see the scenario pass I&#xD;
should write the feature as well.&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://blog.dynamicprogrammer.com/aggbug.ashx?id=a6ac40ea-5116-44f3-af01-f745df463fa3"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/wnYISSxviewIslo0J86OLe-Nubk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wnYISSxviewIslo0J86OLe-Nubk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/wnYISSxviewIslo0J86OLe-Nubk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wnYISSxviewIslo0J86OLe-Nubk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheDynamicProgrammer/~4/HCXvqf2r-40" height="1" width="1"/&gt;</description>
      <comments>http://blog.dynamicprogrammer.com/CommentView,guid,a6ac40ea-5116-44f3-af01-f745df463fa3.aspx</comments>
      <category>Frameworks</category>
      <category>Methodology</category>
      <category>Programming</category>
      <category>Testing</category>
      <category>Tools</category>
    <feedburner:origLink>http://blog.dynamicprogrammer.com/2010/01/28/TestDrivenOutsideInStartingWithCucumberAndRubyMine.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.dynamicprogrammer.com/Trackback.aspx?guid=faa0bfeb-b7f4-4943-b11a-9d40ad59d35a</trackback:ping>
      <pingback:server>http://blog.dynamicprogrammer.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.dynamicprogrammer.com/PermaLink,guid,faa0bfeb-b7f4-4943-b11a-9d40ad59d35a.aspx</pingback:target>
      <dc:creator>Hernan</dc:creator>
      <wfw:comment>http://blog.dynamicprogrammer.com/CommentView,guid,faa0bfeb-b7f4-4943-b11a-9d40ad59d35a.aspx</wfw:comment>
      <wfw:commentRss>http://blog.dynamicprogrammer.com/SyndicationService.asmx/GetEntryCommentsRss?guid=faa0bfeb-b7f4-4943-b11a-9d40ad59d35a</wfw:commentRss>
      
      <title>Ruby Koans, learning ruby the test driven way.</title>
      <guid isPermaLink="false">http://blog.dynamicprogrammer.com/PermaLink,guid,faa0bfeb-b7f4-4943-b11a-9d40ad59d35a.aspx</guid>
      <link>http://feedproxy.google.com/~r/TheDynamicProgrammer/~3/AKR8o7rxugA/RubyKoansLearningRubyTheTestDrivenWay.aspx</link>
      <pubDate>Fri, 22 Jan 2010 04:09:54 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
Probably you are aware of &lt;a href="http://github.com/edgecase/ruby_koans" target="_blank"&gt;Edgecase&#xD;
Ruby Koans&lt;/a&gt;. In case you aren’t, let me introduce you to them. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
From Wikipedia, &lt;a href="http://en.wikipedia.org/wiki/K%C5%8Dan" target="_blank"&gt;Koan&lt;/a&gt;:&#xD;
&lt;/p&gt;&#xD;
        &lt;blockquote&gt;&#xD;
          &lt;p&gt;&#xD;
A &lt;b&gt;kōan&lt;/b&gt; is fundamental part of the history and lore of &lt;a href="http://en.wikipedia.org/wiki/Zen"&gt;Zen&lt;/a&gt;&lt;a href="http://en.wikipedia.org/wiki/Buddhism"&gt;Buddhism&lt;/a&gt;.&#xD;
It consists of a &lt;a href="http://en.wikipedia.org/wiki/Narrative"&gt;story&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Dialogue"&gt;dialogue&lt;/a&gt;,&#xD;
question, or statement whose meaning cannot be accessed by &lt;a href="http://en.wikipedia.org/wiki/Rationality"&gt;rational&lt;/a&gt; thinking,&#xD;
yet it may be accessible by &lt;a href="http://en.wikipedia.org/wiki/Intuition_%28knowledge%29#Intuition_and_spirituality"&gt;intuition&lt;/a&gt;.&#xD;
A widely known kōan is "Two hands clap and there is a sound; what is the sound of&#xD;
one hand?"&#xD;
&lt;/p&gt;&#xD;
        &lt;/blockquote&gt;&#xD;
        &lt;p&gt;&#xD;
The Ruby Koans are a set of failing test that you need to resolve. Of course the idea&#xD;
is not just to resolve the test as fast as you can but to read the code carefully&#xD;
and understand why it’s failing and them provide the solution.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Once you download the code you just run the rake command inside the folder where the&#xD;
Koans have been downloaded and you will be presented with a failing test and a message&#xD;
in the screen that indicates what you need to do to fix the test.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
You should take as much time as needed to contemplate the solution and internalize&#xD;
the code, the syntax and the constructs that Ruby use.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I went through them once and I’m planning on do it again in a day of two. The Koans&#xD;
cover some important aspect in the following areas: asserts, arrays, arrays assignments,&#xD;
blocks. Classes, open classes and class methods.  Inheritance, hashes, exceptions&#xD;
and so much more, this is the complete list of files in the Koans folder:&#xD;
&lt;/p&gt;&#xD;
        &lt;table style="background-color: #000; color: #fff" border="0"&gt;&#xD;
          &lt;tbody&gt;&#xD;
            &lt;tr&gt;&#xD;
              &lt;td&gt;&#xD;
                &lt;pre&gt;17/01/2010  11:25 PM             2,024 about_arrays.rb&#xD;
17/01/2010  11:29 PM             1,015 about_array_assignment.rb&#xD;
17/01/2010  12:27 PM               942 about_asserts.rb&#xD;
18/01/2010  11:51 PM             2,392 about_blocks.rb&#xD;
21/01/2010  12:02 AM             3,873 about_classes.rb&#xD;
21/01/2010  06:20 AM             3,820 about_class_methods.rb&#xD;
18/01/2010  12:11 AM             2,320 about_control_statements.rb&#xD;
22/12/2009  10:24 PM             1,436 about_dice_project.rb&#xD;
18/01/2010  12:24 AM             1,374 about_exceptions.rb&#xD;
22/12/2009  10:24 PM               317 about_extra_credit.rb&#xD;
17/01/2010  11:35 PM             1,765 about_hashes.rb&#xD;
21/01/2010  12:07 AM             1,652 about_inheritance.rb&#xD;
18/01/2010  10:10 PM             2,441 about_iteration.rb&#xD;
21/01/2010  06:39 AM             4,277 about_message_passing.rb&#xD;
18/01/2010  12:02 AM             3,613 about_methods.rb&#xD;
21/01/2010  12:10 AM             1,132 about_modules.rb&#xD;
17/01/2010  08:08 PM             1,020 about_nil.rb&#xD;
21/01/2010  12:03 AM               920 about_open_classes.rb&#xD;
21/12/2009  04:38 PM             3,295 about_proxy_object_project.rb&#xD;
19/01/2010  12:10 AM             2,657 about_sandwich_code.rb&#xD;
21/01/2010  12:15 AM             1,870 about_scope.rb&#xD;
20/01/2010  11:46 PM             1,843 about_scoring_project.rb&#xD;
17/01/2010  11:51 PM             4,725 about_strings.rb&#xD;
22/12/2009  10:24 PM               771 about_triangle_project.rb&#xD;
22/12/2009  10:24 PM               486 about_triangle_project_2.rb&#xD;
18/01/2010  12:12 AM               788 about_true_and_false.rb&#xD;
22/12/2009  10:24 PM             1,111 array_test.rb&#xD;
21/12/2009  04:38 PM                19 code_mash.rb&#xD;
21/12/2009  04:38 PM             4,498 edgecase.rb&#xD;
22/12/2009  10:24 PM                15 example_file.txt&#xD;
22/12/2009  10:24 PM               156 first_test.rb&#xD;
22/12/2009  10:24 PM             2,323 GREED_RULES.txt&#xD;
21/01/2010  06:32 AM               895 path_to_enlightenment.rb&#xD;
21/12/2009  04:38 PM               159 Rakefile&#xD;
02/01/2010  10:19 PM             5,482 README.rdoc&#xD;
22/12/2009  10:24 PM                70 test_helper.rb&#xD;
18/01/2010  12:29 AM               821 triangle.rb&#xD;
&lt;/pre&gt;&#xD;
              &lt;/td&gt;&#xD;
            &lt;/tr&gt;&#xD;
          &lt;/tbody&gt;&#xD;
        &lt;/table&gt;&#xD;
        &lt;p&gt;&#xD;
 &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Open your favorite editor, launch the console and start running the Koans, just type&#xD;
rake and you will be presented with messages like this,after fixing it your awareness&#xD;
will “expand”.&#xD;
&lt;/p&gt;&#xD;
        &lt;table style="background-color: #000; color: #fff" border="0"&gt;&#xD;
          &lt;tbody&gt;&#xD;
            &lt;tr&gt;&#xD;
              &lt;td&gt;&#xD;
                &lt;pre&gt;Thinking AboutOpenClasses&#xD;
  test_as_defined_dogs_do_bark has expanded your awareness.&#xD;
  test_after_reopening_dogs_can_both_wag_and_bark has damaged your karma.&#xD;
&#xD;
You have not yet reached enlightenment ...&#xD;
&amp;lt;"HPPY"&amp;gt; expected but was&#xD;
&amp;lt;"HAPPY"&amp;gt;.&#xD;
&#xD;
Please meditate on the following code:&#xD;
./about_open_classes.rb:26:in `test_after_reopening_dogs_can_both_wag_and_bark'&#xD;
path_to_enlightenment.rb:28&#xD;
&lt;/pre&gt;&#xD;
              &lt;/td&gt;&#xD;
            &lt;/tr&gt;&#xD;
          &lt;/tbody&gt;&#xD;
        &lt;/table&gt;&#xD;
        &lt;p&gt;&#xD;
 &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
It’s very addictive, the only complain/suggestion I have is to provide some answer&#xD;
to some of the question in the code. May be in a separate show? &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
 &#xD;
&lt;/p&gt;&#xD;
        &lt;pre style="border-bottom: #ffffff 1px solid; border-left: #ffffff 1px solid; padding-bottom: 5px; background-color: #ffffff; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #ffffff 1px solid; border-right: #ffffff 1px solid; padding-top: 5px"&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 96.34%; font-family: consolas,'Courier New',courier,monospace; height: 15px; font-size: 12px"&gt;    # THINK ABOUT IT:&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 92.69%; font-family: consolas,'Courier New',courier,monospace; height: 13px; font-size: 12px"&gt;    #&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    # Is it better to use&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    #    obj.nil?&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    # &lt;span style="color: #0000ff"&gt;or&lt;/span&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    #    obj == nil&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    # Why?&lt;/pre&gt;&#xD;
        &lt;/pre&gt;&#xD;
        &lt;img width="0" height="0" src="http://blog.dynamicprogrammer.com/aggbug.ashx?id=faa0bfeb-b7f4-4943-b11a-9d40ad59d35a"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/PEVYmOT0wMtmJNo9yRcaKUpS89E/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PEVYmOT0wMtmJNo9yRcaKUpS89E/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/PEVYmOT0wMtmJNo9yRcaKUpS89E/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PEVYmOT0wMtmJNo9yRcaKUpS89E/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheDynamicProgrammer/~4/AKR8o7rxugA" height="1" width="1"/&gt;</description>
      <comments>http://blog.dynamicprogrammer.com/CommentView,guid,faa0bfeb-b7f4-4943-b11a-9d40ad59d35a.aspx</comments>
      <category>General</category>
      <category>Methodology</category>
      <category>Patterns</category>
      <category>Programming</category>
      <category>Testing</category>
    <feedburner:origLink>http://blog.dynamicprogrammer.com/2010/01/22/RubyKoansLearningRubyTheTestDrivenWay.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.dynamicprogrammer.com/Trackback.aspx?guid=c226ddf4-3e0a-4f7c-ac30-ee403bbea430</trackback:ping>
      <pingback:server>http://blog.dynamicprogrammer.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.dynamicprogrammer.com/PermaLink,guid,c226ddf4-3e0a-4f7c-ac30-ee403bbea430.aspx</pingback:target>
      <dc:creator>Hernan</dc:creator>
      <wfw:comment>http://blog.dynamicprogrammer.com/CommentView,guid,c226ddf4-3e0a-4f7c-ac30-ee403bbea430.aspx</wfw:comment>
      <wfw:commentRss>http://blog.dynamicprogrammer.com/SyndicationService.asmx/GetEntryCommentsRss?guid=c226ddf4-3e0a-4f7c-ac30-ee403bbea430</wfw:commentRss>
      
      <title>The simplicity and speed of Git and DVCS in general.</title>
      <guid isPermaLink="false">http://blog.dynamicprogrammer.com/PermaLink,guid,c226ddf4-3e0a-4f7c-ac30-ee403bbea430.aspx</guid>
      <link>http://feedproxy.google.com/~r/TheDynamicProgrammer/~3/kx1bT4D3GXo/TheSimplicityAndSpeedOfGitAndDVCSInGeneral.aspx</link>
      <pubDate>Wed, 20 Jan 2010 05:42:31 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
Since I started using &lt;a href="http://git-scm.com/" target="_blank"&gt;Git&lt;/a&gt; a few&#xD;
months ago, and particularly GitHub since last September, my life have been good in &lt;a href="http://en.wikipedia.org/wiki/Distributed_revision_control" target="_blank"&gt;DVCS&lt;/a&gt; land.&lt;br&gt;&lt;br&gt;&#xD;
I used to be a Subversion user and I was happy*, maybe because I didn’t know anything&#xD;
better. Of course I heard all the cool kids (specially in the Ruby world) talking&#xD;
about Git and bragging about it, but I was being loyal to my old pal SVN.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
But this was slowing me down and I wasn’t aware of it. I’m not sure what make me install&#xD;
msysgit for the first time. After struggling a little bit at the beginning and wrapping&#xD;
my head around the concepts and the commands I noticed that my flow started to change.&lt;br&gt;&lt;br&gt;&#xD;
This change was good. Was more Agile. Doing small commits for little changes of code&#xD;
seems natural since the speed of this commits was almost instantaneous (remember the&#xD;
commits happens in your own machine). I’m talking of commits been done almost at the&#xD;
line of code level. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Change this line, run the test, commit. Write another test. Make it fail. Write some&#xD;
code. Make it pass. Commit. Refactor. Run test. Commit. Keep going. &#xD;
&lt;br&gt;&lt;br&gt;&#xD;
Once It was time to push those changes to the master a single command push every change&#xD;
+ every comment at blasting speed.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Since them I started using &lt;a href="http://mercurial.selenic.com/" target="_blank"&gt;Mercurial&lt;/a&gt; as&#xD;
well and the experience was very similar. In the case of Mercurial I just use &lt;a href="http://tortoisehg.bitbucket.org/" target="_blank"&gt;TortoiseHg&lt;/a&gt; but&#xD;
I stick with the command line for Git for most of my operations and I’m glad of that&#xD;
decision.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I wasn’t planning on writing this post today but I just happen to grab the code for &lt;a href="http://github.com/edgecase/ruby_koans/" target="_blank"&gt;edgecase&#xD;
Ruby Koans&lt;/a&gt; from GitHub and it took me all of 1 minute to do everything. Here is&#xD;
the flow:&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Open &lt;a href="http://git-scm.com/" target="_blank"&gt;Console2&lt;/a&gt; and launch the Git&#xD;
bash. Type the following sequence of commands.&#xD;
&lt;/p&gt;&#xD;
        &lt;pre style="border: 1px solid rgb(255, 255, 255); padding: 5px; overflow: auto; background-color: rgb(0, 0, 0); min-height: 40px; width: 732px; height: 400px; color: rgb(255, 255, 255);"&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;Welcome to Git (version 1.6.4-preview20090730)&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;&#xD;
          &lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;&#xD;
          &lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;Run 'git help git' to display the help index.&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;Run 'git help &amp;lt;command&amp;gt;' to display help &lt;span style="color: rgb(0, 0, 255);"&gt;for&lt;/span&gt; specific&#xD;
commands.&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;&#xD;
          &lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;&#xD;
          &lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;Hernan@HERNAN-STUDIO /c/Development&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;$ cd Code/Ruby/Koans_unresolved/&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;&#xD;
          &lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;Hernan@HERNAN-STUDIO /c/Development/Code/Ruby/Koans_unresolved&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;$ git pull git:&lt;span style="color: rgb(0, 128, 0);"&gt;//github.com/edgecase/ruby_koans.git&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;fatal: Not a git repository (&lt;span style="color: rgb(0, 0, 255);"&gt;or&lt;/span&gt; any&#xD;
of the parent directories): .gi&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;t&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;&#xD;
          &lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;Hernan@HERNAN-STUDIO /c/Development/Code/Ruby/Koans_unresolved&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;$ git init&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;Initialized empty Git repository in c:/Development/Code/Ruby/Koans_&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;unresolved/.git/&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;&#xD;
          &lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;Hernan@HERNAN-STUDIO /c/Development/Code/Ruby/Koans_unresolved (mas&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;ter)&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;$ git help&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;&#xD;
          &lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;Hernan@HERNAN-STUDIO /c/Development/Code/Ruby/Koans_unresolved (mas&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;ter)&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;$ git pull git:&lt;span style="color: rgb(0, 128, 0);"&gt;//github.com/edgecase/ruby_koans.git&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;remote: Counting objects: 294, done.&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;remote: Compressing objects: 100% (286/286), done.&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;remote: Total 294 (delta 184), reused 0 (delta 0)Receiving objects:  44% (130/29Receiving objects:  45% (133/294)&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;Receiving objects: 100% (294/294), 51.84 KiB, done.&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;Resolving deltas: 100% (184/184), done.&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;From git:&lt;span style="color: rgb(0, 128, 0);"&gt;//github.com/edgecase/ruby_koans&lt;/span&gt;&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt; * branch            HEAD       -&amp;gt; FETCH_HEAD&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;&#xD;
          &lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;Hernan@HERNAN-STUDIO /c/Development/Code/Ruby/Koans_unresolved (master)&lt;br&gt;&lt;/pre&gt;&#xD;
          &lt;pre style="margin: 0em; background-color: rgb(0, 0, 0); width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;$&lt;/pre&gt;&#xD;
        &lt;/pre&gt;&#xD;
        &lt;p&gt;&#xD;
 &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Notice that I had to type help because I didn’t remember if I had to add a remote&#xD;
or I was able to do a pull right away (I removed the help output from the console&#xD;
output fro brevity).&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Of course the Ruby Koans are just a bunch of very simple text files but the whole&#xD;
process took me less than 2 minutes. I think that is not just because Git is faster&#xD;
but also using the command line for this type of task tends to be a lot faster than&#xD;
using a Gui tool.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
If you haven’t try it yet go ahead and take the plunge. Go distributed, even if you&#xD;
work alone, you want regret it.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
*I’m still using Subversion at work, looking forward to have the time to switch but&#xD;
we are dealing with some time sensitive projects so I don’t want to mess around with&#xD;
that.&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://blog.dynamicprogrammer.com/aggbug.ashx?id=c226ddf4-3e0a-4f7c-ac30-ee403bbea430"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/9gGiK6HDK2VN2dIQG2kJT9zOEbw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9gGiK6HDK2VN2dIQG2kJT9zOEbw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/9gGiK6HDK2VN2dIQG2kJT9zOEbw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9gGiK6HDK2VN2dIQG2kJT9zOEbw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheDynamicProgrammer/~4/kx1bT4D3GXo" height="1" width="1"/&gt;</description>
      <comments>http://blog.dynamicprogrammer.com/CommentView,guid,c226ddf4-3e0a-4f7c-ac30-ee403bbea430.aspx</comments>
      <category>Continuous Integration</category>
      <category>Methodology</category>
      <category>Programming</category>
      <category>Tools</category>
    <feedburner:origLink>http://blog.dynamicprogrammer.com/2010/01/20/TheSimplicityAndSpeedOfGitAndDVCSInGeneral.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.dynamicprogrammer.com/Trackback.aspx?guid=ed4c2dd7-f334-4d99-ad7e-4226bc4bdae3</trackback:ping>
      <pingback:server>http://blog.dynamicprogrammer.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.dynamicprogrammer.com/PermaLink,guid,ed4c2dd7-f334-4d99-ad7e-4226bc4bdae3.aspx</pingback:target>
      <dc:creator>Hernan</dc:creator>
      <wfw:comment>http://blog.dynamicprogrammer.com/CommentView,guid,ed4c2dd7-f334-4d99-ad7e-4226bc4bdae3.aspx</wfw:comment>
      <wfw:commentRss>http://blog.dynamicprogrammer.com/SyndicationService.asmx/GetEntryCommentsRss?guid=ed4c2dd7-f334-4d99-ad7e-4226bc4bdae3</wfw:commentRss>
      <slash:comments>1</slash:comments>
      
      <title>Notes and personal retrospective from my first Codemash.</title>
      <guid isPermaLink="false">http://blog.dynamicprogrammer.com/PermaLink,guid,ed4c2dd7-f334-4d99-ad7e-4226bc4bdae3.aspx</guid>
      <link>http://feedproxy.google.com/~r/TheDynamicProgrammer/~3/F9lwv-q5MHc/NotesAndPersonalRetrospectiveFromMyFirstCodemash.aspx</link>
      <pubDate>Tue, 19 Jan 2010 04:16:28 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
In case you don’t know what it is. &lt;a href="http://codemash.org/" target="_blank"&gt;Codemash&lt;/a&gt; is&#xD;
a conference &lt;a href="http://frazzleddad.blogspot.com/2010/01/i-am-not-codemash.html" target="_blank"&gt;put&#xD;
together by volunteers&lt;/a&gt;. It has been running for four years now. The conference&#xD;
happens at the &lt;a href="http://www.kalahariresorts.com/oh/" target="_blank"&gt;Kalahari&#xD;
Resorts and Convention Center&lt;/a&gt; that has reportedly the biggest indoor water park&#xD;
in North America. That is in Sandusky, Ohio.&#xD;
&lt;/p&gt;&#xD;
        &lt;h5&gt;Organization&#xD;
&lt;/h5&gt;&#xD;
        &lt;p&gt;&#xD;
I only have one world for it, spectacular. You come in and once you register you get&#xD;
your welcome package, a tag and a marker to write down your name, nickname, handler&#xD;
or however you want to be identified. (I saw one tag that only have a big E in it.&#xD;
And that is cool). A lot of attendees (me included) choose to add their twitter handle.&#xD;
If you think about it, at the end of the day a lot of us talk to each other or read&#xD;
each other on twitter so that makes sense. After that your only problem in the world&#xD;
is try to get to as many sessions or open spaces as possible.&#xD;
&lt;/p&gt;&#xD;
        &lt;h5&gt;Content&#xD;
&lt;/h5&gt;&#xD;
        &lt;p&gt;&#xD;
Multiple technologies and practices are been represented at Codemash. Ruby, Java and&#xD;
JVM languages, .NET and CLR/DLR languages, Python, Iron*, C. Functional and OO. SOLID,&#xD;
BDD, TDD, Lean, Leadership, Coaching, Patterns. Iphone, Rails, WebForms, Silverlight,&#xD;
WPF, Tapestry and more development platforms, etc. And if you can’t find what you&#xD;
want, you still have the open spaces, so go ahead and create your own conference.&#xD;
I bet people will join you.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
There is content at the Beginner, Intermediate and Advanced levels. I could like to&#xD;
see a few more 400 level talks but if you think that the idea of the conference is&#xD;
to try to get you out of your comfort zone that may not be very wise. Let me explain.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
The idea is to try to go to talks that are not about the same technologies that you&#xD;
use every day. For example I choose to attend some F#, Ruby, Python and Clojure talks.&#xD;
My level of familiarity varies so I was able to follow and take some good information&#xD;
from the sessions since they were at the intermediate/beginner level.&#xD;
&lt;/p&gt;&#xD;
        &lt;h5&gt;Sessions and open spaces I enjoyed.&#xD;
&lt;/h5&gt;&#xD;
        &lt;p&gt;&#xD;
The keynotes by Mary Poppendieck’s The Five Habits of Succesful Lean Development and&#xD;
Andy Hunt’s The Mother of all Bugs&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Some of the sessions/Open spaces: Presentation Patterns. What makes ruby different.&#xD;
Open space about FubuMVC. NoSQL: Death to relational DB’s. Introduction to Cucumber.&#xD;
Testing ASP.NET applications using Ruby. Being and evil genius with F#. 0-60 with&#xD;
Fluent NHibernate. Building webapps with Compojure. IronPython with ASP.NET. &#xD;
&lt;/p&gt;&#xD;
        &lt;h5&gt;The venue&#xD;
&lt;/h5&gt;&#xD;
        &lt;p&gt;&#xD;
Perfect. I think that the venue is part of the magic that make this Conference so&#xD;
special. Imagine that you are in this African themed hotel, where people wearing sandals&#xD;
and T-shirts around you will be checking their emails or updating their twitter timeline&#xD;
from their smart phones. Imagine going to a water park after the last session of the&#xD;
day, or just go and play mini golf with your son. That makes for a very relaxed vibe&#xD;
and you feel it and see it at the conference.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
The staff at the hotel is great, friendly and professional and all interaction (from&#xD;
the moment I made my reservation on the phone) was very pleasant. &#xD;
&lt;/p&gt;&#xD;
        &lt;h5&gt;The food&#xD;
&lt;/h5&gt;&#xD;
        &lt;p&gt;&#xD;
Ok. This is something I’m really surprised. You pay $175 for the 2 days of conference&#xD;
+ $150 for the extra Precompiler day. That’s a grand total of $325  for a 3 day&#xD;
conference. So, you may expect to have some scarcity on the food supply, specially&#xD;
when you consider that you have breakfast and lunch all of three days and dinner on&#xD;
one of the days.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Well, let me tell you something. There was not such thing. The food was good and plentiful.&#xD;
Actually It was fantastic. I went to conferences where I paid $2000 for the same number&#xD;
of days and all I got was a wrap or a sandwich that was prepared 12 hours before. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
On top of that there was coffee and pops (coke and sprite cans) available during the&#xD;
day to keep you going.&#xD;
&lt;/p&gt;&#xD;
        &lt;h5&gt;What I will change&#xD;
&lt;/h5&gt;&#xD;
        &lt;p&gt;&#xD;
Nothing from the conference, maybe extended to 3+1 days? &#xD;
&lt;/p&gt;&#xD;
        &lt;h5&gt;My recommendations for new attendants.&#xD;
&lt;/h5&gt;&#xD;
        &lt;p&gt;&#xD;
If you have a family take them with you, specially if you have kids. My only mistake&#xD;
(and seems to be a common theme among first timers) was to go along. The organization&#xD;
even has a KidsMash going on where the kids can play and be ask geeks as their parents&#xD;
when they are tired of the water park.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Try to study the list of sessions in advance but relax and make sure you scan the&#xD;
Open spaces regularly and keep an eye on that twitter timeline. If you are not getting&#xD;
the most of the session you are in move to another one, just try not to disrupt&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
And like in most conferences take a power cord (a long one if possible) with you.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I’m already impatiently waiting for next year Codemash. I can only say a big thank&#xD;
you to all the people that works to make such a great experienced for all of us.&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://blog.dynamicprogrammer.com/aggbug.ashx?id=ed4c2dd7-f334-4d99-ad7e-4226bc4bdae3"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/AHFBxVkBK6ZZ-dMeM9KomL1sezU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/AHFBxVkBK6ZZ-dMeM9KomL1sezU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/AHFBxVkBK6ZZ-dMeM9KomL1sezU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/AHFBxVkBK6ZZ-dMeM9KomL1sezU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheDynamicProgrammer/~4/F9lwv-q5MHc" height="1" width="1"/&gt;</description>
      <comments>http://blog.dynamicprogrammer.com/CommentView,guid,ed4c2dd7-f334-4d99-ad7e-4226bc4bdae3.aspx</comments>
      <category>General</category>
    <feedburner:origLink>http://blog.dynamicprogrammer.com/2010/01/19/NotesAndPersonalRetrospectiveFromMyFirstCodemash.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.dynamicprogrammer.com/Trackback.aspx?guid=e22d8680-ed5e-4038-a9c9-ad705ea8aeac</trackback:ping>
      <pingback:server>http://blog.dynamicprogrammer.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.dynamicprogrammer.com/PermaLink,guid,e22d8680-ed5e-4038-a9c9-ad705ea8aeac.aspx</pingback:target>
      <dc:creator>Hernan</dc:creator>
      <wfw:comment>http://blog.dynamicprogrammer.com/CommentView,guid,e22d8680-ed5e-4038-a9c9-ad705ea8aeac.aspx</wfw:comment>
      <wfw:commentRss>http://blog.dynamicprogrammer.com/SyndicationService.asmx/GetEntryCommentsRss?guid=e22d8680-ed5e-4038-a9c9-ad705ea8aeac</wfw:commentRss>
      
      <title>Insert route, route registration after the fact on ASP.NET MVC</title>
      <guid isPermaLink="false">http://blog.dynamicprogrammer.com/PermaLink,guid,e22d8680-ed5e-4038-a9c9-ad705ea8aeac.aspx</guid>
      <link>http://feedproxy.google.com/~r/TheDynamicProgrammer/~3/pAP-Grhcu08/InsertRouteRouteRegistrationAfterTheFactOnASPNETMVC.aspx</link>
      <pubDate>Sat, 02 Jan 2010 03:47:18 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
Kazi Manzur Rashid has a post about registering Areas dynamically after the registration&#xD;
of other routes and the problems this has since the order the routes are registered&#xD;
is very important. Go &lt;a href="http://weblogs.asp.net/rashid/archive/2009/12/30/asp-net-mvc-2-and-why-dynamic-area-is-not-supported.aspx" target="_blank"&gt;read&#xD;
his post&lt;/a&gt; and come back for a possible solution to the problem.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Ok, based on his post I decided to try to implement exactly what he is looking for.&#xD;
After poking around with reflector and brushing up my Reflection skills I came up&#xD;
with a first implementation that does the trick.&#xD;
&lt;/p&gt;&#xD;
        &lt;pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  1:     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #0000ff"&gt;static&lt;/span&gt;&lt;span style="color: #0000ff"&gt;class&lt;/span&gt; RoutCollectionExtension &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  2:     {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  3:         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #0000ff"&gt;static&lt;/span&gt; RouteCollection&#xD;
AddArea(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt; RouteCollection routes, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; routeName,&#xD;
Route newRoute) &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  4:         {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  5:             var fieldInfo =  routes.GetType()&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  6:                 .GetField("&lt;span style="color: #8b0000"&gt;_namedMap&lt;/span&gt;",&#xD;
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  7: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  8:             var dict = fieldInfo.GetValue(routes);&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  9:             dict.GetType()&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 10:                 .GetMethod("&lt;span style="color: #8b0000"&gt;Add&lt;/span&gt;",&#xD;
BindingFlags.Public | BindingFlags.Instance) &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 11:                 .Invoke(dict,&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;[]{routeName,newRoute}); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 12: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 13:             fieldInfo.SetValue(routes,dict);&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 14: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 15:             routes.GetType()&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 16:                 .GetMethod("&lt;span style="color: #8b0000"&gt;InsertItem&lt;/span&gt;",&#xD;
BindingFlags.NonPublic | BindingFlags.Instance) &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 17:                 .Invoke(routes, &lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;[]&#xD;
{ 0, newRoute }); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 18: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 19:             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; routes; &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 20:         }&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 21:     }&lt;/pre&gt;&#xD;
        &lt;/pre&gt;&#xD;
        &lt;p&gt;&#xD;
After posted this solution as a comment on Kazi’s post I decided to polish this a&#xD;
little more and to actually provide a similar API as the MapRoute extension from the&#xD;
MVC framework. The idea is to provide a set of InsertRoute and InsertRouteAfter. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
So for the InsertRoute, this is the final code:&#xD;
&lt;/p&gt;&#xD;
        &lt;pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  1:     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #0000ff"&gt;static&lt;/span&gt;&lt;span style="color: #0000ff"&gt;class&lt;/span&gt; RoutCollectionExtension &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  2:     {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  3:         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #0000ff"&gt;static&lt;/span&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt; InsertRoute(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt; RouteCollection&#xD;
routes, &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; index, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; routeName,&#xD;
Route newRoute) &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  4:         {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  5:             var fieldInfo =  routes.GetType()&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  6:                 .GetField("&lt;span style="color: #8b0000"&gt;_namedMap&lt;/span&gt;",&#xD;
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  7: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  8:             var dict = fieldInfo.GetValue(routes);&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  9:             dict.GetType()&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 10:                 .GetMethod("&lt;span style="color: #8b0000"&gt;Add&lt;/span&gt;",&#xD;
BindingFlags.Public | BindingFlags.Instance) &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 11:                 .Invoke(dict,&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;[]{routeName,newRoute}); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 12: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 13:             fieldInfo.SetValue(routes,dict);&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 14: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 15:             routes.GetType()&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 16:                 .GetMethod("&lt;span style="color: #8b0000"&gt;InsertItem&lt;/span&gt;",&#xD;
BindingFlags.NonPublic | BindingFlags.Instance) &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 17:                 .Invoke(routes, &lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;[]&#xD;
{ index, newRoute }); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 18:         }&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 19: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 20: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 21:         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #0000ff"&gt;static&lt;/span&gt; Route&#xD;
InsertRoute(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt; RouteCollection routes, &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; index, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; name, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; url) &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 22:         {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 23:             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; routes.InsertRoute(index,&#xD;
name, url, &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 24:         }&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 25: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 26:         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #0000ff"&gt;static&lt;/span&gt; Route&#xD;
InsertRoute(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt; RouteCollection routes, &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; index, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; name, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; url, &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; defaults) &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 27:         {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 28:             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; routes.InsertRoute(index,&#xD;
name, url, defaults, &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 29:         }&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 30: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 31:         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #0000ff"&gt;static&lt;/span&gt; Route&#xD;
InsertRoute(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt; RouteCollection routes, &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; index, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; name, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; url, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[]&#xD;
namespaces) &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 32:         {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 33:             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; routes.InsertRoute(index,&#xD;
name, url, &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;,&#xD;
namespaces); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 34:         }&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 35: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&#xD;
            &lt;p&gt;&#xD;
36: &lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #0000ff"&gt;static&lt;/span&gt; Route&#xD;
InsertRoute(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt; RouteCollection routes, &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; index, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; name, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; url, &#xD;
&lt;/p&gt;&#xD;
            &lt;blockquote&gt;&#xD;
              &lt;p&gt;&#xD;
                &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; defaults, &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; constraints) &#xD;
&lt;/p&gt;&#xD;
            &lt;/blockquote&gt;&#xD;
          &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 37:         {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 38:             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; routes.InsertRoute(index,&#xD;
name, url, defaults, constraints, &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 39:         }&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 40: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&#xD;
            &lt;p&gt;&#xD;
41: &lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #0000ff"&gt;static&lt;/span&gt; Route&#xD;
InsertRoute(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt; RouteCollection routes, &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; index, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; name, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; url, &#xD;
&lt;/p&gt;&#xD;
            &lt;blockquote&gt;&#xD;
              &lt;p&gt;&#xD;
                &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; defaults, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[]&#xD;
namespaces) &#xD;
&lt;/p&gt;&#xD;
            &lt;/blockquote&gt;&#xD;
          &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 42:         {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 43:             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; routes.InsertRoute(index,&#xD;
name, url, defaults, &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;, namespaces); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 44:         }&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 45: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&#xD;
            &lt;p&gt;&#xD;
46: &lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #0000ff"&gt;static&lt;/span&gt; Route&#xD;
InsertRoute(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt; RouteCollection routes, &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; index, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; name, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; url, &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; defaults, &#xD;
&lt;/p&gt;&#xD;
            &lt;blockquote&gt;&#xD;
              &lt;p&gt;&#xD;
                &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; constraints, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[]&#xD;
namespaces) &#xD;
&lt;/p&gt;&#xD;
            &lt;/blockquote&gt;&#xD;
          &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 47:         {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 48:             &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (routes&#xD;
== &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;) &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 49:             {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 50:                 &lt;span style="color: #0000ff"&gt;throw&lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ArgumentNullException("&lt;span style="color: #8b0000"&gt;routes&lt;/span&gt;"); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 51:             }&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 52:             &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (url&#xD;
== &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;) &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 53:             {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 54:                 &lt;span style="color: #0000ff"&gt;throw&lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ArgumentNullException("&lt;span style="color: #8b0000"&gt;url&lt;/span&gt;"); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 55:             }&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 56:             var item = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Route(url, &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; MvcRouteHandler()) &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 57:                              {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 58:                                  Defaults = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; RouteValueDictionary(defaults), &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 59:                                  Constraints = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; RouteValueDictionary(constraints), &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 60:                                  DataTokens = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; RouteValueDictionary() &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 61:                              };&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 62:             &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ((namespaces&#xD;
!= &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;) &amp;amp;&amp;amp; (namespaces.Length &amp;gt; 0)) &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 63:             {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 64:                 item.DataTokens["&lt;span style="color: #8b0000"&gt;Namespaces&lt;/span&gt;"]&#xD;
= namespaces; &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 65:             }&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 66:             routes.InsertRoute(index, name, item);&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 67:             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; item; &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 68:         }&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 69:     }&lt;/pre&gt;&#xD;
        &lt;/pre&gt;&#xD;
        &lt;p&gt;&#xD;
The problem with this is that you probably don’t know the index of the routes and&#xD;
those index will change with each route that get’s registered. So InsertRouteAfter&#xD;
is better since we can insert a route after another route by name. The code is very&#xD;
simple, I won’t display all the overloads just the actual implementation.&#xD;
&lt;/p&gt;&#xD;
        &lt;pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  1:         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #0000ff"&gt;static&lt;/span&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt; InsertRouteAfter(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt; RouteCollection&#xD;
routes, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; nameOfExistingRoute, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; nameOfRouteToInsert,&#xD;
Route newRoute) &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  2:         {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  3:             var fieldInfo = routes.GetType()&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  4:                 .GetField("&lt;span style="color: #8b0000"&gt;_namedMap&lt;/span&gt;",&#xD;
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  5: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  6:             var dict = fieldInfo.GetValue(routes);&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  7:             dict.GetType()&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  8:                 .GetMethod("&lt;span style="color: #8b0000"&gt;Add&lt;/span&gt;",&#xD;
BindingFlags.Public | BindingFlags.Instance) &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  9:                 .Invoke(dict, &lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;[]&#xD;
{ nameOfRouteToInsert, newRoute }); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 10: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 11:             var existingRoute = dict.GetType()&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 12:                 .GetProperty("&lt;span style="color: #8b0000"&gt;Item&lt;/span&gt;") &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 13:                 .GetValue(dict, &lt;span style="color: #0000ff"&gt;new&lt;/span&gt;[]&#xD;
{nameOfExistingRoute}); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 14: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 15:             fieldInfo.SetValue(routes, dict);&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 16: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 17:             var index = routes.GetType()&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 18:                 .GetMethod("&lt;span style="color: #8b0000"&gt;IndexOf&lt;/span&gt;",&#xD;
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance) &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 19:                 .Invoke(routes, &lt;span style="color: #0000ff"&gt;new&lt;/span&gt;[]&#xD;
{existingRoute}); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 20: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 21:             index = (&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;)&#xD;
index + 1; &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 22: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 23:             routes.GetType()&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 24:                 .GetMethod("&lt;span style="color: #8b0000"&gt;InsertItem&lt;/span&gt;",&#xD;
BindingFlags.NonPublic | BindingFlags.Instance) &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 25:                 .Invoke(routes, &lt;span style="color: #0000ff"&gt;new&lt;/span&gt;[]&#xD;
{ index, newRoute }); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 26:         }&lt;/pre&gt;&#xD;
        &lt;/pre&gt;&#xD;
        &lt;h5&gt;Warning!!!&#xD;
&lt;/h5&gt;&#xD;
        &lt;p&gt;&#xD;
If you decide to use this code make sure that you have tests in place since we are&#xD;
relying in things like the name of a internal field that can be changed without affecting&#xD;
the public API so this extensions are fragile from that point of view. Besides that,&#xD;
reflection is slow, but since route registration should happens only once per application&#xD;
I’m not worry about that part. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
 &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
          &lt;strong&gt;&#xD;
            &lt;font size="2"&gt;&#xD;
            &lt;/font&gt;&#xD;
          &lt;/strong&gt;&#xD;
        &lt;/p&gt;&#xD;
        &lt;a href="http://dotnetshoutout.com/The-Dynamic-Programmer-Insert-route-route-registration-after-the-fact-on-ASPNET-MVC" rev="vote-for"&gt;&#xD;
          &lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fblog.dynamicprogrammer.com%2F2010%2F01%2F02%2FInsertRouteRouteRegistrationAfterTheFactOnASPNETMVC.aspx"&gt;&lt;/img&gt;&#xD;
        &lt;/a&gt;&#xD;
        &lt;img width="0" height="0" src="http://blog.dynamicprogrammer.com/aggbug.ashx?id=e22d8680-ed5e-4038-a9c9-ad705ea8aeac"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/lUDU5-VFeH7zkyZZk4U58FmMZGY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lUDU5-VFeH7zkyZZk4U58FmMZGY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/lUDU5-VFeH7zkyZZk4U58FmMZGY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lUDU5-VFeH7zkyZZk4U58FmMZGY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheDynamicProgrammer/~4/pAP-Grhcu08" height="1" width="1"/&gt;</description>
      <comments>http://blog.dynamicprogrammer.com/CommentView,guid,e22d8680-ed5e-4038-a9c9-ad705ea8aeac.aspx</comments>
      <category>Programming</category>
    <feedburner:origLink>http://blog.dynamicprogrammer.com/2010/01/02/InsertRouteRouteRegistrationAfterTheFactOnASPNETMVC.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.dynamicprogrammer.com/Trackback.aspx?guid=0b41d1d6-797f-45aa-8b05-96f27998fd5f</trackback:ping>
      <pingback:server>http://blog.dynamicprogrammer.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.dynamicprogrammer.com/PermaLink,guid,0b41d1d6-797f-45aa-8b05-96f27998fd5f.aspx</pingback:target>
      <dc:creator>Hernan</dc:creator>
      <wfw:comment>http://blog.dynamicprogrammer.com/CommentView,guid,0b41d1d6-797f-45aa-8b05-96f27998fd5f.aspx</wfw:comment>
      <wfw:commentRss>http://blog.dynamicprogrammer.com/SyndicationService.asmx/GetEntryCommentsRss?guid=0b41d1d6-797f-45aa-8b05-96f27998fd5f</wfw:commentRss>
      <slash:comments>1</slash:comments>
      
      <title>Codemash Scheduler online – pick and choose sessions to go and export to your calendar.</title>
      <guid isPermaLink="false">http://blog.dynamicprogrammer.com/PermaLink,guid,0b41d1d6-797f-45aa-8b05-96f27998fd5f.aspx</guid>
      <link>http://feedproxy.google.com/~r/TheDynamicProgrammer/~3/Zxuj6nh3TYU/CodemashSchedulerOnlinePickAndChooseSessionsToGoAndExportToYourCalendar.aspx</link>
      <pubDate>Sun, 27 Dec 2009 03:10:11 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
When the Codemash guys announced their API I decided to create an app using it. I&#xD;
wasn’t sure what to do at first but It was pretty obvious anyway. Some kind of scheduling&#xD;
tool. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
It took me some time to have the time to start and them to finish it. I finally was&#xD;
able to deploy this last night and today I add another feature to considered completed&#xD;
based on my initial goal.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
You can visit the tool here: &lt;a title="http://mysessioncalendar.com/" href="http://mysessioncalendar.com/"&gt;http://mysessioncalendar.com/&lt;/a&gt; &#xD;
&lt;/p&gt;&#xD;
        &lt;h5&gt;What it does?&#xD;
&lt;/h5&gt;&#xD;
        &lt;p&gt;&#xD;
The tool has three tabs one for each conference day and a third for the pre compiler.&#xD;
Each tab has columns (representing the rooms where the sessions take place, just noticed&#xD;
I don’t have the room on top) and them the sessions are displayed below ordered by&#xD;
time.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
The idea is that you can select the sessions you are interested in. The tool does&#xD;
not make any judgement calls and if you want to select two sessions in the same time&#xD;
slot is up to you. Once you mark all the sessions just click the “Save Schedule” button&#xD;
on top and a modal dialog will display with a link to open (in a new window) a list&#xD;
with the selected sessions.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
This time the sessions are ordered in three columns: One for each day and the sessions&#xD;
for each day are ordered by time.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
The page has the AddThis widget that allow you to twit, email, print, add to favourites,&#xD;
show them in facebook and more. Another cool option is to export them as iCal&lt;br&gt;&#xD;
, this way you can add them to your google calendar and other tools supporting this&#xD;
format.&#xD;
&lt;/p&gt;&#xD;
        &lt;h5&gt;How was done.&#xD;
&lt;/h5&gt;&#xD;
        &lt;p&gt;&#xD;
The site have been implemented using ASP.NET MVC, jquery for all the JavaScript and&#xD;
the UI design using JQueryUI. Data is saved as xml so no need to use databases. Originally&#xD;
I started using Castle.ActiveRecord since the data model is extremely simple, but&#xD;
is so simple that the use of a db was overkill. The total time to have the site done&#xD;
was maybe 24 man hours divided in several coding sessions of no more than 3 hours&#xD;
at a time. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
The use a a widget like AddThis make implementing the sharing functionality a 15 minutes&#xD;
deal.&#xD;
&lt;/p&gt;&#xD;
        &lt;h5&gt;Conclusion.&#xD;
&lt;/h5&gt;&#xD;
        &lt;p&gt;&#xD;
There are some things that can be better like font sizes (thanks Ahmed for the report).&#xD;
Originally I wanted to have a better interface with drag and drop or double click&#xD;
in a session to select, but decided to go with a simpler implementation and get this&#xD;
out of my computer and into the wild.&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://blog.dynamicprogrammer.com/aggbug.ashx?id=0b41d1d6-797f-45aa-8b05-96f27998fd5f"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/UAicZdjaRCaaG1LyZZ06D8A6ibo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/UAicZdjaRCaaG1LyZZ06D8A6ibo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/UAicZdjaRCaaG1LyZZ06D8A6ibo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/UAicZdjaRCaaG1LyZZ06D8A6ibo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheDynamicProgrammer/~4/Zxuj6nh3TYU" height="1" width="1"/&gt;</description>
      <comments>http://blog.dynamicprogrammer.com/CommentView,guid,0b41d1d6-797f-45aa-8b05-96f27998fd5f.aspx</comments>
      <category>General</category>
    <feedburner:origLink>http://blog.dynamicprogrammer.com/2009/12/27/CodemashSchedulerOnlinePickAndChooseSessionsToGoAndExportToYourCalendar.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.dynamicprogrammer.com/Trackback.aspx?guid=d7981845-4d85-4775-8101-882d98a54040</trackback:ping>
      <pingback:server>http://blog.dynamicprogrammer.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.dynamicprogrammer.com/PermaLink,guid,d7981845-4d85-4775-8101-882d98a54040.aspx</pingback:target>
      <dc:creator>Hernan</dc:creator>
      <wfw:comment>http://blog.dynamicprogrammer.com/CommentView,guid,d7981845-4d85-4775-8101-882d98a54040.aspx</wfw:comment>
      <wfw:commentRss>http://blog.dynamicprogrammer.com/SyndicationService.asmx/GetEntryCommentsRss?guid=d7981845-4d85-4775-8101-882d98a54040</wfw:commentRss>
      <slash:comments>2</slash:comments>
      
      <title>ASP.NET Mvc in Action. Book review</title>
      <guid isPermaLink="false">http://blog.dynamicprogrammer.com/PermaLink,guid,d7981845-4d85-4775-8101-882d98a54040.aspx</guid>
      <link>http://feedproxy.google.com/~r/TheDynamicProgrammer/~3/RUh1fu2EOm4/ASPNETMvcInActionBookReview.aspx</link>
      <pubDate>Sun, 22 Nov 2009 22:25:43 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
Some time ago I wrote a first impressions about ASP.NET MVC in Action from Manning.&#xD;
It was after downloading an reading a few chapters available via the Manning early&#xD;
access program (MEAP). The book was written by Jeffrey Palermo, Ben Scheirman and&#xD;
Jimmy Bogard.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
A month ago or so I finally got my print copy and I started reading it right away.&#xD;
Let me put it simple, this book is fantastic. If you are planning to do any development&#xD;
with the framework you need to have it in your book shelves.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
The content span over just 352 pages and it covers pretty much every single aspect&#xD;
of the framework. It follows a very clear path explaining how the pieces fit together.&#xD;
I think that It can be useful for both the experienced and the novice programmer.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
One of the remarkable aspects of the book is the constant focus on testability and&#xD;
customization of the different pieces of the framework to help you reduce friction&#xD;
and improve the design of your application. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I also felt that the authors took a very pragmatic approach while exposing users to&#xD;
different options on implementing web applications with the framework.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I can see the book as having 3 parts. The first 6 chapters explain and show how to&#xD;
use and extend the framework. Chapters 7 to 10, explore more complex scenarios, like&#xD;
complex sites, use of AJAX, how to leverage existing asp.net features and hosting/deploying&#xD;
your final app.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
The last part is a compendium of Best practices, Recipes and an study or other two&#xD;
MVC frameworks, Monorails and Ruby on Rails.&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://blog.dynamicprogrammer.com/aggbug.ashx?id=d7981845-4d85-4775-8101-882d98a54040"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/XoJX7R3zZr48dzB_fnsCJzs8C5A/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/XoJX7R3zZr48dzB_fnsCJzs8C5A/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/XoJX7R3zZr48dzB_fnsCJzs8C5A/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/XoJX7R3zZr48dzB_fnsCJzs8C5A/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheDynamicProgrammer/~4/RUh1fu2EOm4" height="1" width="1"/&gt;</description>
      <comments>http://blog.dynamicprogrammer.com/CommentView,guid,d7981845-4d85-4775-8101-882d98a54040.aspx</comments>
      <category>Books</category>
    <feedburner:origLink>http://blog.dynamicprogrammer.com/2009/11/22/ASPNETMvcInActionBookReview.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.dynamicprogrammer.com/Trackback.aspx?guid=f63b4424-be13-4d32-bc0b-6bc2e533da6b</trackback:ping>
      <pingback:server>http://blog.dynamicprogrammer.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.dynamicprogrammer.com/PermaLink,guid,f63b4424-be13-4d32-bc0b-6bc2e533da6b.aspx</pingback:target>
      <dc:creator>Hernan</dc:creator>
      <wfw:comment>http://blog.dynamicprogrammer.com/CommentView,guid,f63b4424-be13-4d32-bc0b-6bc2e533da6b.aspx</wfw:comment>
      <wfw:commentRss>http://blog.dynamicprogrammer.com/SyndicationService.asmx/GetEntryCommentsRss?guid=f63b4424-be13-4d32-bc0b-6bc2e533da6b</wfw:commentRss>
      <slash:comments>1</slash:comments>
      
      <title>My new an improved tooling for builds and project management.</title>
      <guid isPermaLink="false">http://blog.dynamicprogrammer.com/PermaLink,guid,f63b4424-be13-4d32-bc0b-6bc2e533da6b.aspx</guid>
      <link>http://feedproxy.google.com/~r/TheDynamicProgrammer/~3/PUP9UZNn0zg/MyNewAnImprovedToolingForBuildsAndProjectManagement.aspx</link>
      <pubDate>Mon, 16 Nov 2009 05:26:55 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
I try to be pragmatic in my approach to development and one of the things that change&#xD;
the most are the tools I use to deliver software. There are several reasons why I&#xD;
change tools so often. &#xD;
&lt;/p&gt;&#xD;
        &lt;ol&gt;&#xD;
          &lt;li&gt;&#xD;
The evolution of the software I write call for new or different tools.&lt;/li&gt;&#xD;
          &lt;li&gt;&#xD;
Search for efficiency and eliminate pain points.&lt;/li&gt;&#xD;
          &lt;li&gt;&#xD;
I change my approach to software development and new methodologies need new tools.&lt;/li&gt;&#xD;
          &lt;li&gt;&#xD;
I just love to try new stuff :-)&lt;/li&gt;&#xD;
        &lt;/ol&gt;&#xD;
        &lt;p&gt;&#xD;
In this post I want to concentrate in the tools used to manage projects and builds.&#xD;
Until recently my favoured tools in this context consisted of NAnt, CC.Net/Hudson&#xD;
and Subversion.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
For bug tracking I used the bug tracker in Google code for my OSS projects integrated&#xD;
to TortoiseSVN or BugTracker.Net. (Note: At work we use FogBugz and we are very happy&#xD;
with it.)&#xD;
&lt;/p&gt;&#xD;
        &lt;h5&gt;Subversion was the first to go.&#xD;
&lt;/h5&gt;&#xD;
        &lt;p&gt;&#xD;
Subversion is a great VCS but I usually have two problems with it. Speed and problems&#xD;
with complex merges. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
When I work alone, merges are not an issue of course, but speed still is. At the same&#xD;
time more and more people seems to be switching to DVCS (Distributed or Decentralized)&#xD;
systems like Git or Mercurial. After taking a quick look at GitHub and follow their&#xD;
tutorials I was able to move some of my projects there in a few hours. (Most of the&#xD;
time spent on reading and learning from other people mistakes). &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Git is fast, Fast, FAST! The whole idea of local commits and clone repositories is&#xD;
fantastic and they really help me with my workflow in the sense that I can do one&#xD;
or two changes, commit, one or two more, commit, find a bug, revert change, finish&#xD;
a story, push to GitHub. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
To manage Git I’m using a combination of command line and graphic interface using&#xD;
Git gui. So far I haven’t feel the need to use/install TortoiseGit.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I still have some projects hosted in google code and I’m using Subversion with them,&#xD;
I’m thinking on switch them over to GitHub once I start working on them again.&#xD;
&lt;/p&gt;&#xD;
        &lt;h5&gt;Nant followed it. &#xD;
&lt;/h5&gt;&#xD;
        &lt;p&gt;&#xD;
I don’t have a problem with XML so the fact that Nant is XML based does not bothers&#xD;
me, really. But I also like the power of a good scripting language to manage repetitive&#xD;
tasks. I decided to move away from Nant and try to adopt some of the newest build&#xD;
systems. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I took a look at psake and them I read “&lt;a href="http://www.lostechies.com/blogs/derickbailey/archive/2009/04/08/how-a-net-developer-learned-ruby-and-rake-to-build-net-apps-in-windows.aspx" target="_blank"&gt;How&#xD;
a net developer learned ruby and rake to build net apps in windows&lt;/a&gt;” by &lt;a href="http://www.lostechies.com/members/derick.bailey/default.aspx"&gt;Derrick&#xD;
Bailey&lt;/a&gt; and that convinced me to take the plunge. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
My knowledge of Ruby is extremely rudimentary but I even with that handicap I was&#xD;
able to have a &lt;a href="http://en.wikipedia.org/wiki/Rake_%28software%29" target="_blank"&gt;Rake&lt;/a&gt; build&#xD;
script up and running in less than 90 minutes. This script cleans the build target,&#xD;
create the Package folder, builds the VS solution, run Nunit test on two dll's, generate&#xD;
the NUnit report as an xml file, and run the migrations from Migrator.Net (that last&#xD;
part is not working yet, I will need to take a closer look at Migrator.Net command&#xD;
line args).&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
The most useful resource on Derik's post was &lt;a href="http://codebetter.com/blogs/david_laribee/archive/2008/08/25/omg-rake.aspx" target="_blank"&gt;Laribee's&#xD;
OMG Rake!&lt;/a&gt;. Laribee’s sample code and a few queries to Google was all I need. (No,&#xD;
I did not copy and paste ALL Laribee’s code, just use it as a reference)&#xD;
&lt;/p&gt;&#xD;
        &lt;h5&gt;Agile Zen or project management made easy. &#xD;
&lt;/h5&gt;&#xD;
        &lt;p&gt;&#xD;
I got a free account on &lt;a href="http://agilezen.com/" target="_blank"&gt;Agile Zen&lt;/a&gt; the&#xD;
first week after they went live. I remember creating the account, playing around on&#xD;
the Board and leaving the site. My thoughts at the moment were something like. &lt;em&gt;This&#xD;
is actually cool. Very nice design. Good usability. I should give it a proper test&#xD;
drive with some real project.&lt;/em&gt;&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Of course, I never came back until last Friday. While working in a few features for&#xD;
Pronghorn I decided that it was time I stop spiking and started to write proper user&#xD;
stories to drive the framework. I remembered Agile Zen and went back. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
The site looks great and there are some improvements since that last time I saw it. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
What really amazed me is how intuitive the whole process is. There is no waste generated&#xD;
by using this tool. Creating stories is 1 click. Editing stories, another one. Color&#xD;
coding two clicks. Double click in a field to edit them, etc. Very easy, very intuitive.&#xD;
There is even a bar at the bottom with hints that I decided to hide and I didn’t miss&#xD;
it. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
The site is very responsive and the only thing I miss is integration with a VCS system.&#xD;
They have a very simple API for paying accounts, but in the docs it looks like is&#xD;
read only, so no hooks in there (If anybody knows otherwise, please leave a comment).&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I will keep using it for another week or so before making a final decision but so&#xD;
far everything indicates that I will be upgrading the account to a paying one pretty&#xD;
soon. (The free account only allows for one project and one developers, what is more&#xD;
than fair.)&#xD;
&lt;/p&gt;&#xD;
        &lt;h5&gt;Tying it up all together with CI.&#xD;
&lt;/h5&gt;&#xD;
        &lt;p&gt;&#xD;
As I mentioned before my main experience have been using CruiseControl.Net and Hudson&#xD;
as the CI servers. I installed TeamCity a long time ago to give it a try but I never&#xD;
use it. My first choice was to look for some hosted solution. After searching I only&#xD;
found a few and non of them worked with .Net (at least not at the moment). &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I was going to go back once more with &lt;a href="http://hudson-ci.org/" target="_blank"&gt;Hudson&lt;/a&gt; but&#xD;
I wasn’t able to connect to the Hudson site to download the code. (Their site is up&#xD;
now). So I decided to take a new look at &lt;a href="http://www.jetbrains.com/teamcity/" target="_blank"&gt;JetBrain’s&#xD;
TeamCity&lt;/a&gt;. At the moment of this writing they are running the EAP for version 5. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I wanted to install it and use my newly crafted Rake build script with the .Net project&#xD;
and have my test report integrated in the dashboard. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
First I got the msi from the daily builds for version 5.00. Double click on it to&#xD;
install the server and the agent and after a few minutes and two (three?) questions,&#xD;
the home page of the serve shows up in the browser. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Creating the first project and associated build profile was a breeze. I just followed&#xD;
along the instructions in the screen. A few times when I wasn’t sure what a given&#xD;
label meant, I made use of the contextual help. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I did have an issue but it was my fault when setting some relative path to the build&#xD;
file and the build target, for running test and creating the Package folder. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
From downloading the installer to having the project building successfully took me&#xD;
between 10 to 15 minutes.&#xD;
&lt;/p&gt;&#xD;
        &lt;h5&gt;Conclusion.&#xD;
&lt;/h5&gt;&#xD;
        &lt;p&gt;&#xD;
This new setup makes me more productive since I have better tools that save me time&#xD;
in different areas like. Setting things up, working around their idiosyncrasies, configuration&#xD;
heavy or too verbose a language. &#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
While this is a combination that works for me, yours may be completely different.&#xD;
The important part is to have tools that feel this roles and make sure that they are&#xD;
really working with and for you and not the other way around.&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://blog.dynamicprogrammer.com/aggbug.ashx?id=f63b4424-be13-4d32-bc0b-6bc2e533da6b"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/-SvrvYsUrObUDMngfY3ZP56FSqA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/-SvrvYsUrObUDMngfY3ZP56FSqA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/-SvrvYsUrObUDMngfY3ZP56FSqA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/-SvrvYsUrObUDMngfY3ZP56FSqA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheDynamicProgrammer/~4/PUP9UZNn0zg" height="1" width="1"/&gt;</description>
      <comments>http://blog.dynamicprogrammer.com/CommentView,guid,f63b4424-be13-4d32-bc0b-6bc2e533da6b.aspx</comments>
      <category>Continuous Integration</category>
      <category>Methodology</category>
      <category>Programming</category>
      <category>Testing</category>
      <category>Tools</category>
    <feedburner:origLink>http://blog.dynamicprogrammer.com/2009/11/16/MyNewAnImprovedToolingForBuildsAndProjectManagement.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.dynamicprogrammer.com/Trackback.aspx?guid=c2bb6ace-7f84-48c7-957a-e7998a2f789b</trackback:ping>
      <pingback:server>http://blog.dynamicprogrammer.com/pingback.aspx</pingback:server>
      <pingback:target>http://blog.dynamicprogrammer.com/PermaLink,guid,c2bb6ace-7f84-48c7-957a-e7998a2f789b.aspx</pingback:target>
      <dc:creator>Hernan</dc:creator>
      <wfw:comment>http://blog.dynamicprogrammer.com/CommentView,guid,c2bb6ace-7f84-48c7-957a-e7998a2f789b.aspx</wfw:comment>
      <wfw:commentRss>http://blog.dynamicprogrammer.com/SyndicationService.asmx/GetEntryCommentsRss?guid=c2bb6ace-7f84-48c7-957a-e7998a2f789b</wfw:commentRss>
      <slash:comments>3</slash:comments>
      
      <title>Using MongoDB from C#</title>
      <guid isPermaLink="false">http://blog.dynamicprogrammer.com/PermaLink,guid,c2bb6ace-7f84-48c7-957a-e7998a2f789b.aspx</guid>
      <link>http://feedproxy.google.com/~r/TheDynamicProgrammer/~3/Q5WNF6qSCC4/UsingMongoDBFromC.aspx</link>
      <pubDate>Tue, 10 Nov 2009 05:04:54 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;&#xD;
        &lt;p&gt;&#xD;
The &lt;a href="http://en.wikipedia.org/wiki/NoSQL" target="_blank"&gt;NoSql&lt;/a&gt; movement&#xD;
is  gaining more and more inertia. A year or two ago I took a look at &lt;a href="http://couchdb.apache.org/" target="_blank"&gt;CouchDb&lt;/a&gt; but&#xD;
this time I wanted to try &lt;a href="www.mongodb.org" target="_blank"&gt;MongoDB&lt;/a&gt;. I&#xD;
have been hearing a lot of nice things about MongoDB, mostly about how simple is to&#xD;
query it and how fast is. So I decided that it was time to actually take it for a&#xD;
spin.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
A quick search point me to &lt;a href="http://odetocode.com/blogs/scott/archive/2009/10/13/experimenting-with-mongodb-from-c.aspx" target="_blank"&gt;this&#xD;
odetocode post&lt;/a&gt; that was a great starting point to have Mongo running in my dev&#xD;
machine using the defaults and the Driver for C#. So, go and read K. Scott Allen’s&#xD;
post if you want to follow along with the code in the rest of this post.&#xD;
&lt;/p&gt;&#xD;
        &lt;h5&gt;Detour (some background on NoSql and MongoDB):&#xD;
&lt;/h5&gt;&#xD;
        &lt;blockquote&gt;&#xD;
          &lt;p&gt;&#xD;
            &lt;em&gt;If you already know about this you can skip all this paragraph.&lt;/em&gt;&#xD;
          &lt;/p&gt;&#xD;
          &lt;p&gt;&#xD;
            &lt;em&gt;The so called NoSql movement is based on the notion that using RDBMS may not be&#xD;
the right choice in some cases. They propose using alternative databases, like key-value&#xD;
pair storages and document databases. To perform operations on the data some make&#xD;
use of Map-Reduce, others like MongoDB use a query mechanism that resembles Sql. One&#xD;
of the most attractive features of this db’s is the ability to easily run clusters&#xD;
and do &lt;/em&gt;&#xD;
            &lt;a href="http://www.codefutures.com/database-sharding/" target="_blank"&gt;&#xD;
              &lt;em&gt;data&#xD;
sharding&lt;/em&gt;&#xD;
            &lt;/a&gt;&#xD;
            &lt;em&gt;. Most of them support both features without a lot of fuss, or&#xD;
that I heard.&lt;/em&gt;&#xD;
          &lt;/p&gt;&#xD;
          &lt;p&gt;&#xD;
            &lt;em&gt;MongoDB is a document based db, that stores the information as Binary Json.&lt;/em&gt;&#xD;
          &lt;/p&gt;&#xD;
          &lt;p&gt;&#xD;
            &lt;em&gt;End of detour.&lt;/em&gt;&#xD;
          &lt;/p&gt;&#xD;
        &lt;/blockquote&gt;&#xD;
        &lt;h5&gt;What’s a document?&#xD;
&lt;/h5&gt;&#xD;
        &lt;p&gt;&#xD;
A document is not the equivalent to a Row. A document can be seen as a key-value pair&#xD;
collection of objects. It’s actually a complete object Graph, persisted as Json. Documents&#xD;
are organized into Collections.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
Now, to be usable in C# we need to have some mapping from the Document object to our&#xD;
object graph. We could use the Document directly but will be like going back to use&#xD;
DataTables, not very pretty.&#xD;
&lt;/p&gt;&#xD;
        &lt;pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  1: &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; movieName&#xD;
= movie["&lt;span style="color: #8b0000"&gt;Name&lt;/span&gt;"].ToString(); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  2: &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; actors&#xD;
= JsonConvert.DeserializeObject&amp;lt;Dictionary&amp;lt;&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;,string&amp;gt;&amp;gt;(movie["&lt;span style="color: #8b0000"&gt;Actors&lt;/span&gt;"].ToString());&lt;/pre&gt;&#xD;
        &lt;/pre&gt;&#xD;
        &lt;p&gt;&#xD;
The simple way to go from Json to an object should be to pass the load of a document&#xD;
to a JsonDeserializer like Json.Net and just get the object back, like this:&#xD;
&lt;/p&gt;&#xD;
        &lt;pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  1: var movie = JsonConvert.DeserializeObject&amp;lt;Movie&amp;gt;(document.ToString());&lt;/pre&gt;&#xD;
        &lt;/pre&gt;&#xD;
        &lt;p&gt;&#xD;
But while trying to do so I got an error in the id of the document. Looking at the&#xD;
paymoad of the document the Id looks like this:&#xD;
&lt;/p&gt;&#xD;
        &lt;pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  1: "&lt;span style="color: #8b0000"&gt;_id&lt;/span&gt;":&#xD;
ObjectId("&lt;span style="color: #8b0000"&gt;4eebf0006829c72c1d000000&lt;/span&gt;")&lt;/pre&gt;&#xD;
        &lt;/pre&gt;&#xD;
        &lt;p&gt;&#xD;
The problem is in the ObjectId function. But do not despair, there is an alternative.&#xD;
&lt;/p&gt;&#xD;
        &lt;h5&gt;From a document to a fully usable object graph.&#xD;
&lt;/h5&gt;&#xD;
        &lt;p&gt;&#xD;
The alternative is not pretty but works and is easy to implement. Just pass the document&#xD;
to the root of your object graph, an access the underlying collection via the objects&#xD;
properties. Let’s see how this can look like. (Note: Yes there are some hardcoded&#xD;
strings in there that should be removed. I’m also never closing the connection to&#xD;
the Db, when I probably should).&#xD;
&lt;/p&gt;&#xD;
        &lt;pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  1: using System;&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  2: using System.Collections.Generic;&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  3: using Newtonsoft.Json;&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  4: using MongoDB.Driver;&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  5: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  6: &lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Repository &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  7: {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  8:     &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; Database&#xD;
_db; &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  9: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 10:     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Database&#xD;
Db() &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 11:     {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 12:         &lt;span style="color: #0000ff"&gt;if&lt;/span&gt;(_db&#xD;
!= &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;) &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; _db; &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 13:         &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; server&#xD;
= &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Mongo(); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 14:         server.Connect();&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 15:         _db = server.getDB("&lt;span style="color: #8b0000"&gt;DynamicProgrammer&lt;/span&gt;"); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 16:         &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; _db; &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 17:     }&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 18: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 19:     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Insert(Document &lt;span style="color: #0000ff"&gt;document&lt;/span&gt;,&#xD;
string collectionName) &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 20:     {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 21:         &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; collection&#xD;
= Db().GetCollection(collectionName); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 22:         collection.Insert(&lt;span style="color: #0000ff"&gt;document&lt;/span&gt;); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 23:     }&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 24: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 25:     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; IEnumerable&amp;lt;TDocument&amp;gt;&#xD;
getListOf&amp;lt;TDocument&amp;gt;(string whereClause, string fromCollection) where TDocument&#xD;
: IMongoEntity &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 26:     {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 27:         &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; docs&#xD;
= Db().GetCollection(fromCollection) &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 28:             .Find(whereClause).Documents;     &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 29:         &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; docsToCollection&amp;lt;TDocument&amp;gt;(docs); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 30: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 31:     }&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 32: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 33:     &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; IEnumerable&amp;lt;TDocument&amp;gt;&#xD;
docsToCollection&amp;lt;TDocument&amp;gt;(IEnumerable&amp;lt;Document&amp;gt; documents) where TDocument&#xD;
: IMongoEntity &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 34:     {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 35:         &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; list&#xD;
= &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&amp;lt;TDocument&amp;gt;(); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 36:         &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; settings&#xD;
= &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; JsonSerializerSettings(); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 37: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 38:         foreach (&lt;span style="color: #0000ff"&gt;var&lt;/span&gt;&lt;span style="color: #0000ff"&gt;document&lt;/span&gt;&lt;span style="color: #0000ff"&gt;in&lt;/span&gt; documents) &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 39:         {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 40:             &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; docType&#xD;
= Activator.CreateInstance&amp;lt;TDocument&amp;gt;(); &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 41:             docType.InternalDocument = &lt;span style="color: #0000ff"&gt;document&lt;/span&gt;; &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 42:             list.Add(docType);&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 43:         }&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 44:         &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; list; &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 45:     }&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 46: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 47: }&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 48: &lt;/pre&gt;&#xD;
        &lt;/pre&gt;&#xD;
        &lt;p&gt;&#xD;
IMongoEntity is a simple interface to force our entities to expose the Doc property.&#xD;
&lt;/p&gt;&#xD;
        &lt;pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  1: &lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #0000ff"&gt;interface&lt;/span&gt; IMongoEntity &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  2: {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  3:     Document InternalDocument { get; set; }&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  4: }&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  5: &lt;/pre&gt;&#xD;
        &lt;/pre&gt;&#xD;
        &lt;p&gt;&#xD;
And our Movie Entity will look like:&#xD;
&lt;/p&gt;&#xD;
        &lt;pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  1: &lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Movie&#xD;
: IMongoEntity &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  2: {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  3:     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; string&#xD;
Name &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  4:     {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  5:         get { &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; InternalDocument["&lt;span style="color: #8b0000"&gt;Name&lt;/span&gt;"].ToString();&#xD;
} &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  6:         set { InternalDocument["&lt;span style="color: #8b0000"&gt;Name&lt;/span&gt;"]&#xD;
= value; } &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  7:     }&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  8: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  9:     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; ProductionYear &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 10:     {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 11:         get { &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;)InternalDocument["&lt;span style="color: #8b0000"&gt;Year&lt;/span&gt;"];&#xD;
} &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 12:         set { InternalDocument["&lt;span style="color: #8b0000"&gt;Year&lt;/span&gt;"]&#xD;
= value; } &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 13:     }&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 14: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 15:     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Dictionary&amp;lt;&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;,&#xD;
string&amp;gt; Actors &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 16:     {&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 17:         get { &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; JsonConvert.DeserializeObject&amp;lt;Dictionary&amp;lt;&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;,&#xD;
string&amp;gt;&amp;gt;(InternalDocument["&lt;span style="color: #8b0000"&gt;Actors&lt;/span&gt;"].ToString());&#xD;
} &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 18:         set { InternalDocument["&lt;span style="color: #8b0000"&gt;Actors&lt;/span&gt;"]&#xD;
= value; } &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 19:     }&#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 20: &#xD;
&lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 21:     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Document&#xD;
InternalDocument { get; set; } &lt;/pre&gt;&#xD;
          &lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 22: }&lt;/pre&gt;&#xD;
        &lt;/pre&gt;&#xD;
        &lt;p&gt;&#xD;
Notice I’m using JsonConverter to return a complex type, we should probably encapsulate&#xD;
that functionality in some kind of base class, maybe convert IMongoEntity into an&#xD;
abstract class that provides some basic utilities.&#xD;
&lt;/p&gt;&#xD;
        &lt;p&gt;&#xD;
I will try to dig deeper into MongoDB, seems to be really suited to a Domain first&#xD;
approach. I wasn’t able to have anything but the most simple queries working, so I&#xD;
will have to take a closer look at the syntax.&#xD;
&lt;/p&gt;&#xD;
        &lt;img width="0" height="0" src="http://blog.dynamicprogrammer.com/aggbug.ashx?id=c2bb6ace-7f84-48c7-957a-e7998a2f789b"&gt;&lt;/img&gt;&#xD;
      &lt;/body&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/gNlBlJDQP9LNtdKsTQdoPhCeV2g/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/gNlBlJDQP9LNtdKsTQdoPhCeV2g/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/gNlBlJDQP9LNtdKsTQdoPhCeV2g/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/gNlBlJDQP9LNtdKsTQdoPhCeV2g/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheDynamicProgrammer/~4/Q5WNF6qSCC4" height="1" width="1"/&gt;</description>
      <comments>http://blog.dynamicprogrammer.com/CommentView,guid,c2bb6ace-7f84-48c7-957a-e7998a2f789b.aspx</comments>
      <category>Programming</category>
      <category>Tools</category>
    <feedburner:origLink>http://blog.dynamicprogrammer.com/2009/11/10/UsingMongoDBFromC.aspx</feedburner:origLink></item>
  </channel>
</rss>
