<?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:blogChannel="http://backend.userland.com/blogChannelModule" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" version="2.0">
  <channel>
    <title>Hadi Hariri's Blog</title>
    <description />
    <link>http://www.hadihariri.com/blogengine/</link>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <generator>BlogEngine.NET 1.4.5.0</generator>
    <language>en-GB</language>
    <blogChannel:blogRoll>http://www.hadihariri.com/blogengine/opml.axd</blogChannel:blogRoll>
    <blogChannel:blink>http://www.dotnetblogengine.net/syndication.axd</blogChannel:blink>
    <dc:creator>Hadi Hariri</dc:creator>
    <dc:title>Hadi Hariri's Blog</dc:title>
    <geo:lat>0.000000</geo:lat>
    <geo:long>0.000000</geo:long>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/HadiHariri" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
      <title>It’s all about the delivery</title>
      <description>&lt;p&gt;
&lt;br /&gt;
The Dependency Inversion Principle states:
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;dl&gt;&lt;dd&gt;&lt;dl&gt;&lt;dd&gt;&lt;em&gt;A. High-level modules should not depend on low-level modules. Both should depend on abstractions.&lt;/em&gt;&lt;/dd&gt;&lt;dd&gt;&lt;em&gt;B. Abstractions should not depend upon details. Details should depend upon abstractions.&lt;/em&gt;&lt;/dd&gt;&lt;/dl&gt;&lt;/dd&gt;&lt;/dl&gt;    &lt;br /&gt;
(Source WikiPedia). 
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.codinghorror.com/blog/archives/001225.html"&gt;Throw that at a terrible programmer&lt;/a&gt;, and all you&amp;rsquo;ll get is a terrible programmer that is annoyed and hates you. So true!
&lt;/p&gt;
&lt;p&gt;
Take the following method:
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; PrintHelloMessage()
&lt;/pre&gt;
&lt;pre&gt;
        {
&lt;/pre&gt;
&lt;pre class="alt"&gt;
            Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Hello&amp;quot;&lt;/span&gt;);
&lt;/pre&gt;
&lt;pre&gt;
        }
&lt;/pre&gt;
&lt;/div&gt;
Now ask a developer to add a new method to print the message &amp;lsquo;Goodbye&amp;rsquo;. Do you think he would do:
&lt;pre class="csharpcode"&gt;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; PrintGoodbyeMessage()
{
Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Goodbye&amp;quot;&lt;/span&gt;);
}
&lt;/pre&gt;
&lt;p&gt;
&lt;br /&gt;
or:
&lt;/p&gt;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; PrintMessage(&lt;span class="kwrd"&gt;string&lt;/span&gt; message)&lt;br /&gt;
&lt;pre class="csharpcode"&gt;
{
Console.WriteLine(message);
}
&lt;/pre&gt;
Most likely, he&amp;rsquo;d do the latter. Why? Because he realizes he&amp;rsquo;s gaining a benefit by passing a parameter to a method. He knows that if tomorrow you ask him for a &amp;ldquo;Good Afternoon&amp;rdquo; message, he won&amp;rsquo;t have to write a new method. 
&lt;p&gt;
What is Dependency Injection? It&amp;rsquo;s one way of complying with the Dependency Inversion Principle. However, when you think about it, what does it boil down to? Passing a parameter to a method, which happens to be a constructor. It seems simple enough doesn&amp;rsquo;t it? Yet, it&amp;rsquo;s hard for people to understand it. Why? because they don&amp;rsquo;t see the value in it. 
&lt;/p&gt;
&lt;p&gt;
Explaining a principle to someone without them understanding the benefits and values they get out of it is useless, and that is why concepts such as Dependency Injection or Inversion of Control seem overly complex to the vast majority of developers (believe it or not, those of us that use these things are still a very big minority). It&amp;rsquo;s complex because they haven&amp;rsquo;t been explained the values of it. They&amp;rsquo;ve just been thrown some definition and they are expected to understand that it&amp;rsquo;s bad for one class to create an instance of another class it uses. 
&lt;/p&gt;
&lt;p&gt;
Present a developer with the following code:
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; AuthServices
&lt;/pre&gt;
&lt;pre&gt;
    {
&lt;/pre&gt;
&lt;pre class="alt"&gt;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; AuthUser(&lt;span class="kwrd"&gt;string&lt;/span&gt; username, &lt;span class="kwrd"&gt;string&lt;/span&gt; password)
&lt;/pre&gt;
&lt;pre&gt;
        {
&lt;/pre&gt;
&lt;pre class="alt"&gt;
            var authDAL = &lt;span class="kwrd"&gt;new&lt;/span&gt; AuthDAL();
&lt;/pre&gt;
&lt;pre&gt;
&amp;nbsp;
&lt;/pre&gt;
&lt;pre class="alt"&gt;
            var user = authDAL.GetUserByUsername(username);
&lt;/pre&gt;
&lt;pre&gt;
&amp;nbsp;
&lt;/pre&gt;
&lt;pre class="alt"&gt;
            &lt;span class="kwrd"&gt;if&lt;/span&gt; (user != &lt;span class="kwrd"&gt;null&lt;/span&gt;)
&lt;/pre&gt;
&lt;pre&gt;
            {
&lt;/pre&gt;
&lt;pre class="alt"&gt;
                &lt;span class="kwrd"&gt;if&lt;/span&gt; ...
&lt;/pre&gt;
&lt;pre&gt;
            }
&lt;/pre&gt;
&lt;pre class="alt"&gt;
&amp;nbsp;
&lt;/pre&gt;
&lt;pre&gt;
        }
&lt;/pre&gt;
&lt;pre class="alt"&gt;
    }
&lt;/pre&gt;
&lt;/div&gt;
and ask them how they&amp;rsquo;d go about testing this code without having access to a database. Ask them how they&amp;rsquo;d go about changing AuthDAL for some fake DAL that doesn&amp;rsquo;t really connect to a database. 
&lt;p&gt;
They&amp;rsquo;ll probably come up with the solution of passing the AuthDAL class in as a parameter, and eventually realizing that multiple methods will use the same class, they&amp;rsquo;ll pass it in via the constructor and set it as an instance field. As long as their AuthDAL has virtual methods, they can create any fake DAL that overrides those methods and returns some dummy value. They might argue that they don&amp;rsquo;t want virtual methods. And that&amp;rsquo;s fine. Tell them to define the parameter as an interface. In fact, they probably have already heard of a principle that says that you should program to an interface and not a class. They&amp;rsquo;ll eventually end up with this code:
&lt;/p&gt;
&lt;pre class="csharpcode"&gt;
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; AuthServices
{
IAuthDAL authDAL;
&lt;span class="kwrd"&gt;public&lt;/span&gt; AuthServices(IAuthDAL authDAL)
{
_authDAL = authDAL;
}
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; AuthUser(&lt;span class="kwrd"&gt;string&lt;/span&gt; username, &lt;span class="kwrd"&gt;string&lt;/span&gt; password)
{
var user = _authDAL.GetUserByUsername(username);
&lt;span class="kwrd"&gt;if&lt;/span&gt; (user != &lt;span class="kwrd"&gt;null&lt;/span&gt;)
{
&lt;span class="kwrd"&gt;if&lt;/span&gt; ...
}
}
}
&lt;/pre&gt;
&amp;nbsp;
&lt;p&gt;
And voila! You have Dependency Injection via Constructor. 
&lt;/p&gt;
&lt;p&gt;
Once they *get* that, then explain to them other benefits, you know the real benefits they get from doing this: decoupled code, easy maintenance, promotion of SRP, etc.&amp;nbsp; and then throw the principle in their face:
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;dl&gt;&lt;dd&gt;&lt;dl&gt;&lt;dd&gt;&lt;em&gt;A. High-level modules should not depend on low-level modules. Both should depend on abstractions.&lt;/em&gt; &lt;/dd&gt;&lt;dd&gt;&lt;em&gt;B. Abstractions should not depend upon details. Details should depend upon abstractions.&lt;/em&gt;&lt;/dd&gt;&lt;/dl&gt;&lt;/dd&gt;&lt;/dl&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
And they&amp;rsquo;ll see how it all makes sense. 
&lt;/p&gt;
&lt;p&gt;
It&amp;rsquo;s not about throwing or not throwing books. It&amp;rsquo;s about showing people how something can help them, how they get value of it. 
&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/hadihariri/rSpO/~4/x4x6IwdB2rs" height="1" width="1"/&gt;</description>
      <link>http://www.hadihariri.com/blogengine/post/2009/10/29/Ite28099s-all-about-the-delivery.aspx</link>
      <author>hadi.lists.nospam@nospam.gmail.com (Hadi)</author>
      <comments>http://www.hadihariri.com/blogengine/post/2009/10/29/Ite28099s-all-about-the-delivery.aspx#comment</comments>
      <guid>http://www.hadihariri.com/blogengine/post.aspx?id=c4753650-0b7c-4e17-9721-c6aad0f05c08</guid>
      <pubDate>Thu, 29 Oct 2009 08:31:00 -1200</pubDate>
      <dc:publisher>Hadi</dc:publisher>
      <pingback:server>http://www.hadihariri.com/blogengine/pingback.axd</pingback:server>
      <pingback:target>http://www.hadihariri.com/blogengine/post.aspx?id=c4753650-0b7c-4e17-9721-c6aad0f05c08</pingback:target>
      <slash:comments>2</slash:comments>
      <trackback:ping>http://www.hadihariri.com/blogengine/trackback.axd?id=c4753650-0b7c-4e17-9721-c6aad0f05c08</trackback:ping>
      <wfw:comment>http://www.hadihariri.com/blogengine/post/2009/10/29/Ite28099s-all-about-the-delivery.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.hadihariri.com/blogengine/syndication.axd?post=c4753650-0b7c-4e17-9721-c6aad0f05c08</wfw:commentRss>
    </item>
    <item>
      <title>Joined the tasty bites</title>
      <description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Last week I was invited to join &lt;a href="http://devlicio.us"&gt;devlcio.us&lt;/a&gt;, part of &lt;a href="http://codebetter.com"&gt;codebetter.com&lt;/a&gt; blog network. Unfortunately with all the travelling I’ve not had a chance to even do my first blog post or thank both &lt;a href="http://devlicio.us/blogs/casey/"&gt;Jak&lt;/a&gt; and Brendan for the invitation, and seeing I’m currently stuck at Franfurt Airport on a 5 hour layover, it’s a better time than any.&lt;/p&gt;  &lt;p&gt;I’ll still be blogging on my &lt;a href="http://hadihariri.com"&gt;regular&lt;/a&gt; &lt;a href="http://blogs.imeta.co.uk/hhariri"&gt;sites&lt;/a&gt;, and as always, any non-technical off-topic posts will remain exclusively on &lt;a href="http://hadihariri.com"&gt;my own site&lt;/a&gt;. &lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/hadihariri/rSpO/~4/f5_-lR1PxbU" height="1" width="1"/&gt;</description>
      <link>http://www.hadihariri.com/blogengine/post/2009/10/13/Joined-the-tasty-bites.aspx</link>
      <author>hadi.lists.nospam@nospam.gmail.com (hadi)</author>
      <comments>http://www.hadihariri.com/blogengine/post/2009/10/13/Joined-the-tasty-bites.aspx#comment</comments>
      <guid>http://www.hadihariri.com/blogengine/post.aspx?id=9e92aaa6-4c55-4e9e-b802-4736e7a382b8</guid>
      <pubDate>Tue, 13 Oct 2009 20:29:12 -1200</pubDate>
      <dc:publisher>hadi</dc:publisher>
      <pingback:server>http://www.hadihariri.com/blogengine/pingback.axd</pingback:server>
      <pingback:target>http://www.hadihariri.com/blogengine/post.aspx?id=9e92aaa6-4c55-4e9e-b802-4736e7a382b8</pingback:target>
      <slash:comments>2</slash:comments>
      <trackback:ping>http://www.hadihariri.com/blogengine/trackback.axd?id=9e92aaa6-4c55-4e9e-b802-4736e7a382b8</trackback:ping>
      <wfw:comment>http://www.hadihariri.com/blogengine/post/2009/10/13/Joined-the-tasty-bites.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.hadihariri.com/blogengine/syndication.axd?post=9e92aaa6-4c55-4e9e-b802-4736e7a382b8</wfw:commentRss>
    </item>
    <item>
      <title>List my controllers for me…</title>
      <description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Nuff said!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://hadihariri.com/blogengine/image.axd?picture=WindowsLiveWriter/IntellisenseonControllers/78A8DDAC/image.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://hadihariri.com/blogengine/image.axd?picture=WindowsLiveWriter/IntellisenseonControllers/56DD051B/image_thumb.png" width="527" height="111" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Really liking Resharper 5.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/hadihariri/rSpO/~4/LV9T-ZM0jgQ" height="1" width="1"/&gt;</description>
      <link>http://www.hadihariri.com/blogengine/post/2009/10/09/Intellisense-on-Controllers.aspx</link>
      <author>hadi.lists.nospam@nospam.gmail.com (hadi)</author>
      <comments>http://www.hadihariri.com/blogengine/post/2009/10/09/Intellisense-on-Controllers.aspx#comment</comments>
      <guid>http://www.hadihariri.com/blogengine/post.aspx?id=5cebdbd9-71dd-41d0-9358-2cc27dca2470</guid>
      <pubDate>Fri, 09 Oct 2009 21:01:18 -1200</pubDate>
      <dc:publisher>hadi</dc:publisher>
      <pingback:server>http://www.hadihariri.com/blogengine/pingback.axd</pingback:server>
      <pingback:target>http://www.hadihariri.com/blogengine/post.aspx?id=5cebdbd9-71dd-41d0-9358-2cc27dca2470</pingback:target>
      <slash:comments>3</slash:comments>
      <trackback:ping>http://www.hadihariri.com/blogengine/trackback.axd?id=5cebdbd9-71dd-41d0-9358-2cc27dca2470</trackback:ping>
      <wfw:comment>http://www.hadihariri.com/blogengine/post/2009/10/09/Intellisense-on-Controllers.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.hadihariri.com/blogengine/syndication.axd?post=5cebdbd9-71dd-41d0-9358-2cc27dca2470</wfw:commentRss>
    </item>
    <item>
      <title>Resharper 5 support for MVC</title>
      <description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Resharper 5 has a couple of new features for MVC that can make your life somewhat easier. Take a look at the following screenshot:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://hadihariri.com/blogengine/image.axd?picture=WindowsLiveWriter/Resharper5supportforMVC/0ACB9367/image.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://hadihariri.com/blogengine/image.axd?picture=WindowsLiveWriter/Resharper5supportforMVC/0E1D0542/image_thumb.png" width="582" height="136" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;That’s inside an ASPX ViewPage. The first thing is the &lt;strong&gt;“Abouta”&lt;/strong&gt; underlined in blue. The hint tells me that this action does not exist. &lt;strong&gt;“Home”&lt;/strong&gt; on the other hand, which corresponds to a controller is underlined, meaning you can navigate to it from there (ctrl+left mouse click).&lt;/p&gt;  &lt;p&gt;In the case of the action not existing, if we haven’t spelt it wrong, we can ask Resharper to create it for us:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://hadihariri.com/blogengine/image.axd?picture=WindowsLiveWriter/Resharper5supportforMVC/7CE9279E/image.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://hadihariri.com/blogengine/image.axd?picture=WindowsLiveWriter/Resharper5supportforMVC/4940BB40/image_thumb.png" width="578" height="145" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;which generates the corresponding action in the controller:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://hadihariri.com/blogengine/image.axd?picture=WindowsLiveWriter/Resharper5supportforMVC/38791092/image.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://hadihariri.com/blogengine/image.axd?picture=WindowsLiveWriter/Resharper5supportforMVC/30153B3B/image_thumb.png" width="581" height="158" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Simple, yet very productive!&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/hadihariri/rSpO/~4/lhMpS2wQr0g" height="1" width="1"/&gt;</description>
      <link>http://www.hadihariri.com/blogengine/post/2009/10/09/Resharper-5-support-for-MVC.aspx</link>
      <author>hadi.lists.nospam@nospam.gmail.com (hadi)</author>
      <comments>http://www.hadihariri.com/blogengine/post/2009/10/09/Resharper-5-support-for-MVC.aspx#comment</comments>
      <guid>http://www.hadihariri.com/blogengine/post.aspx?id=e709b97d-87f5-40c8-bc0a-6ba2544d9f8e</guid>
      <pubDate>Fri, 09 Oct 2009 10:17:44 -1200</pubDate>
      <dc:publisher>hadi</dc:publisher>
      <pingback:server>http://www.hadihariri.com/blogengine/pingback.axd</pingback:server>
      <pingback:target>http://www.hadihariri.com/blogengine/post.aspx?id=e709b97d-87f5-40c8-bc0a-6ba2544d9f8e</pingback:target>
      <slash:comments>2</slash:comments>
      <trackback:ping>http://www.hadihariri.com/blogengine/trackback.axd?id=e709b97d-87f5-40c8-bc0a-6ba2544d9f8e</trackback:ping>
      <wfw:comment>http://www.hadihariri.com/blogengine/post/2009/10/09/Resharper-5-support-for-MVC.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.hadihariri.com/blogengine/syndication.axd?post=e709b97d-87f5-40c8-bc0a-6ba2544d9f8e</wfw:commentRss>
    </item>
    <item>
      <title>The Principle of Least Surprise</title>
      <description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I’m having a discussion on the ASP.NET MVC forums with one of the guys from the ASP.NET team in regard to the Data Annotations in MVC 2 and I’m not sure I agree with him. Here’s an issue &lt;a href="http://devlicio.us/blogs/casey/"&gt;Jak&lt;/a&gt; and I have run into: &lt;/p&gt;  &lt;p&gt;In MVC 2 there’s a new Html Helper named &lt;em&gt;EditorForModel(); &lt;/em&gt;that renders out a form based on the properties of your model, along with the validation messages, labels, etc. So something like this:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;   &amp;lt;% &lt;span class="kwrd"&gt;using&lt;/span&gt; (Html.BeginForm()) {%&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &amp;lt;%=Html.EditorForModel() %&amp;gt;     &lt;/pre&gt;

  &lt;pre&gt;            &amp;lt;p&amp;gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;                &amp;lt;input type=&lt;span class="str"&gt;&amp;quot;submit&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;value&lt;/span&gt;=&lt;span class="str"&gt;&amp;quot;Save&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;            &amp;lt;/p&amp;gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &amp;lt;% } %&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;you’d get something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://hadihariri.com/blogengine/image.axd?picture=WindowsLiveWriter/ThePrincipleofLeastSurprise/1A28AE20/image.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://hadihariri.com/blogengine/image.axd?picture=WindowsLiveWriter/ThePrincipleofLeastSurprise/36E22335/image_thumb.png" width="373" height="230" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;If you want to do individual fields and thus have finer control, you can use the &lt;em&gt;EditorFor&lt;/em&gt; helper, passing in a property name. In other words, the previous could be also rendered as:&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;    &amp;lt;% &lt;span class="kwrd"&gt;using&lt;/span&gt; (Html.BeginForm()) {%&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;/pre&gt;

  &lt;pre&gt;   &amp;lt;%=Html.EditorFor( model =&amp;gt; model.FirstName) %&amp;gt; &lt;/pre&gt;

  &lt;pre class="alt"&gt;   &amp;lt;%=Html.EditorFor( model =&amp;gt; model.LastName) %&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;   &amp;lt;%=Html.EditorFor( model =&amp;gt; model.Email) %&amp;gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;/pre&gt;

  &lt;pre&gt;            &amp;lt;p&amp;gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;                &amp;lt;input type=&lt;span class="str"&gt;&amp;quot;submit&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;value&lt;/span&gt;=&lt;span class="str"&gt;&amp;quot;Save&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;

  &lt;pre&gt;            &amp;lt;/p&amp;gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &amp;lt;% } %&amp;gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/p&gt;

&lt;p&gt;but this time you don’t get the labels: &lt;/p&gt;

&lt;p&gt;&lt;a href="http://hadihariri.com/blogengine/image.axd?picture=WindowsLiveWriter/ThePrincipleofLeastSurprise/5BFF6DA1/image.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://hadihariri.com/blogengine/image.axd?picture=WindowsLiveWriter/ThePrincipleofLeastSurprise/61DA113A/image_thumb.png" width="393" height="247" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;The problem however is that you lose something else: the Validation messages. If you have client-side validation enabled, the previous ASPX file generates a pretty much useless call to the &lt;em&gt;EnableClientValidation&lt;/em&gt; JS function: &lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;EnableClientValidation({&lt;span class="str"&gt;&amp;quot;Fields&amp;quot;&lt;/span&gt;:[],&lt;span class="str"&gt;&amp;quot;FormId&amp;quot;&lt;/span&gt;:&lt;span class="str"&gt;&amp;quot;form0&amp;quot;&lt;/span&gt;}, &lt;span class="kwrd"&gt;null&lt;/span&gt;);&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;as opposed to: &lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;div class="csharpcode"&gt;
    &lt;div class="csharpcode"&gt;
      &lt;pre class="alt"&gt;EnableClientValidation({&lt;span class="str"&gt;&amp;quot;Fields&amp;quot;&lt;/span&gt;:[{&lt;span class="str"&gt;&amp;quot;FieldName&amp;quot;&lt;/span&gt;:&lt;span class="str"&gt;&amp;quot;FirstName&amp;quot;&lt;/span&gt;,&lt;span class="str"&gt;&amp;quot;ValidationRules&amp;quot;&lt;/span&gt;:[{&lt;span class="str"&gt;&amp;quot;ErrorMessage&amp;quot;&lt;/span&gt;:&lt;span class="str"&gt;&amp;quot;First name is required&amp;quot;&lt;/span&gt;,&lt;span class="str"&gt;&amp;quot;ValidationParameters&amp;quot;&lt;/span&gt;:....&lt;/pre&gt;

      &lt;pre&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre class="alt"&gt;// rest omitted &lt;span class="kwrd"&gt;for&lt;/span&gt; brevity&lt;/pre&gt;
    &lt;/div&gt;
    &lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/div&gt;
  &lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;The result of course is that client-validation doesn’t work (and from what I’ve heard causes JS errors in some browsers). &lt;/p&gt;

&lt;p&gt;The solution to this is to explicitly add a Validation Message, like so:&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&amp;lt;%=Html.ValidationMessage(&lt;span class="str"&gt;&amp;quot;FirstName&amp;quot;&lt;/span&gt;)%&amp;gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/p&gt;

&lt;p&gt;Now I understand that &lt;em&gt;EditorFor &lt;/em&gt;is for fine-tuning and there is a corresponding &lt;em&gt;LabelFor&lt;/em&gt; (although a &lt;em&gt;ValidationFor &lt;/em&gt;doesn’t exist yet), but my main concern here is that it’s breaking the principle of least surprise from an API perspective. &lt;/p&gt;

&lt;p&gt;For me, the only difference between &lt;em&gt;EditorFor&lt;/em&gt; and &lt;em&gt;EditorForModel&lt;/em&gt; should be that in the first I specify a property name explicitly whereas in the latter it just assumes the whole model. Nothing is telling me by the name of the method that the second does a whole bunch more of magic. &lt;/p&gt;

&lt;p&gt;One solution is for &lt;em&gt;EditorFor&lt;/em&gt; to be renamed to something else if it’s ONLY going to provide the input box (be it a text area, checkbox, radio group, etc..).&lt;/p&gt;

&lt;p&gt;Thoughts?&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/hadihariri/rSpO/~4/0r95Lf7gfc8" height="1" width="1"/&gt;</description>
      <link>http://www.hadihariri.com/blogengine/post/2009/10/08/The-Principle-of-Least-Surprise.aspx</link>
      <author>hadi.lists.nospam@nospam.gmail.com (hadi)</author>
      <comments>http://www.hadihariri.com/blogengine/post/2009/10/08/The-Principle-of-Least-Surprise.aspx#comment</comments>
      <guid>http://www.hadihariri.com/blogengine/post.aspx?id=d75e1497-4206-4eb2-8fe4-eea60ec811a8</guid>
      <pubDate>Thu, 08 Oct 2009 22:23:14 -1200</pubDate>
      <dc:publisher>hadi</dc:publisher>
      <pingback:server>http://www.hadihariri.com/blogengine/pingback.axd</pingback:server>
      <pingback:target>http://www.hadihariri.com/blogengine/post.aspx?id=d75e1497-4206-4eb2-8fe4-eea60ec811a8</pingback:target>
      <slash:comments>8</slash:comments>
      <trackback:ping>http://www.hadihariri.com/blogengine/trackback.axd?id=d75e1497-4206-4eb2-8fe4-eea60ec811a8</trackback:ping>
      <wfw:comment>http://www.hadihariri.com/blogengine/post/2009/10/08/The-Principle-of-Least-Surprise.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.hadihariri.com/blogengine/syndication.axd?post=d75e1497-4206-4eb2-8fe4-eea60ec811a8</wfw:commentRss>
    </item>
    <item>
      <title>Testing Model Validations?</title>
      <description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;ASP.NET MVC 2 allows you to do data validation, either using the de-facto Data Annotations or plugging in your own, much in the same way xVal work. If you’re interested in seeing how that works, take a look at &lt;a href="http://hadihariri.com/blogengine/post/2009/10/06/Client-Side-Validation-in-MVC-20.aspx"&gt;this post&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;This post however concerns testing. Here’s some code:&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;[AcceptVerbs(HttpVerbs.Post)]&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; ActionResult Create(Customer customer)&lt;/pre&gt;

  &lt;pre class="alt"&gt;{&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (ModelState.IsValid)&lt;/pre&gt;

  &lt;pre class="alt"&gt;    {&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; RedirectToAction(&lt;span class="str"&gt;&amp;quot;Index&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;    }&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; View(customer);&lt;/pre&gt;

  &lt;pre class="alt"&gt;}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/p&gt;

&lt;p&gt;This code checks to see if my model is valid. If it is, it then saves it (not in the code) and redirects to the index action, thus producing a RedirectToActionResult. If it is not valid, it will return a ViewResult. Here’s the model:&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Customer&lt;/pre&gt;

  &lt;pre&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;    [Required]&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; FirstName { get; set; }&lt;/pre&gt;

  &lt;pre class="alt"&gt;    [Required]&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; LastName { get; set; }&lt;/pre&gt;

  &lt;pre class="alt"&gt;}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/p&gt;

&lt;p&gt;Given the previous, what would you expect the following test to do? Pass or fail?&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;    [Fact]&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; wont_give_you_any_hints()&lt;/pre&gt;

  &lt;pre class="alt"&gt;    {&lt;/pre&gt;

  &lt;pre&gt;    var controller = &lt;span class="kwrd"&gt;new&lt;/span&gt; CustomerController();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;    var customer = &lt;span class="kwrd"&gt;new&lt;/span&gt; Customer();&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;    customer.FirstName = &lt;span class="str"&gt;&amp;quot;Jak a.k.a. Casey&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;    customer.LastName = String.Empty;&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;    var result = controller.Create(customer);&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;    Assert.IsType(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(ViewResult), result);&lt;/pre&gt;

  &lt;pre&gt;    }&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/p&gt;

&lt;p&gt;I’ll give you a hint. It fails. Now I understand why it fails. My problem however is that for me to test my model is valid is going to force me to change the way I have to write my code, and potentially make it less readable.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/hadihariri/rSpO/~4/q7zYEqA8ZUs" height="1" width="1"/&gt;</description>
      <link>http://www.hadihariri.com/blogengine/post/2009/10/08/Testing-Model-Validations.aspx</link>
      <author>hadi.lists.nospam@nospam.gmail.com (hadi)</author>
      <comments>http://www.hadihariri.com/blogengine/post/2009/10/08/Testing-Model-Validations.aspx#comment</comments>
      <guid>http://www.hadihariri.com/blogengine/post.aspx?id=cec37c62-a90c-4a88-ae25-d22640794d08</guid>
      <pubDate>Thu, 08 Oct 2009 21:09:56 -1200</pubDate>
      <dc:publisher>hadi</dc:publisher>
      <pingback:server>http://www.hadihariri.com/blogengine/pingback.axd</pingback:server>
      <pingback:target>http://www.hadihariri.com/blogengine/post.aspx?id=cec37c62-a90c-4a88-ae25-d22640794d08</pingback:target>
      <slash:comments>2</slash:comments>
      <trackback:ping>http://www.hadihariri.com/blogengine/trackback.axd?id=cec37c62-a90c-4a88-ae25-d22640794d08</trackback:ping>
      <wfw:comment>http://www.hadihariri.com/blogengine/post/2009/10/08/Testing-Model-Validations.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.hadihariri.com/blogengine/syndication.axd?post=cec37c62-a90c-4a88-ae25-d22640794d08</wfw:commentRss>
    </item>
    <item>
      <title>Problem with Client-Side Validation in MVC 2</title>
      <description>&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;[Note: This post applies to ASP.NET MVC 2, Preview 2.0]&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Today while doing the demo for the &lt;a href="http://www.hadihariri.com/blogengine/post/2009/10/06/Client-Side-Validation-in-MVC-20.aspx"&gt;previous post&lt;/a&gt;, I ran into an issue where the Javascript code for the client-side validation (the call to &lt;em&gt;EnableClientValidation &lt;/em&gt;) was not being output during the form rendering. 
&lt;/p&gt;
&lt;p&gt;
Take a look at the following two snippets:
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;First:&lt;/strong&gt;
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;
    &amp;lt;% Html.BeginForm();%&amp;gt;
&lt;/pre&gt;
&lt;pre&gt;
&amp;nbsp;
&lt;/pre&gt;
&lt;pre class="alt"&gt;
        &amp;lt;%=Html.EditorForModel() %&amp;gt;     
&lt;/pre&gt;
&lt;pre&gt;
            &amp;lt;p&amp;gt;
&lt;/pre&gt;
&lt;pre class="alt"&gt;
                &amp;lt;input type=&lt;span class="str"&gt;&amp;quot;submit&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;value&lt;/span&gt;=&lt;span class="str"&gt;&amp;quot;Save&amp;quot;&lt;/span&gt; /&amp;gt;
&lt;/pre&gt;
&lt;pre&gt;
            &amp;lt;/p&amp;gt;
&lt;/pre&gt;
&lt;pre class="alt"&gt;
    &amp;lt;% Html.EndForm(); %&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Second:&lt;/strong&gt;
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;
  &amp;lt;% &lt;span class="kwrd"&gt;using&lt;/span&gt; (Html.BeginForm()) {%&amp;gt;
&lt;/pre&gt;
&lt;pre&gt;
&amp;nbsp;
&lt;/pre&gt;
&lt;pre class="alt"&gt;
        &amp;lt;%=Html.EditorForModel() %&amp;gt;     
&lt;/pre&gt;
&lt;pre&gt;
            &amp;lt;p&amp;gt;
&lt;/pre&gt;
&lt;pre class="alt"&gt;
                &amp;lt;input type=&lt;span class="str"&gt;&amp;quot;submit&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;value&lt;/span&gt;=&lt;span class="str"&gt;&amp;quot;Save&amp;quot;&lt;/span&gt; /&amp;gt;
&lt;/pre&gt;
&lt;pre&gt;
            &amp;lt;/p&amp;gt;
&lt;/pre&gt;
&lt;pre class="alt"&gt;
    &amp;lt;% } %&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
See the difference? The latter is using the &lt;em&gt;using &lt;/em&gt;statement. In my previous post I&amp;rsquo;m using this option and all works well. However, if you go with the first option, the Javascript call will not be output. The reason for this (after debugging the source) is that the call to make this happen takes place in the &lt;em&gt;Dispose &lt;/em&gt;method of the &lt;em&gt;MvcForm&lt;/em&gt;. Explicitly calling &lt;em&gt;Html.EndForm&lt;/em&gt; won&amp;rsquo;t cause this to take place. 
&lt;/p&gt;
&lt;p&gt;
I&amp;rsquo;ve talked to Mathew from the QA team, and &lt;a href="http://twitter.com/osbornm/status/4689501425"&gt;he&amp;rsquo;s confirmed it&amp;rsquo;s a known issue&lt;/a&gt;. I think the output of the JS code should ideally be decoupled from the form construction. For instance, If I were to use a manual form tag, this wouldn&amp;rsquo;t work either [I&amp;rsquo;ve haven&amp;rsquo;t given it that much thought either].
&lt;/p&gt;
&lt;p&gt;
In the meantime, if you want client-side validation, make sure you use the second option.
&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/hadihariri/rSpO/~4/LPrkScbqblM" height="1" width="1"/&gt;</description>
      <link>http://www.hadihariri.com/blogengine/post/2009/10/07/Problem-with-Client-Side-Validation-in-MVC-20.aspx</link>
      <author>hadi.lists.nospam@nospam.gmail.com (Hadi)</author>
      <comments>http://www.hadihariri.com/blogengine/post/2009/10/07/Problem-with-Client-Side-Validation-in-MVC-20.aspx#comment</comments>
      <guid>http://www.hadihariri.com/blogengine/post.aspx?id=769083c5-0ef5-48a7-a963-07227883c727</guid>
      <pubDate>Wed, 07 Oct 2009 07:31:00 -1200</pubDate>
      <dc:publisher>Hadi</dc:publisher>
      <pingback:server>http://www.hadihariri.com/blogengine/pingback.axd</pingback:server>
      <pingback:target>http://www.hadihariri.com/blogengine/post.aspx?id=769083c5-0ef5-48a7-a963-07227883c727</pingback:target>
      <slash:comments>5</slash:comments>
      <trackback:ping>http://www.hadihariri.com/blogengine/trackback.axd?id=769083c5-0ef5-48a7-a963-07227883c727</trackback:ping>
      <wfw:comment>http://www.hadihariri.com/blogengine/post/2009/10/07/Problem-with-Client-Side-Validation-in-MVC-20.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.hadihariri.com/blogengine/syndication.axd?post=769083c5-0ef5-48a7-a963-07227883c727</wfw:commentRss>
    </item>
    <item>
      <title>Client-Side Validation in MVC 2</title>
      <description>&lt;p&gt;
&amp;nbsp; 
&lt;/p&gt;
  
&lt;p&gt;
ASP.NET MVC 2 Preview 2 now ships with client-side validation built into the box. It follows the same idea as the &lt;a href="http://www.codeplex.com/xval"&gt;xVal&lt;/a&gt; framework whereby you can define validation rules once and have them enforced both on the server and the client. 
&lt;/p&gt;
  
&lt;p&gt;
By default, MVC uses Data Annotations which is available in System.ComponentModel.DataAnnotations on the server and the jQuery Validator plugin on the client. Much like xVal you can customize these to use whatever you want. I&amp;rsquo;m preparing some demos for next week of how to do client-side validation and since there isn&amp;rsquo;t much info on it, I&amp;rsquo;ve decided to post it. 
&lt;/p&gt;
  
&lt;h3&gt;Server-Side Validation&lt;/h3&gt;  
&lt;p&gt;
Server-side validation with Data Annotations works without having to take any additional steps. You decorate your model using attributes and the model binder uses this information to set the ModelState. 
&lt;/p&gt;
  
&lt;div class="csharpcode"&gt;
   
&lt;pre class="alt"&gt;
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Customer
&lt;/pre&gt;
&lt;pre&gt;
    {
&lt;/pre&gt;
&lt;pre class="alt"&gt;
        [Required(ErrorMessage = &lt;span class="str"&gt;&amp;quot;First name is required&amp;quot;&lt;/span&gt;)]
&lt;/pre&gt;
&lt;pre&gt;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; FirstName { get; set; }
&lt;/pre&gt;
&lt;pre class="alt"&gt;
        [Required(ErrorMessage = &lt;span class="str"&gt;&amp;quot;Last name is required&amp;quot;&lt;/span&gt;)]
&lt;/pre&gt;
&lt;pre&gt;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; LastName { get; set; }
&lt;/pre&gt;
&lt;pre&gt;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Email { get; set; }
&lt;/pre&gt;
&lt;pre class="alt"&gt;
    }
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
On the server-side you would do the usual to check if the model state is valid and if not display validation messages back to the client: 
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;
        [AcceptVerbs(HttpVerbs.Post)]
&lt;/pre&gt;
&lt;pre&gt;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; ActionResult Edit(&lt;span class="kwrd"&gt;int&lt;/span&gt; id, Customer customer)
&lt;/pre&gt;
&lt;pre class="alt"&gt;
        {
&lt;/pre&gt;
&lt;pre&gt;
            &lt;span class="kwrd"&gt;if&lt;/span&gt; (ModelState.IsValid)
&lt;/pre&gt;
&lt;pre class="alt"&gt;
            {
&lt;/pre&gt;
&lt;pre&gt;
                &lt;span class="rem"&gt;// TODO: Do whatever...&lt;/span&gt;
&lt;/pre&gt;
&lt;pre class="alt"&gt;
                &lt;span class="kwrd"&gt;return&lt;/span&gt; RedirectToAction(&lt;span class="str"&gt;&amp;quot;Index&amp;quot;&lt;/span&gt;);
&lt;/pre&gt;
&lt;pre&gt;
            }
&lt;/pre&gt;
&lt;pre class="alt"&gt;
            &lt;span class="kwrd"&gt;return&lt;/span&gt; View(customer);
&lt;/pre&gt;
&lt;pre&gt;
        }
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
The form is: 
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;
    &amp;lt;%= Html.ValidationSummary() %&amp;gt;
&lt;/pre&gt;
&lt;pre&gt;
    &amp;lt;% &lt;span class="kwrd"&gt;using&lt;/span&gt; (Html.BeginForm()) {%&amp;gt;
&lt;/pre&gt;
&lt;pre class="alt"&gt;
&amp;nbsp; 
&lt;/pre&gt;
&lt;pre&gt;
        &amp;lt;%=Html.EditorForModel() %&amp;gt;     
&lt;/pre&gt;
&lt;pre class="alt"&gt;
            &amp;lt;p&amp;gt;
&lt;/pre&gt;
&lt;pre&gt;
                &amp;lt;input type=&lt;span class="str"&gt;&amp;quot;submit&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;value&lt;/span&gt;=&lt;span class="str"&gt;&amp;quot;Save&amp;quot;&lt;/span&gt; /&amp;gt;
&lt;/pre&gt;
&lt;pre class="alt"&gt;
            &amp;lt;/p&amp;gt;
&lt;/pre&gt;
&lt;pre&gt;
    &amp;lt;% } %&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;pre&gt;
&amp;nbsp;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
(I&amp;rsquo;m using the EditForModel which will automatically generate an input field for each property of the model. If you want finer control you can spit out individual fields or use templates). 
&lt;/p&gt;
&lt;h3&gt;Client-Side Validation&lt;/h3&gt;
&lt;p&gt;
Client-Side validation kicks in only if it is explicitly activated in the view. To do this, you need to call EnableClientValidation as shown below: 
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre&gt;
&amp;nbsp; 
&lt;/pre&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;
    &amp;lt;% Html.EnableClientValidation(); %&amp;gt;
&lt;/pre&gt;
&lt;pre&gt;
    &amp;lt;%= Html.ValidationSummary() %&amp;gt;
&lt;/pre&gt;
&lt;pre class="alt"&gt;
    &amp;lt;% &lt;span class="kwrd"&gt;using&lt;/span&gt; (Html.BeginForm()) {%&amp;gt;
&lt;/pre&gt;
&lt;pre&gt;
&amp;nbsp; 
&lt;/pre&gt;
&lt;pre class="alt"&gt;
        &amp;lt;%=Html.EditorForModel() %&amp;gt;     
&lt;/pre&gt;
&lt;pre&gt;
            &amp;lt;p&amp;gt;
&lt;/pre&gt;
&lt;pre class="alt"&gt;
                &amp;lt;input type=&lt;span class="str"&gt;&amp;quot;submit&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;value&lt;/span&gt;=&lt;span class="str"&gt;&amp;quot;Save&amp;quot;&lt;/span&gt; /&amp;gt;
&lt;/pre&gt;
&lt;pre&gt;
            &amp;lt;/p&amp;gt;
&lt;/pre&gt;
&lt;pre class="alt"&gt;
    &amp;lt;% } %&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
By doing this, when the form is generated, the MVC framework will add a call to JS function &lt;em&gt;EnableClientValidation &lt;/em&gt;passing in the correct parameters based on the data annotation attributes defined on the model. Last but not least, we need to include 3 Javascript files in the View (I normally put them in Site.Master). 
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;
    &amp;lt;script src=&lt;span class="str"&gt;&amp;quot;../../Scripts/jquery-1.3.2.min.js&amp;quot;&lt;/span&gt; type=&lt;span class="str"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;
&lt;/pre&gt;
&lt;pre&gt;
    &amp;lt;script src=&lt;span class="str"&gt;&amp;quot;../../Scripts/jquery.validate.min.js&amp;quot;&lt;/span&gt; type=&lt;span class="str"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;
&lt;/pre&gt;
&lt;pre class="alt"&gt;
    &amp;lt;script src=&lt;span class="str"&gt;&amp;quot;../../Scripts/MicrosoftMvcJQueryValidation.js&amp;quot;&lt;/span&gt; type=&lt;span class="str"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Make sure you include the last file, where &lt;em&gt;EnableClientValidation &lt;/em&gt;is defined. That&amp;rsquo;s all there is to it. Once you run this, your app will have both client side and server side validation using the default Data Annotations and jQuery Validator. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.hadihariri.com/Downloads/Validation.zip"&gt;Download demo from here&lt;/a&gt;
&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/hadihariri/rSpO/~4/UOooi99Mgbk" height="1" width="1"/&gt;</description>
      <link>http://www.hadihariri.com/blogengine/post/2009/10/06/Client-Side-Validation-in-MVC-20.aspx</link>
      <author>hadi.lists.nospam@nospam.gmail.com (Hadi)</author>
      <comments>http://www.hadihariri.com/blogengine/post/2009/10/06/Client-Side-Validation-in-MVC-20.aspx#comment</comments>
      <guid>http://www.hadihariri.com/blogengine/post.aspx?id=d7b4f8f4-28fd-4dcb-b451-74e97a410542</guid>
      <pubDate>Tue, 06 Oct 2009 18:31:00 -1200</pubDate>
      <dc:publisher>Hadi</dc:publisher>
      <pingback:server>http://www.hadihariri.com/blogengine/pingback.axd</pingback:server>
      <pingback:target>http://www.hadihariri.com/blogengine/post.aspx?id=d7b4f8f4-28fd-4dcb-b451-74e97a410542</pingback:target>
      <slash:comments>6</slash:comments>
      <trackback:ping>http://www.hadihariri.com/blogengine/trackback.axd?id=d7b4f8f4-28fd-4dcb-b451-74e97a410542</trackback:ping>
      <wfw:comment>http://www.hadihariri.com/blogengine/post/2009/10/06/Client-Side-Validation-in-MVC-20.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.hadihariri.com/blogengine/syndication.axd?post=d7b4f8f4-28fd-4dcb-b451-74e97a410542</wfw:commentRss>
    </item>
    <item>
      <title>Avoiding an unintentional bottleneck</title>
      <description>&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
  
&lt;p&gt;
We&amp;rsquo;re all busy these days and sometimes it&amp;rsquo;s really hard to get any work done with continuous interruptions. As developers we know that it&amp;rsquo;s hard to get into the mindset that allows us to concentrate on designing a certain class or fixing that retched bug, and any minor incident can throw us way off and place us back at the starting line. 
&lt;/p&gt;
  
&lt;p&gt;
Now I&amp;rsquo;m sure that it&amp;rsquo;s not only developers that have this problem. Any type of work the requires concentration probably has the same issues. It just so happens that most of my life has been spent developing software and I speak from experience. Getting interrupted while working on code is a pain! 
&lt;/p&gt;
  
&lt;p&gt;
&lt;strong&gt;Avoiding Interruptions&lt;/strong&gt;
&lt;/p&gt;
  
&lt;p&gt;
Interruptions can come in the form of emails, telephone calls, instant messaging and recently the more popular Twittering, which I&amp;rsquo;m finding is substantially limiting my ability to both read or write more than 140 characters. In fact, I&amp;rsquo;ve written this post via a Windows Live Writer plug-in that injects 140 chars at a time.&lt;a href="http://www.google.com/#hl=en&amp;amp;source=hp&amp;amp;q=I+can%27t+believe+you+bought+into+that&amp;amp;aq=f&amp;amp;aqi=&amp;amp;oq=&amp;amp;fp=7d15299a959dbb33"&gt;&lt;/a&gt;
&lt;/p&gt;
  
&lt;p&gt;
There are several ways to cope with this problem. For example when using Outlook, you can suspend the Send/Receive for certain periods of time, or just do what I do and shutdown the damn thing, as much the same with Twitter, Skype, etc. I assign myself periods of a minimum of one hour where I just code, and not deal with email, messages or Twitter. I then take a 5-15 minute break, check all correspondence and go back what I was doing. I find it helps me be much more productive. Other people use techniques such as the &lt;a href="http://www.pomodorotechnique.com/"&gt;Pomodoro&lt;/a&gt; or Pair Programming, which personally I find very productive on many levels, but in terms of interruptions. While sitting with someone, it feels kind of wrong to be chatting on Skype or replying to emails while making your coding partner wait. As such, you tend to not do it so often, and avoid potentially embarrassing situations
&lt;/p&gt;
  
&lt;p&gt;
&lt;a href="http://www.hadihariri.com/blogengine/image.axd?picture=WindowsLiveWriter/Avoidinganunintentionalbottleneck/3D5FD00D/image.png"&gt;&lt;img style="border-width: 0px; display: inline" src="http://www.hadihariri.com/blogengine/image.axd?picture=WindowsLiveWriter/Avoidinganunintentionalbottleneck/2DDCBE3E/image_thumb.png" border="0" alt="image" title="image" width="338" height="225" /&gt;&lt;/a&gt; 
&lt;/p&gt;
  
&lt;p&gt;
&lt;strong&gt;Avoid causing bottlenecks for others&lt;/strong&gt;
&lt;/p&gt;
  
&lt;p&gt;
Increasing productivity is one of the major benefits of avoiding disruptions. Like anything however, there&amp;rsquo;s always two sides to every story. 
&lt;/p&gt;
  
&lt;p&gt;
Whether working on a team or solo, you tend to interact with people, be it a team member, someone else in your company, customers or 3rd parties you deal with. These interactions are mostly based on emails, IMS&amp;rsquo;s or phone calls, you know. the same things that disrupt our productivity. Now it&amp;rsquo;s great for you to be able to control them to increase your throughput, but you need to also bear in mind that what you&amp;rsquo;re doing is potentially holding up someone else&amp;rsquo;s productivity. 
&lt;/p&gt;
  
&lt;p&gt;
If someone sends you an email to ask for information about a certain project, or how something should be done or who to contact for a particular thing, these issues might not be effecting your job directly, but most likely it is interrupting theirs. 
&lt;/p&gt;
  
&lt;p&gt;
That is why it&amp;rsquo;s important to remember that when responding to someone, especially with emails where there is an inherent delay, to always take into account how important the reply is for them, more than for yourself. Does it hold them up? Is it a potential issue? 
&lt;/p&gt;
  
&lt;p&gt;
Obviously sometimes a response requires a little more work, but it&amp;rsquo;s also very important to communicate this to the originator. Tell them that you need 2 hours to get back to them and you can&amp;rsquo;t fit it in for another 2 days. The important thing is to not leave people hanging. 
&lt;/p&gt;
  
&lt;p&gt;
Remember, what&amp;rsquo;s not important for you, might be critical for others. Sometimes I miss the Urgent flag in Gmail. It&amp;rsquo;s utterly useless for SMTP servers, but it does communicate intent to the receiver of the mail (albeit abused by many). 
&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/hadihariri/rSpO/~4/c5bio_GJsSI" height="1" width="1"/&gt;</description>
      <link>http://www.hadihariri.com/blogengine/post/2009/10/04/Avoiding-an-unintentional-bottleneck.aspx</link>
      <author>hadi.lists.nospam@nospam.gmail.com (Hadi)</author>
      <comments>http://www.hadihariri.com/blogengine/post/2009/10/04/Avoiding-an-unintentional-bottleneck.aspx#comment</comments>
      <guid>http://www.hadihariri.com/blogengine/post.aspx?id=38b3196e-0647-413f-b01a-462be137f848</guid>
      <pubDate>Sun, 04 Oct 2009 23:10:00 -1200</pubDate>
      <dc:publisher>Hadi</dc:publisher>
      <pingback:server>http://www.hadihariri.com/blogengine/pingback.axd</pingback:server>
      <pingback:target>http://www.hadihariri.com/blogengine/post.aspx?id=38b3196e-0647-413f-b01a-462be137f848</pingback:target>
      <slash:comments>6</slash:comments>
      <trackback:ping>http://www.hadihariri.com/blogengine/trackback.axd?id=38b3196e-0647-413f-b01a-462be137f848</trackback:ping>
      <wfw:comment>http://www.hadihariri.com/blogengine/post/2009/10/04/Avoiding-an-unintentional-bottleneck.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.hadihariri.com/blogengine/syndication.axd?post=38b3196e-0647-413f-b01a-462be137f848</wfw:commentRss>
    </item>
    <item>
      <title>Upcoming talks</title>
      <description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Start of the “conference season” again and I’ll be doing a tour of a few countries and places. Hope to meet up with some of you at some place and time. This time I’ll try and have all sessions ready so I can spend my time more productively at the bar/restaurant&lt;/p&gt;  &lt;p&gt;- 21st to 25th September at &lt;a href="http://www.basta.net"&gt;BASTA&lt;/a&gt;! in Germany. Talks on ASP.NET MVC, jQuery, TDD, Design Principles.&lt;/p&gt;  &lt;p&gt;- 27th to 30th September at &lt;a href="http://entwicklerkonferenz.de"&gt;Entwickler Konferenz&lt;/a&gt; in Germany. Talks on ASP.NET MVC, TDD.&lt;/p&gt;  &lt;p&gt;- 12th to 13th October at &lt;a href="http://www.devreach.com"&gt;DevReach&lt;/a&gt; in Bulgaria. Talks on ASP.NET MVC, Design Principles.&lt;/p&gt;  &lt;p&gt;- 16th to 17th October at TTT/&lt;a href="http://www.codecamp.es"&gt;CodeCamp&lt;/a&gt; in Tarragona. Talks on MEF and Design Principles.&lt;/p&gt;  &lt;p&gt;- 18th to 21st October at &lt;a href="http://www.sdc.nl"&gt;SDC&lt;/a&gt; in The Netherlands. Talks on ASP.NET MVC.&lt;/p&gt;  &lt;p&gt;- 29th October at Micrsoft in Madrid. Workshop on Design Principles (Link available soon)&lt;/p&gt;  &lt;p&gt;I’ve also pre-recorded 3 sessions for an online virtual conference on ASP.NET MVC, jQuery and Mocks, all in Delphi Prism and it’s happening right now on &lt;a href="http://conferences.embarcadero.com/coderage"&gt;CodeRage&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;-&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/hadihariri/rSpO/~4/9mTQOyO9eCA" height="1" width="1"/&gt;</description>
      <link>http://www.hadihariri.com/blogengine/post/2009/09/09/Upcoming-talks.aspx</link>
      <author>hadi.lists.nospam@nospam.gmail.com (hadi)</author>
      <comments>http://www.hadihariri.com/blogengine/post/2009/09/09/Upcoming-talks.aspx#comment</comments>
      <guid>http://www.hadihariri.com/blogengine/post.aspx?id=4d0601b4-7f80-4e05-b520-3e70935870b8</guid>
      <pubDate>Wed, 09 Sep 2009 00:15:38 -1200</pubDate>
      <dc:publisher>hadi</dc:publisher>
      <pingback:server>http://www.hadihariri.com/blogengine/pingback.axd</pingback:server>
      <pingback:target>http://www.hadihariri.com/blogengine/post.aspx?id=4d0601b4-7f80-4e05-b520-3e70935870b8</pingback:target>
      <slash:comments>2</slash:comments>
      <trackback:ping>http://www.hadihariri.com/blogengine/trackback.axd?id=4d0601b4-7f80-4e05-b520-3e70935870b8</trackback:ping>
      <wfw:comment>http://www.hadihariri.com/blogengine/post/2009/09/09/Upcoming-talks.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.hadihariri.com/blogengine/syndication.axd?post=4d0601b4-7f80-4e05-b520-3e70935870b8</wfw:commentRss>
    </item>
  </channel>
</rss>
