<?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:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" version="2.0"><channel><title>Matt Hinze @ FWDNUG</title><link>http://fwdnug.com/blogs/mhinze/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/hinzefwdnug" type="application/rss+xml" /><item><title>Practical Inversion of Control at FWDNUG Tuesday April 21st</title><link>http://fwdnug.com/blogs/mhinze/archive/2009/04/14/practical-inversion-of-control-at-fwdnug-tuesday-april-21st.aspx</link><pubDate>Tue, 14 Apr 2009 10:15:00 GMT</pubDate><guid isPermaLink="false">ca52fad6-10e1-4aa3-a299-eaeca884f53d:1073</guid><dc:creator>mhinze</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://fwdnug.com/blogs/mhinze/rsscomments.aspx?PostID=1073</wfw:commentRss><comments>http://fwdnug.com/blogs/mhinze/archive/2009/04/14/practical-inversion-of-control-at-fwdnug-tuesday-april-21st.aspx#comments</comments><description>&lt;p&gt;Come hang out at the FWDNUG meeting and talk with me about software architecture, object oriented programming and inversion of control on Tuesday April 21st (that&amp;#39;s a week from now).&amp;nbsp; &lt;/p&gt;&lt;p&gt;We&amp;#39;ll cover the basics of IOC, but for the most part, this will be an advanced presentation.. lots of code highlighting a few interesting usage scenarios.&amp;nbsp; &lt;/p&gt;&lt;p&gt;Hope you can make it! &lt;br /&gt;&lt;/p&gt;&lt;img src="http://fwdnug.com/aggbug.aspx?PostID=1073" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/hinzefwdnug/~4/jRmvPITaywg" height="1" width="1"/&gt;</description><category domain="http://fwdnug.com/blogs/mhinze/archive/tags/FWDNUG/default.aspx">FWDNUG</category></item><item><title>April FWDNUG meeting</title><link>http://fwdnug.com/blogs/mhinze/archive/2008/04/15/april-fwdnug-meeting.aspx</link><pubDate>Tue, 15 Apr 2008 09:44:00 GMT</pubDate><guid isPermaLink="false">ca52fad6-10e1-4aa3-a299-eaeca884f53d:209</guid><dc:creator>mhinze</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://fwdnug.com/blogs/mhinze/rsscomments.aspx?PostID=209</wfw:commentRss><comments>http://fwdnug.com/blogs/mhinze/archive/2008/04/15/april-fwdnug-meeting.aspx#comments</comments><description>&lt;p&gt;Just got this in email: &lt;/p&gt;&lt;blockquote&gt;Our April meeting will not be held on our regular 3rd Tuesday of the
month. It will most likely be on the 4th Tuesday - April 22nd. We are
awaiting confirmation that our regular meeting location will be
available to us on the 22nd. We&amp;#39;ll send out the details as soon as they
are finalized.&lt;/blockquote&gt;
&lt;p&gt;Thought you&amp;#39;d want to see it if you didn&amp;#39;t get it.&lt;/p&gt;&lt;img src="http://fwdnug.com/aggbug.aspx?PostID=209" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/hinzefwdnug/~4/ZBOVJneahVI" height="1" width="1"/&gt;</description><category domain="http://fwdnug.com/blogs/mhinze/archive/tags/FWDNUG/default.aspx">FWDNUG</category></item><item><title>Heard of this ALT.NET thing?</title><link>http://fwdnug.com/blogs/mhinze/archive/2008/03/14/heard-of-this-alt-net-thing.aspx</link><pubDate>Fri, 14 Mar 2008 18:14:00 GMT</pubDate><guid isPermaLink="false">ca52fad6-10e1-4aa3-a299-eaeca884f53d:165</guid><dc:creator>mhinze</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://fwdnug.com/blogs/mhinze/rsscomments.aspx?PostID=165</wfw:commentRss><comments>http://fwdnug.com/blogs/mhinze/archive/2008/03/14/heard-of-this-alt-net-thing.aspx#comments</comments><description>&lt;p&gt;I think the ALT.NET brand is recognizable but awareness is lacking a bit.&amp;nbsp; &lt;/p&gt;&lt;p&gt;If you&amp;#39;ve been wondering what exactly is going on, take a look at &lt;a href="http://msdn2.microsoft.com/en-us/magazine/cc337902.aspx"&gt;this short piece in the latest MSDN Magazine&lt;/a&gt; by &lt;a href="http://codebetter.com/blogs/jeremy.miller/"&gt;Jeremy D. Miller&lt;/a&gt;. And then head to &lt;a href="http://altnetpedia.com/"&gt;the wiki&lt;/a&gt; for more.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I was in Austin in October and I&amp;#39;ll be in &lt;a href="http://altdotnet.org/events/seattle"&gt;Seattle&lt;/a&gt; in April...&lt;/p&gt;&lt;p&gt;[update] &lt;a href="http://www.hanselman.com/blog/HanselminutesPodcast104DaveLaribeeOnALTNET.aspx"&gt;Hanselminutes podcast on ALT.NET with David Laribee&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://fwdnug.com/aggbug.aspx?PostID=165" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/hinzefwdnug/~4/BD5v423bNKc" height="1" width="1"/&gt;</description><category domain="http://fwdnug.com/blogs/mhinze/archive/tags/ALT.NET/default.aspx">ALT.NET</category></item><item><title>In-House Dev Anti-pattern: Environmental Certainty</title><link>http://fwdnug.com/blogs/mhinze/archive/2008/02/12/in-house-dev-anti-pattern-environmental-certainty.aspx</link><pubDate>Tue, 12 Feb 2008 13:44:00 GMT</pubDate><guid isPermaLink="false">ca52fad6-10e1-4aa3-a299-eaeca884f53d:101</guid><dc:creator>mhinze</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://fwdnug.com/blogs/mhinze/rsscomments.aspx?PostID=101</wfw:commentRss><comments>http://fwdnug.com/blogs/mhinze/archive/2008/02/12/in-house-dev-anti-pattern-environmental-certainty.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://fwdnug.com/blogs/mhinze/archive/2008/01/18/in-house-developers.aspx"&gt;In-house developers&lt;/a&gt; (software developers that work for an IT department and not a software development firm) openly condemn their plight of being tasked to design software quickly rather than correctly. &lt;/p&gt;
&lt;p&gt;In-house developers rely on &lt;a href="http://scruffylookingcatherder.com/archive/2007/12/13/dependency-injection-house-call.aspx"&gt;environmental certainty&lt;/a&gt;. We have a comfortable technical environment.&amp;nbsp; We have our data sources, our common web services, a &lt;a href="http://en.wikipedia.org/wiki/PeopleSoft_HRMS"&gt;monolith HR system&lt;/a&gt;, and these things &lt;i&gt;never change&lt;/i&gt;.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;Right?&amp;nbsp; Never?&amp;nbsp; ...&lt;/p&gt;
&lt;p&gt;Mergers, acquisitions, vendor changes, new technologies, staff changes, user requests, management fiat, budgetary constraints... &lt;/p&gt;
&lt;p&gt;To overly rely on your environment is an anti-pattern for corporate developers.&lt;/p&gt;
&lt;p&gt;My company was acquired in November by a huge mammoth company that isn&amp;#39;t asking questions about why our data sources are useful. Our technical environment is about to radically change.&lt;/p&gt;
&lt;p&gt;Fortunately it&amp;#39;s not hard to reduce dependencies on certain external services in our applications.&amp;nbsp; Here is a real-world five-minute example with a scenario should be familiar to most in-house devs.&lt;/p&gt;
&lt;h3&gt;Interfaces define the implementation&lt;/h3&gt;
&lt;p&gt;There&amp;#39;s a web application.&amp;nbsp; In it we like to do things with the currently logged in user.&amp;nbsp; Show data specific to that user, display the user&amp;#39;s real name, etc.&amp;nbsp; We call a web service to get the full name from the login name. I&amp;#39;d wager that almost every moderate-sized company has a &amp;quot;directory&amp;quot; web service like this.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span&gt;GetFullNameService&lt;br /&gt;&lt;/span&gt;{&lt;br /&gt;    &lt;span style="color:blue;"&gt;public string &lt;/span&gt;GetFullName(&lt;span style="color:blue;"&gt;string &lt;/span&gt;username)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color:blue;"&gt;string &lt;/span&gt;fullname;&lt;br /&gt;        &lt;span style="color:green;"&gt;// call your web service and get the full name&lt;br /&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;return &lt;/span&gt;fullname;&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Great, wonderful, okay.&amp;nbsp; But to prepare for an eventual change in environment, we should write an interface so that we can switch out the implementation using &lt;a href="http://fwdnug.com/blogs/mhinze/archive/2008/01/16/dependency-injection-links.aspx"&gt;dependency injection&lt;/a&gt;.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;public interface &lt;/span&gt;&lt;span&gt;IGetFullNameService&lt;br /&gt;&lt;/span&gt;{&lt;br /&gt;    &lt;span style="color:blue;"&gt;string &lt;/span&gt;GetFullName(&lt;span style="color:blue;"&gt;string &lt;/span&gt;username);&lt;br /&gt;}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;This is useful because my new implementation (the one that will work after the acquisition is complete) is totally different, in fact instead of a web service it uses ADO.NET against OHR.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span&gt;OHRFullNameService &lt;/span&gt;: &lt;span&gt;IGetFullNameService&lt;br /&gt;&lt;/span&gt;{&lt;br /&gt;    &lt;span style="color:blue;"&gt;public string &lt;/span&gt;GetFullName(&lt;span style="color:blue;"&gt;string &lt;/span&gt;username)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color:green;"&gt;// use ADO.NET to call OHR&lt;br /&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;return &lt;/span&gt;&lt;span&gt;&amp;quot;full name&amp;quot;&lt;/span&gt;;&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Since I am programming against an interface and have written a new implementation I can just do a find and replace and change all the &lt;b&gt;GetFullNameService&lt;/b&gt; calls to call &lt;b&gt;OHRFullNameService&lt;/b&gt;, rebuild, redeploy and ... um, no. &lt;/p&gt;
&lt;h3&gt;Using dependency injection to swap out implementations&lt;/h3&gt;
&lt;p&gt;So now we have an interface and two implementations. In the application, we might see something like&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span&gt;BasePage &lt;/span&gt;: &lt;span&gt;Page&lt;br /&gt;&lt;/span&gt;{&lt;br /&gt;    &lt;span style="color:blue;"&gt;private &lt;/span&gt;&lt;span&gt;IGetFullNameService &lt;/span&gt;_nameService;&lt;br /&gt;&lt;br /&gt;    &lt;span style="color:blue;"&gt;public &lt;/span&gt;BasePage()&lt;br /&gt;    {&lt;br /&gt;        _nameService = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span&gt;GetFullNameService&lt;/span&gt;();&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Instead of newing up a concrete type we can use dependency injection to create the instance for us:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span&gt;BasePage &lt;/span&gt;: &lt;span&gt;Page&lt;br /&gt;&lt;/span&gt;{&lt;br /&gt;    &lt;span style="color:blue;"&gt;private &lt;/span&gt;&lt;span&gt;IGetFullNameService &lt;/span&gt;_nameService;&lt;br /&gt;&lt;br /&gt;    &lt;span style="color:blue;"&gt;public &lt;/span&gt;BasePage()&lt;br /&gt;    {&lt;br /&gt;        _nameService = (&lt;span&gt;IGetFullNameService&lt;/span&gt;) &lt;br /&gt;            &lt;span&gt;ObjectFactory&lt;/span&gt;.GetInstance(&lt;span style="color:blue;"&gt;typeof &lt;/span&gt;(&lt;span&gt;IGetFullNameService&lt;/span&gt;));&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Now our &lt;b&gt;BasePage&lt;/b&gt; class doesn&amp;#39;t care which implementation of &lt;b&gt;IGetFullNameService&lt;/b&gt; we use!&lt;/p&gt;
&lt;p&gt;Configuring the dependency injection container (&lt;a href="http://structuremap.sourceforge.net/Default.htm"&gt;StructureMap&lt;/a&gt;, in this example) is super easy.&amp;nbsp; You can set this up to use &lt;a href="http://structuremap.sourceforge.net/Attributes.htm"&gt;attributes&lt;/a&gt; instead of a &lt;a href="http://structuremap.sourceforge.net/Configuration.htm"&gt;configuration file&lt;/a&gt;.&amp;nbsp; But here is a simple, sample StructureMap.config:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;&amp;lt;?&lt;/span&gt;&lt;span&gt;xml &lt;/span&gt;&lt;span style="color:red;"&gt;version&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;1.0&lt;/span&gt;&amp;quot; &lt;span style="color:red;"&gt;encoding&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;utf-8&lt;/span&gt;&amp;quot; &lt;span style="color:blue;"&gt;?&amp;gt;&lt;br /&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;StructureMap&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;br /&gt;  &amp;lt;&lt;/span&gt;&lt;span&gt;PluginFamily &lt;br /&gt;    &lt;/span&gt;&lt;span style="color:red;"&gt;Type&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;MyProject.Web.Services.IGetFullNameService&lt;/span&gt;&amp;quot; &lt;br /&gt;    &lt;span style="color:red;"&gt;Assembly&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;MyProject.Web&lt;/span&gt;&amp;quot; &lt;br /&gt;    &lt;span style="color:red;"&gt;DefaultKey&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;Default&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&amp;gt;&lt;br /&gt;      &amp;lt;&lt;/span&gt;&lt;span&gt;Plugin &lt;/span&gt;&lt;span style="color:red;"&gt;Assembly&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;MyProject.Web&lt;/span&gt;&amp;quot; &lt;br /&gt;              &lt;span style="color:red;"&gt;Type&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;MyProject.Web.Services.GetFullNameService&lt;/span&gt;&amp;quot; &lt;br /&gt;              &lt;span style="color:red;"&gt;ConcreteKey&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;Default&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;/&amp;gt;&lt;br /&gt;      &amp;lt;&lt;/span&gt;&lt;span&gt;Plugin &lt;/span&gt;&lt;span style="color:red;"&gt;Assembly&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;MyProject.Web&lt;/span&gt;&amp;quot; &lt;br /&gt;              &lt;span style="color:red;"&gt;Type&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;MyProject.Web.Services.OHRFullNameService&lt;/span&gt;&amp;quot; &lt;br /&gt;              &lt;span style="color:red;"&gt;ConcreteKey&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;OHR&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;/&amp;gt;&lt;br /&gt;  &amp;lt;/&lt;/span&gt;&lt;span&gt;PluginFamily&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;br /&gt;&amp;lt;/&lt;/span&gt;&lt;span&gt;StructureMap&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Changing the implementation fro &lt;b&gt;GetFullNameService&lt;/b&gt; to &lt;b&gt;OHRFullNameService&lt;/b&gt; is as easy as changing the &lt;b&gt;DefaultKey&lt;/b&gt; attribute of the &lt;b&gt;PluginFamily&lt;/b&gt; element to &amp;quot;OHR&amp;quot;.&lt;/p&gt;
&lt;p&gt;So we&amp;#39;ve successfully eliminated our dependency on one aspect of our technical environment and we are secure knowing that if our environment changes, we can handle it easily.&lt;/p&gt;
&lt;p&gt;So this is just the start down a deep rabbit hole.&amp;nbsp; There are a few more considerations if you are developing an application using dependency injection that I have omitted from this post.&amp;nbsp; Fortunately there are resources out there.. a good starting place is &lt;a href="http://codebetter.com/blogs/jeremy.miller/archive/tags/StructureMap/default.aspx"&gt;Jeremy Miller&amp;#39;s blog&lt;/a&gt; and my &lt;a href="http://fwdnug.com/blogs/mhinze/archive/2008/01/16/dependency-injection-links.aspx"&gt;links to DI resources&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://fwdnug.com/aggbug.aspx?PostID=101" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/hinzefwdnug/~4/48BeMsdTaGQ" height="1" width="1"/&gt;</description><category domain="http://fwdnug.com/blogs/mhinze/archive/tags/dependency+injection/default.aspx">dependency injection</category><category domain="http://fwdnug.com/blogs/mhinze/archive/tags/In-house+developer/default.aspx">In-house developer</category></item><item><title>Evangelizing NHibernate</title><link>http://fwdnug.com/blogs/mhinze/archive/2008/01/26/evangelizing-nhibernate.aspx</link><pubDate>Sat, 26 Jan 2008 21:03:00 GMT</pubDate><guid isPermaLink="false">ca52fad6-10e1-4aa3-a299-eaeca884f53d:74</guid><dc:creator>mhinze</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://fwdnug.com/blogs/mhinze/rsscomments.aspx?PostID=74</wfw:commentRss><comments>http://fwdnug.com/blogs/mhinze/archive/2008/01/26/evangelizing-nhibernate.aspx#comments</comments><description>&lt;p&gt;I saw a &lt;a href="http://www.theserverside.net/discussions/thread.tss?thread_id=48235" rel="nofollow"&gt;post&lt;/a&gt; today about ORMs and how they are hard to use and maintain.&amp;nbsp; Since we saw ActiveRecord/NHibernate at &lt;a href="http://www.flux88.com/CategoryView,category,NHibernate.aspx"&gt;Ben&lt;/a&gt;&amp;#39;s talk and we&amp;#39;re going to have more talks on ORM tools there may be questions.&amp;nbsp; I wanted to share my experience and assuage some fears about ORMs that may be holding you up from getting started.. &lt;/p&gt; &lt;p&gt;I&amp;#39;m using &lt;a href="http://www.nhibernate.org"&gt;NHibernate&lt;/a&gt;, which does have a &lt;a href="http://fwdnug.com/blogs/mhinze/archive/2008/01/21/smart-enough-to-be-dumb.aspx"&gt;learning curve&lt;/a&gt;, but it&amp;#39;s not as steep as you might think. &lt;/p&gt; &lt;p&gt;Here are one of the criticisms mentioned: &lt;/p&gt; &lt;blockquote&gt;They are not legacy system friendly meaning they are a nightmare to implement&lt;/blockquote&gt; &lt;p&gt;My current project is pulling data from an Oracle 9i database with a schema and data that has been around for 10+ years. I created a few new tables for my stuff and getting set up and relating to the old stuff was painless.&lt;/p&gt; &lt;p&gt;The most unmaintainable thing about the system is all the business rules encapsulated in stored procedures. Fortunately once I got the gist of those rules, which are also enforced in constraints, they were a snap to implement in code. &lt;/p&gt; &lt;h3&gt;Real nightmares&lt;/h3&gt; &lt;p&gt;What &lt;b&gt;is&lt;/b&gt; a nightmare is the previous app that used this data.&amp;nbsp; I found this method of the Account class used to persist new instances in that old, legacy app:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;Public Function &lt;/span&gt;Save() &lt;span style="color:blue;"&gt;As &lt;/span&gt;Int32&lt;br /&gt;    &lt;span style="color:blue;"&gt;Dim &lt;/span&gt;MyDataAccess &lt;span style="color:blue;"&gt;As New &lt;/span&gt;Legacy.BLL.DataAccess&lt;br /&gt;    &lt;span style="color:blue;"&gt;Dim &lt;/span&gt;MyCommand &lt;span style="color:blue;"&gt;As New &lt;/span&gt;OleDbCommand&lt;br /&gt;    &lt;span style="color:blue;"&gt;Dim &lt;/span&gt;sb &lt;span style="color:blue;"&gt;As New &lt;/span&gt;StringBuilder&lt;br /&gt;    sb.Append(&amp;quot;LEGACY_ACCT_PKG.SAVE_ACCOUNT&amp;quot;)&lt;br /&gt;    MyCommand.CommandText = sb.ToString&lt;br /&gt;&lt;br /&gt;    MyCommand.Parameters.Add(&lt;span style="color:blue;"&gt;New &lt;/span&gt;OleDbParameter(&amp;quot;pACCOUNTID&amp;quot;, OleDbType.Numeric, 22, ParameterDirection.Input)).Value = _ID&lt;br /&gt;    &lt;span style="color:green;"&gt;&amp;#39; ... 20+ more parameters!!!  horror!&lt;br /&gt;    &lt;/span&gt;MyDataAccess.isSetGlobalContext = &lt;span style="color:blue;"&gt;True&lt;br /&gt;    &lt;/span&gt;MyDataAccess.RunSP(&amp;quot;&amp;quot;, MyCommand)&lt;br /&gt;&lt;span style="color:blue;"&gt;End Function&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;This is one of hundreds of similar &lt;a href="http://en.wikipedia.org/wiki/Create,_read,_update_and_delete" rel="nofollow"&gt;CRUD&lt;/a&gt; methods in this app.&amp;nbsp; Not &lt;a href="http://www.ayende.com/Blog/archive/2007/08/10/The-only-metric-that-counts-Maintainability.aspx"&gt;maintainable&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t have a save method in my class, I am using &lt;a href="http://geekswithblogs.net/gyoung/archive/2006/04/28/76647.aspx"&gt;repositories&lt;/a&gt;.. the actual &amp;quot;data access&amp;quot; code, common to all the objects I persist is: &lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;public virtual &lt;/span&gt;T Save(T entity)&lt;br /&gt;{&lt;br /&gt;    NHibernateSession.Save(entity);&lt;br /&gt;    &lt;span style="color:blue;"&gt;return &lt;/span&gt;entity;&lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt;To me that was very easy.&amp;nbsp; NHibernate handles things for me, I don&amp;#39;t have to worry about 20 or 30 of the things that a user of that one old-fashioned method has to worry about. Including all that horrible ADO.NET mess.&lt;/p&gt;
&lt;h3&gt;Query languages considered harmful?&lt;/h3&gt;
&lt;p&gt;Here&amp;#39;s another criticism: &lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;They require an Intermediary Query Language which means extra work for the programmer&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Eh... ok, extra work to &lt;b&gt;&lt;a href="http://weblogs.asp.net/ryanw/archive/2004/10/13/241882.aspx"&gt;learn&lt;/a&gt;&lt;/b&gt; a query language. Getting the gist of NHibernate&amp;#39;s query language takes about 5 minutes.&amp;nbsp; If you want to explore its intricacies, take an hour to parse the &lt;a href="http://www.hibernate.org/hib_docs/nhibernate/html/queryhql.html"&gt;relevant docs&lt;/a&gt;.&amp;nbsp;&amp;nbsp;&amp;nbsp; But writing it is pretty easy!&amp;nbsp; Here&amp;#39;s a simple but typical example of a query to pull back all Projects that a certain Employee is a TeamMember of (think of it as populating a grid on a &amp;quot;My Projects&amp;quot; page):&lt;/p&gt;&lt;pre class="code"&gt;&lt;span&gt;from Project p join fetch p.Team t where t.Employee = ?&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;which generates SQL something like: &lt;/p&gt;&lt;pre class="code"&gt;select * from project &lt;br /&gt;inner join team on project.id = team.projectid &lt;br /&gt;where team.emplid = :p&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Still, there&amp;#39;s no requirement that you learn HQL. There are other ways to query: using the &lt;a href="http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/querycriteria.html"&gt;Criteria&lt;/a&gt; API, &lt;a href="http://www.hibernate.org/hib_docs/nhibernate/html/querysql.html"&gt;straight SQL&lt;/a&gt; and in code.&amp;nbsp; &lt;a href="http://tech.groups.yahoo.com/group/cli_dev/message/9297"&gt;It&amp;#39;s okay to decide to avoid pain&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Pain relief&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;If religion is opium for the masses then object relational mapping would be like Aspirin in the programming world . Not powerful enough to get any programmer high and makes programming easier for about four hours, then real sedation is required to mask the pain. They have even been likened to an unwinnable war in South-East Asia. &lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;This has not been my experience.&amp;nbsp; What causes me pain is having to deal with the data access myself, or to have queries in my code-behind or worse, in the markup.&amp;nbsp; It&amp;#39;s painful to worry about columns and constraints instead of conceptual relationships and meaning.&lt;/p&gt;
&lt;p&gt;Here are some NHibernate resources I found to be really helpful:&lt;/p&gt;
&lt;p&gt;Critical to read &lt;a href="http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html_single/"&gt;the documentation&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.codeproject.com/KB/architecture/NHibernateBestPractices.aspx"&gt;Billy McCafferty&amp;#39;s NHibernate Best Practices&lt;/a&gt; (I read it four times and it keeps getting better)&lt;br /&gt;&lt;a href="http://www.flux88.com/NHibernateScreencastPersistingTheAddressBook.aspx"&gt;Ben Scheirman&amp;#39;s NHibernate screencast&lt;/a&gt; (very good tips in here)&lt;br /&gt;Setting up &lt;a href="http://www.jameskovacs.com/blog/EnablingIntellisenseForNHibernate.aspx"&gt;NHibernate mapping intellisense&lt;/a&gt;&lt;br /&gt;Example application: &lt;a href="http://www.cuyahoga-project.org/"&gt;Cuyahoga CMS&lt;/a&gt; &lt;a href="http://cuyahoga.svn.sourceforge.net/viewvc/cuyahoga/"&gt;source&lt;/a&gt;&lt;br /&gt;Example application: &lt;a href="http://codecampserver.org/"&gt;CodeCampServer&lt;/a&gt;&lt;/p&gt;&lt;img src="http://fwdnug.com/aggbug.aspx?PostID=74" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/hinzefwdnug/~4/KQVrmxDsEIU" height="1" width="1"/&gt;</description><category domain="http://fwdnug.com/blogs/mhinze/archive/tags/nhibernate/default.aspx">nhibernate</category></item><item><title>Smart enough to be dumb</title><link>http://fwdnug.com/blogs/mhinze/archive/2008/01/21/smart-enough-to-be-dumb.aspx</link><pubDate>Mon, 21 Jan 2008 22:43:00 GMT</pubDate><guid isPermaLink="false">ca52fad6-10e1-4aa3-a299-eaeca884f53d:40</guid><dc:creator>mhinze</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://fwdnug.com/blogs/mhinze/rsscomments.aspx?PostID=40</wfw:commentRss><comments>http://fwdnug.com/blogs/mhinze/archive/2008/01/21/smart-enough-to-be-dumb.aspx#comments</comments><description>&lt;p&gt;Jon Galloway &lt;a href="http://weblogs.asp.net/jgalloway/archive/2008/01/20/the-man-who-knew-too-much.aspx"&gt;touched on it in his blog post today&lt;/a&gt;:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;The best way to learn is to &amp;quot;&lt;a href="http://www.tompeters.com/cool_friends/content.php?note=008264.php"&gt;aspire to be the dumbest person in the room&lt;/a&gt;.&amp;quot;
Being the smartest person in the room is comfortable - you can feel
smug and important as you deign to dole out information. It&amp;#39;s also the
surest way to avoid learning anything. Surrounding yourself with people
who are better informed than you are is a great way to keep learning,
but it can take away your confidence in what you&amp;#39;ve got to say.&lt;/p&gt; &lt;p&gt;Wrong solutions:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;Keep quiet for fear of saying something stupid  &lt;/li&gt;&lt;li&gt;Keep quiet because all those other brilliant people will probably say it soon, and better&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Solution:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;Don&amp;#39;t write for your own ego, write to share information  &lt;/li&gt;&lt;li&gt;Accept
that publishing anything on the internet is one of the best ways to
invite constructive criticism for what you think you know&lt;/li&gt;&lt;/ul&gt;&lt;/blockquote&gt;
&lt;p&gt;Ah, to &lt;a href="http://www.twainquotes.com/Critics.html"&gt;invite criticism&lt;/a&gt;! To publicly lay intellectually prone with your fleshy bellyful of ideas exposed to the &lt;a href="http://en.wikipedia.org/wiki/Godwin%27s_law"&gt;anonymous internet&lt;/a&gt; is an &lt;b&gt;incredibly scary&lt;/b&gt; thing.&lt;/p&gt;&lt;p&gt;It takes a good deal of confidence to participate online.&lt;/p&gt;&lt;p&gt;On the old altnetconf list, &lt;a href="http://icoder.wordpress.com/"&gt;Alex McMahon&lt;/a&gt; &lt;a href="http://tech.groups.yahoo.com/group/cli_dev/message/8034"&gt;explains&lt;/a&gt;:&amp;nbsp; He ranks participation online by confidence required &lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Casual chat with close colleagues&lt;/li&gt;&lt;li&gt;Meeting/workshop with close colleagues&lt;/li&gt;&lt;li&gt;Meeting/workshop with unknowns&lt;/li&gt;&lt;li&gt;Writing on internal blog
&lt;/li&gt;&lt;li&gt;Writing on internal blog and actually telling people about it and referring them to it&lt;/li&gt;&lt;li&gt;Writing on internal wiki&lt;/li&gt;&lt;li&gt;Releasing a &amp;#39;proper&amp;#39; guidance document internally&lt;/li&gt;&lt;li&gt;(4-7 on the internet)
&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;So join a mailing list list, hang out on Twitter, write the blog and participate in the community.&amp;nbsp; Another way to pitch in is to contribute to open source software.&amp;nbsp; I&amp;#39;ve been working on &lt;a href="http://codecampserver.org/"&gt;codecampserver&lt;/a&gt;, and even though sometimes I feel I am &amp;quot;the dumbest person in the room&amp;quot; the learning experiences, contacts I&amp;#39;ve made and pure coding thrills have been invaluable. &lt;/p&gt;&lt;img src="http://fwdnug.com/aggbug.aspx?PostID=40" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/hinzefwdnug/~4/5Yp4uFnZ_Ik" height="1" width="1"/&gt;</description><category domain="http://fwdnug.com/blogs/mhinze/archive/tags/community/default.aspx">community</category></item><item><title>In house developers</title><link>http://fwdnug.com/blogs/mhinze/archive/2008/01/18/in-house-developers.aspx</link><pubDate>Fri, 18 Jan 2008 18:14:00 GMT</pubDate><guid isPermaLink="false">ca52fad6-10e1-4aa3-a299-eaeca884f53d:34</guid><dc:creator>mhinze</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://fwdnug.com/blogs/mhinze/rsscomments.aspx?PostID=34</wfw:commentRss><comments>http://fwdnug.com/blogs/mhinze/archive/2008/01/18/in-house-developers.aspx#comments</comments><description>&lt;p&gt;My friend is a software developer, but he doesn&amp;#39;t work for a software company. He works for a home builder, or a pipe manufacturer, or a retailer.&amp;nbsp; His job is to deliver software, but delivering software isn&amp;#39;t the organization&amp;#39;s core competency.&lt;/p&gt;&lt;p&gt;This friend of mine is an &lt;a href="http://www.joelonsoftware.com/items/2007/12/04.html"&gt;in house developer&lt;/a&gt; haunted by this reality:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;You never get to do things the right way. You always have to do things the expedient way ... Once the core functionality is there, the main problem is solved, there
is absolutely no return-on-investment, no business reason to make the
software any better. So all of these in house programs look like a
dog’s breakfast: because it’s just not worth a penny to make them look
nice. Forget any pride in workmanship or craftsmanship you learned in CS323.
You’re going to churn out embarrassing junk, and then, you’re going to
rush off to patch up last year’s embarrassing junk which is starting to
break down because it wasn’t done right in the first place.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;On the other hand, a &lt;a href="http://scruffylookingcatherder.com/archive/2007/12/13/dependency-injection-house-call.aspx"&gt;comfortable technical environment&lt;/a&gt; means he can focus more on building great software for his users and less on the complexities and headache of struggling through technical challenges.&lt;/p&gt;&lt;p&gt;Are you an in house developer?&amp;nbsp; What &lt;a href="http://en.wikipedia.org/wiki/Anti-pattern"&gt;anti-patterns&lt;/a&gt; do in house developers uniquely face?  &lt;/p&gt;&lt;img src="http://fwdnug.com/aggbug.aspx?PostID=34" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/hinzefwdnug/~4/sNvfjfogcQc" height="1" width="1"/&gt;</description><category domain="http://fwdnug.com/blogs/mhinze/archive/tags/In-house+developer/default.aspx">In-house developer</category></item></channel></rss>
