<?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"?><!--Generated by Squarespace Site Server v5.5.4 (http://www.squarespace.com/) on Fri, 17 Jul 2009 14:12:45 GMT--><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Rinat Abdullin</title><link>http://abdullin.com/journal/</link><description>Studying efficient software development</description><copyright /><language>en-US</language><generator>Squarespace Site Server v5.5.4 (http://www.squarespace.com/)</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/RinatAbdullin" type="application/rss+xml" /><feedburner:emailServiceId>RinatAbdullin</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item><title>Lokad Shared Libraries 1.5 and Autofac for Silverlight 3.0</title><category>Lokad</category><category>autofac</category><dc:creator>Rinat Abdullin</dc:creator><pubDate>Fri, 17 Jul 2009 13:16:58 +0000</pubDate><link>http://feedproxy.google.com/~r/RinatAbdullin/~3/axMoDTKbzrw/lokad-shared-libraries-15-and-autofac-for-silverlight-30.html</link><guid isPermaLink="false">287483:2929700:4660114</guid><description>&lt;p&gt;Just a few announcements.&lt;/p&gt;

&lt;h1&gt;Lokad Shared Libraries 1.5 Release&lt;/h1&gt;

&lt;p&gt;&lt;br /&gt;
&lt;span class="full-image-block ssNonEditable"&gt;&lt;span&gt;&lt;img src="http://abdullin.com/storage/uploads/2009/07/favicon-64.png" alt="Lokad Shared Libraries"/&gt;&lt;/span&gt;&lt;/span&gt;
There have not been any major changes since the last official release. Some highlights include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Various tweaks and fixes coming from projects actively using Lokad Shared in production&lt;/li&gt;
&lt;li&gt;MockContainer implementation to simplify testing in &lt;a href="http://abdullin.com/wiki/component-driven-development.html"&gt;component-driven development&lt;/a&gt; scenarios such as MVC (described &lt;a href="http://abdullin.com/journal/2009/4/11/testing-mvc-controllers-with-mock-container.html"&gt;here&lt;/a&gt; and &lt;a href="http://abdullin.com/journal/2009/6/25/testing-mvc-elements-and-interactions-with-mock-container.html"&gt;here&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;WaitFor construct for executing fragile code with timeout options.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="http://code.google.com/p/lokad-shared-libraries/downloads/list" target="_blank" class="offsite-link-inline"&gt;Download options&lt;/a&gt; include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Merged libraries&lt;/strong&gt; as they are used in projects of &lt;a href="http://www.lokad.com/" target="_blank" class="offsite-link-inline"&gt;Lokad.com&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Separate assemblies for people that want to use only some bits.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;Autofac 1.4 for Silverlight 3.0&lt;/h1&gt;

&lt;p&gt;&lt;br /&gt;
&lt;span class="full-image-block ssNonEditable"&gt;&lt;span&gt;&lt;img src="http://abdullin.com/storage/uploads/2009/07/autofac-logo.png" alt="Autofac IoC COntainer for .NET"/&gt;&lt;/span&gt;&lt;/span&gt;
&lt;a href="http://abdullin.com/autofac/"&gt;Autofac IoC Container for .NET&lt;/a&gt; is now checked for compatibility with Silverlight 3.0 in a &lt;a href="http://abdullin.com/wiki/continuous-integration.html"&gt;continuous integration&lt;/a&gt; manner. Version 1.4 compiled for Silverlight 3.0 runtime is available within the &lt;a href="http://code.google.com/p/autofac/downloads/list" target="_blank" class="offsite-link-inline"&gt;download page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;People interested in checking out how the same code-base could be used to target various .NET runtime versions are welcome to check out the latest source code for the container.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=axMoDTKbzrw:p7NsWni8ZRQ:nQ_hWtDbxek"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?d=nQ_hWtDbxek" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=axMoDTKbzrw:p7NsWni8ZRQ:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=axMoDTKbzrw:p7NsWni8ZRQ:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=axMoDTKbzrw:p7NsWni8ZRQ:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=axMoDTKbzrw:p7NsWni8ZRQ:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=axMoDTKbzrw:p7NsWni8ZRQ:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=axMoDTKbzrw:p7NsWni8ZRQ:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=axMoDTKbzrw:p7NsWni8ZRQ:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RinatAbdullin/~4/axMoDTKbzrw" height="1" width="1"/&gt;</description><wfw:commentRss>http://abdullin.com/journal/rss-comments-entry-4660114.xml</wfw:commentRss><feedburner:origLink>http://abdullin.com/journal/2009/7/17/lokad-shared-libraries-15-and-autofac-for-silverlight-30.html</feedburner:origLink></item><item><title>Deployment and Updates of Desktop Applications: WiX, ClickOnce and Other Scenarios</title><category>Articles</category><category>Integration</category><category>TechOverview</category><category>Theory</category><category>management</category><category>xLim</category><dc:creator>Rinat Abdullin</dc:creator><pubDate>Wed, 08 Jul 2009 11:28:22 +0000</pubDate><link>http://feedproxy.google.com/~r/RinatAbdullin/~3/07RhsGZ3qtQ/deployment-and-updates-of-desktop-applications-wix-clickonce.html</link><guid isPermaLink="false">287483:2929700:4559011</guid><description>&lt;p&gt;As we all know, web applications became quite popular these days. One of the reasons is that they generally do not need any installations in order to be used. Upgrading them is simple, too. When you got new version to roll-out – just update web server and everything below. Users will get new UI automatically. At most you might want to ask them about refreshing their cache. &lt;/p&gt;

&lt;p&gt;This simplified deployment routine adds the benefit of reduced development friction, allowing developers to have shorter development cycles in an &lt;a href="http://abdullin.com/wiki/agile-software-development.html"&gt;agile&lt;/a&gt; manner. This eventually allows having better feedback loops leading to better products (ceteris paribus).&lt;/p&gt;

&lt;p&gt;Desktop applications do not have such flexibility and simplicity. Almost always a development team has to deal with the packaging, deployment and updates in a manual or semi-automated way. This increases development friction.&lt;/p&gt;

&lt;p&gt;Let’s take a look at some deployment scenarios in small and medium development projects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scenario 1.&lt;/strong&gt; Project deliverables are produced by running the build, then manually putting its output into a zip file and sending it to the customer. That’s the simplest option one could get. The approach fits scenarios where some non-critical tool with a short life-cycle (i.e.: under a month) is being developed.&lt;/p&gt;

&lt;p&gt;This scenario has a hidden cost of high development friction and also high probability of a human error. Although this sounds like something non-important (what could be more complex than zipping a few files, right?), this consistently slows down development and eventually leads to some reputation-hurting mess-up.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scenario 2.&lt;/strong&gt; Project deliverables are produced by starting some special build on a &lt;a href="http://abdullin.com/wiki/continuous-integration.html"&gt;continuous integration&lt;/a&gt; server. After running a common integration routine, it grabs build outputs, applies certain configuration settings, packages into a nice zip and copies to a well-known distribution location. Usually that’s a product/version folder on a web server (it optionally could be protected by some authentication and exposed to the Internet). &lt;/p&gt;

&lt;p&gt;Optionally the build might update common &lt;em&gt;download.html&lt;/em&gt; file pointing to the download locations. This way the cost of releasing the product (on developers’ side) is about two mouse clicks and sending notification to customers. Customers still have to download, unzip and update manually.&lt;/p&gt;

&lt;p&gt;This scenario works well in situations where the project deliverables are consumed by tech people. For example, &lt;a href="http://abdullin.com/shared-libraries/"&gt;Lokad Shared libraries&lt;/a&gt; are distributed this way. You can check out the &lt;a href="http://code.google.com/p/lokad-shared-libraries/source/browse/trunk/Lokad.Shared.build" target="_blank" class="offsite-link-inline"&gt;build script for that&lt;/a&gt;, if interested.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scenario 3.&lt;/strong&gt; This scenario is a slight variation of the previous one and targets non-geeky customers. To make customer experience friendlier we might produce installable package instead of the raw zip archives (deployment process stays similar). So customers will simply have to download the installer and walk through some wizard in order to get the thing running. Additionally, the actual desktop application might have simple update framework capable of checking for the latest deployed version and helping user to download and install it as needed.&lt;/p&gt;

&lt;p&gt;Let’s see how this could be implemented in .NET world. There actually are at least two major options.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option 3.1.&lt;/strong&gt; First option would work well for simple deployment scenarios. It is called &lt;a href="http://msdn.microsoft.com/en-us/library/t71a733d.aspx" target="_blank" class="offsite-link-inline"&gt;ClickOnce&lt;/a&gt;. Basically, this is a Microsoft technology providing simple deploy and update experience. It is tightly integrated into .NET and Visual Studio and hides some complex decisions from the developer.&lt;/p&gt;

&lt;p&gt;Advantage of this technology is its simplicity and ability to get started in minutes. Disadvantage is the same one – simplicity and inability to handle more complex scenarios. This makes this technology suitable and efficient only within a specific set of scenarios.&lt;/p&gt;

&lt;p&gt;Here’s how the deployment process might work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Integration server, in addition to the usual routine, runs &lt;em&gt;ClickOnce&lt;/em&gt; publishing tasks exposed by .NET SDK. &lt;/li&gt;
&lt;li&gt;These tasks produce deployment files that could be exposed to the outside world via the web server. &lt;/li&gt;
&lt;li&gt;End-user only knows about some html URL that allows him to either run executable bootstrapper or launch the actual &lt;em&gt;ClickOnce&lt;/em&gt; application. Bootstrapper is a Win32 application capable of automatic download and deployment of all the required prerequisites (i.e.: .NET Client Profile). &lt;/li&gt;
&lt;li&gt;User clicks &lt;em&gt;Next&lt;/em&gt; a few times, looks at some progress bars (giving him a sense of accomplishment) and then is presented with actual running application.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Another nice feature of &lt;em&gt;ClickOnce&lt;/em&gt; is about the way it handles updates. You can configure application deployment in such a manner that at every launch will check deployment server for the new updates (automatically downloading and installing them if needed). Or this could happen once in a week or so.&lt;/p&gt;

&lt;p&gt;This simplifies the actual deployment process. If you have customer with an issue and a deployment server, then issue fixing is just a matter of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Writing unit test.&lt;/li&gt;
&lt;li&gt;Fixing the issue.&lt;/li&gt;
&lt;li&gt;Committing it to &lt;a href="http://abdullin.com/wiki/version-control-system-vcs.html"&gt;version control repsitory&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Telling Integration server to perform the deployment after the build.&lt;/li&gt;
&lt;li&gt;Asking customer to restart the application. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Auto-magic will take care of the rest.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option 3.2.&lt;/strong&gt; Sometimes &lt;em&gt;ClickOnce&lt;/em&gt; is too limiting for the project deployment purposes. Some limitations might show up when you need to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;share components, folders and files between multiple products;&lt;/li&gt;
&lt;li&gt;configure application to start up with Windows or perform some other complex tasks;&lt;/li&gt;
&lt;li&gt;deploy installations with multiple optional features or do anything that requires user’s input;&lt;/li&gt;
&lt;li&gt;handling upgrades gracefully;&lt;/li&gt;
&lt;li&gt;deploy applications to a large number of machines at once.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In order to handle these tasks we need to give up on the simplicity of &lt;em&gt;ClickOnce&lt;/em&gt; and switch to something more powerful. My favorite option at the moment is &lt;a href="http://wix.sourceforge.net/" target="_blank" class="offsite-link-inline"&gt;Windows Installer XML 3.0&lt;/a&gt; by Microsoft (or WiX, for short). &lt;/p&gt;

&lt;p&gt;WiX allows creating MSI files by writing some XML-related code, and provides some tools and even Visual Studio integration to make developer’s life easier. Yet, the technology still has a decent learning barrier. Other disadvantages are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Programming in XML (even writing complex configurations) is inefficient and error prone by default.&lt;/li&gt;
&lt;li&gt;You can’t unit test your installation (ICE evaluators can offer some help but they &lt;a href="http://stackoverflow.com/questions/1064580/wix-3-0-throws-error-217-while-being-executed-by-continuous-integration" target="_blank" class="offsite-link-inline"&gt;fail to run on the integration server sometimes&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Yet at the moment that’s my favorite technology for handling complex scenarios that &lt;em&gt;ClickOnce&lt;/em&gt; can’t handle.&lt;/p&gt;

&lt;p&gt;If you are interested in some samples, I invite you to have a look at some projects by &lt;a href="http://www.lokad.com" target="_blank" class="offsite-link-inline"&gt;Lokad&lt;/a&gt;. Seeing WiX in action is as simple as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Make sure that WiX 3.0 is installed on your machine&lt;/li&gt;
&lt;li&gt;Checkout &lt;a href="http://lokad-sdk.googlecode.com/svn/trunk/dot-net-legacy/Lokad.Client.CallCenter" target="_blank" class="offsite-link-inline"&gt;Call Center Calculator&lt;/a&gt; or &lt;a href="http://lokad-sdk.googlecode.com/svn/trunk/dot-net-legacy/Lokad.Client.SafetyStock" target="_blank" class="offsite-link-inline"&gt;Safety Stock Calculator&lt;/a&gt; (via version control).&lt;/li&gt;
&lt;li&gt;Execute &lt;em&gt;go /t:CreateInstall /p:Version=1.2.3.4&lt;/em&gt; in the root project folder&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sources are made public under the new BSD License. &lt;/p&gt;

&lt;p&gt;Here are some additional links on WiX that I found useful while learning the technology:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://robmensching.com/blog/posts/2003/10/4/Windows-Installer-Components-Introduction" target="_blank" class="offsite-link-inline"&gt;Windows Installer Components Introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.wixwiki.com/index.php?title=Main_Page" target="_blank" class="offsite-link-inline"&gt;WiX Wiki&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://stackoverflow.com/questions/471424/wix-tricks-and-best-practices" target="_blank" class="offsite-link-inline"&gt;WiX tricks and best practices&lt;/a&gt; on StackOverflow.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.wixwiki.com/index.php?title=Deploying_Additional_Components" target="_blank" class="offsite-link-inline"&gt;Deploying additional components with GenerateBootstrapper task&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.mail-archive.com/wix-users@lists.sourceforge.net/msg18838.html" target="_blank" class="offsite-link-inline"&gt;How do I start an application after install?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://social.msdn.microsoft.com/forums/en-US/vsto/thread/514d6278-d7df-47c1-9e11-08a5a4c43ca4/" target="_blank" class="offsite-link-inline"&gt;How do you create an MSI to deploy a VSTO 3.0 Add-in?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/aa372057(VS.85).aspx" target="_blank" class="offsite-link-inline"&gt;System Folder Properties&lt;/a&gt; at MSDN&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blogs.technet.com/alexshev/pages/from-msi-to-wix.aspx" target="_blank" class="offsite-link-inline"&gt;From MSI to WiX&lt;/a&gt; article series.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Deployment and auto-update process on top of WiX might work like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Integration server, when asked to publish release, does the following:
&lt;ul&gt;
&lt;li&gt;It creates a new MSI installer by building the project and then running WiX-related MSBuild tasks. This MSI uses major upgrades to deliver new functionality and update files on user’s computer.&lt;/li&gt;
&lt;li&gt;Updates the download page by redirecting links to the latest package&lt;/li&gt;
&lt;li&gt;Updates custom deployment manifest, which could be as simple as ProductName.Release.txt file containing latest version number&lt;/li&gt;
&lt;li&gt;Copies latest released MSI to ProductName.Release.msi in a well-known location&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;When user checks for the updates (or software does it for him) following takes place:
&lt;ul&gt;
&lt;li&gt;A simple web request to the version file somewhere over the network will tell if we are up-to-date&lt;/li&gt;
&lt;li&gt;If we are not – just inform the user about that and offer him to perform the upgrade&lt;/li&gt;
&lt;li&gt;When user accepts, close the application and launch &lt;em&gt;ClickOnce&lt;/em&gt; bootstrapper bundled into the MSI. Bootstrapper does not actually care about the &lt;em&gt;ClickOnce&lt;/em&gt;, it merely checks for the prerequisites, then downloads and installs the MSI it knows about. In our situation this MSI is ProductName.Release.msi.&lt;/li&gt;
&lt;li&gt;Launched MSI is implemented as a major upgrade, so it will simply offer user to click Next a few times (firing off UAC if operating system supports it), perform the upgrade and then re-launch the application&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The process of deployment and auto-updates might feel slightly complicated, yet it involves very little coding (except for the MSI creation). The most interesting part is that it has to be done only once. After that fixing issue for the customers is just a matter of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Writing unit test&lt;/li&gt;
&lt;li&gt;Fixing the issue&lt;/li&gt;
&lt;li&gt;Committing changes to version control repository&lt;/li&gt;
&lt;li&gt;Telling Integration server to perform the deployment after the build.&lt;/li&gt;
&lt;li&gt;Asking customer to click the "Check for updates" button in his application.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This brings us closer to the Agile development methodologies in the development of desktop applications with complex deployment scenarios.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Related links:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://abdullin.com/xlim/"&gt;xLim development principles and guidelines&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://abdullin.com/wiki/agile-software-development.html"&gt;Agile Software Development&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=07RhsGZ3qtQ:Hw-VyLvmuMg:nQ_hWtDbxek"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?d=nQ_hWtDbxek" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=07RhsGZ3qtQ:Hw-VyLvmuMg:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=07RhsGZ3qtQ:Hw-VyLvmuMg:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=07RhsGZ3qtQ:Hw-VyLvmuMg:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=07RhsGZ3qtQ:Hw-VyLvmuMg:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=07RhsGZ3qtQ:Hw-VyLvmuMg:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=07RhsGZ3qtQ:Hw-VyLvmuMg:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=07RhsGZ3qtQ:Hw-VyLvmuMg:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RinatAbdullin/~4/07RhsGZ3qtQ" height="1" width="1"/&gt;</description><wfw:commentRss>http://abdullin.com/journal/rss-comments-entry-4559011.xml</wfw:commentRss><feedburner:origLink>http://abdullin.com/journal/2009/7/8/deployment-and-updates-of-desktop-applications-wix-clickonce.html</feedburner:origLink></item><item><title>Testing MVC Elements and Interactions with Mock Container</title><category>C#</category><category>IoC</category><category>Lokad</category><category>Snippets</category><category>autofac</category><category>tdd</category><dc:creator>Rinat Abdullin</dc:creator><pubDate>Wed, 24 Jun 2009 21:38:38 +0000</pubDate><link>http://feedproxy.google.com/~r/RinatAbdullin/~3/s-hQzanEuzU/testing-mvc-elements-and-interactions-with-mock-container.html</link><guid isPermaLink="false">287483:2929700:4432062</guid><description>&lt;p&gt;&lt;a href="http://abdullin.com/shared-libraries/"&gt;Lokad Shared Libraries project&lt;/a&gt; includes implementation of the MockContainer that significantly simplifies testing of Model-View-Controller elements in separation. It does this by &lt;em&gt;automatically generating and injecting mock objects&lt;/em&gt;, should the tested class ask for them in its constructor. &lt;/p&gt;

&lt;p&gt;These &lt;em&gt;mock objects are persisted in the local container&lt;/em&gt; instance as singleton, so that additional expectations could be recorded against them. Expectations are verified when the container is disposed.&lt;/p&gt;

&lt;p&gt;There is a little overhead of creating and disposing container and instances every test, since we are using &lt;a href="http://abdullin.com/autofac/"&gt;Autofac IoC Container&lt;/a&gt; internally here, which has a really good performance.&lt;/p&gt;

&lt;p&gt;Interface and internals of this MockContainer have been polished heavily since its &lt;a href="http://abdullin.com/journal/2009/4/11/testing-mvc-controllers-with-mock-container.html"&gt;introduction a few months ago&lt;/a&gt;. This (with the help from a base fixture class providing a nice syntax) has allowed to write tests like this one:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[Test]
public void Display()
{
  View.SetTitle("Some title");

  // we expect the view to ask IViewspace to display itself
  WhenViewIsShown
     // you always set Form.CancelButton  for user's pleasure
    .CancelButtonShouldBeSet()
     // assert that title as as expected
    .TitleShouldBe("Some title");

    // create 0 to 20 random models and display them in view
    View.BindModel(RandClientModels.NextEvents(0, 20));
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This is an actual unit test against actual Windows.Forms.UserControl component. It does what it says. Ability to write unit tests like this brings following benefits for free:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In this unit test all calls are executed against the interface. So should we need add Silverlight or WPF view implementations to our library, we would already have tests for the first step of &lt;a href="http://abdullin.com/wiki/test-driven-development-tdd.html"&gt;Test Driven Development&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Ability to write simple unit tests really pays off in scenarios, where a single component is reused in multiple projects. Finding a bug in one of these projects, expressing it in a unit test and fixing, immediately makes all projects downstream more stable. &lt;/li&gt;
&lt;li&gt;Using randomly-generated Models allows to cover a wider range of the possible failure scenarios. Should some case go wrong, we'll be able to reproduce it by checking out rand seed used in the integration run (&lt;em&gt;Nondeterministic reproducible testing&lt;/em&gt; will be the subject of another article).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's another type of unit test. It could be invoked explicitly just to see how our view looks alone (without launching an entire application and clicking our way to this View):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[Test, Explicit]
public void Show_view_for_debugging()
{
  // when view asks to show itself, actually display it
  WhenViewIsShown.ShowAsDialog();
  // load random values and display
  View.BindModel(RandClientModels.NextEvent());
  // display view, while using ValidEvent rule 
  // to validate all input
  View.GetModel(EditEventController.ValidEvent);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;em&gt;ExplicitAttribute&lt;/em&gt; in NUnit tells us that unit test is excluded from the usual unit testing run and has to be launched manually.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This kind of debugging unit test for the reusable View components speeds up all the testing and UI tweaking process. Do you need to check out how View validates data, scales or displays that recent UI tweak? This is just one click away:&lt;/p&gt;

&lt;p&gt;&lt;span class="full-image-block ssNonEditable"&gt;&lt;span&gt;&lt;img src="http://abdullin.com/storage/uploads/2009/06/2009-06-25_using_mockContainer_to_test_MVC_views.png" alt="Using MockContainer to test MVC Views"/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Sometimes we may want to go deeper and check out how various components integrate together. This is not a normal unit test (in the sense of &lt;a href="http://abdullin.com/wiki/unit-testing.html"&gt;Unit Testing&lt;/a&gt;), so it is marked with ExplicitAttribute as well.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[Test, Explicit]
public void Test_for_debugging_with_controller()
{
  // view is registered by test fixture
  WhenViewIsShown.ShowAsDialog();

  // simplified syntax for registering additional components
  // that we don't want to be replaced with mock objects.
  Container.Build(builder =&amp;gt;
  {
    builder.Register&amp;lt;ConnectionEditController&amp;gt;();
    builder.Register&amp;lt;WorkScopeView&amp;gt;().As&amp;lt;IWorkScopeView&amp;gt;();
  });

  // resolving controller and launching it with a random connection
  var controller = Container.Resolve&amp;lt;ConnectionEditController&amp;gt;();
  controller.Startup();
  controller.Edit(RandApiModels.NextServiceConnection());
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Although code like this does not participate in the &lt;a href="http://abdullin.com/wiki/continuous-integration.html"&gt;Continuous Integration&lt;/a&gt; process, having it around speeds up the development and simplifies debugging, should something go wrong.&lt;/p&gt;

&lt;p&gt;This specific test creates UI elements like this:&lt;/p&gt;

&lt;p&gt;&lt;span class="full-image-block ssNonEditable"&gt;&lt;span&gt;&lt;img src="http://abdullin.com/storage/uploads/2009/06/2009-06-25_using_MockContainer_to_test_complex_component_interactions.png?__SQUARESPACE_CACHEVERSION=1245883585590" alt="Using MockContainer to test complex component interactions"/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Unit tests samples come from open source project &lt;a href="http://code.google.com/p/lokad-sdk/" class="offsite-link-inline"&gt;Lokad SDK&lt;/a&gt; that allows developers to introduce forecasting capabilities of &lt;a href="http://www.lokad.com/" target="_blank" class="offsite-link-inline"&gt;Lokad.com&lt;/a&gt; into their applications.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=s-hQzanEuzU:wkosBfcMfsk:nQ_hWtDbxek"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?d=nQ_hWtDbxek" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=s-hQzanEuzU:wkosBfcMfsk:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=s-hQzanEuzU:wkosBfcMfsk:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=s-hQzanEuzU:wkosBfcMfsk:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=s-hQzanEuzU:wkosBfcMfsk:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=s-hQzanEuzU:wkosBfcMfsk:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=s-hQzanEuzU:wkosBfcMfsk:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=s-hQzanEuzU:wkosBfcMfsk:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RinatAbdullin/~4/s-hQzanEuzU" height="1" width="1"/&gt;</description><wfw:commentRss>http://abdullin.com/journal/rss-comments-entry-4432062.xml</wfw:commentRss><feedburner:origLink>http://abdullin.com/journal/2009/6/25/testing-mvc-elements-and-interactions-with-mock-container.html</feedburner:origLink></item><item><title>Cloud Bursting Scenarios For Small Companies</title><category>Articles</category><category>Cloud Computing</category><category>TechOverview</category><category>Theory</category><category>thoughts</category><dc:creator>Rinat Abdullin</dc:creator><pubDate>Sat, 20 Jun 2009 09:50:01 +0000</pubDate><link>http://feedproxy.google.com/~r/RinatAbdullin/~3/Mvjpkbn3CM0/cloud-bursting-scenarios-for-small-companies.html</link><guid isPermaLink="false">287483:2929700:4390566</guid><description>&lt;p&gt;&lt;em&gt;Almost every software developer dreams about starting up his own MicroISV company that would keep bringing him money even during the sleep. Let’s see how cloud computing can help us out here by making it easier to succeed.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article continues the &lt;a href="http://abdullin.com/cloud-computing-in-net/"&gt;Cloud Computing series&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;These days it became so easy to start a one-man company in the IT industry, like it had never been before. A lot of people are doing that, while the &lt;em&gt;MicroISV&lt;/em&gt; and &lt;em&gt;Micropreneur&lt;/em&gt; are becoming &lt;a href="http://redbitbluebit.com/hierarchy-of-the-successful-independent-software-developer/" target="_blank" class="offsite-link-inline"&gt;rather hot topics on self-development blogs&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;One of the reasons for this is that you no longer need to have a physical hardware or other resources in order to be able to provide software and services. Almost everything could be virtualized and hosting could be simply rented. It's quite flexible and convenient, isn't it?&lt;/p&gt;

&lt;p&gt;As turns out, &lt;a href="http://abdullin.com/wiki/cloud-computing.html"&gt;Cloud Computing&lt;/a&gt; can add even more flexibility and market maturity to small companies at a fraction of the cost. That’s because one of the major driving forces behind the Cloud Computing hype is the actual ability to buy hardware capacities and resources on demand without paying for them upfront.&lt;/p&gt;

&lt;p&gt;Let’s have a look at first business scenario of pushing CPU-intensive computing into the cloud and the technological availability of implementing it today.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; all figures, names and numbers are purely imaginative. They are used just to show you the logic behind the cloud bursting and scale of savings it can bring.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let’s imagine a small and young one-man company providing some software as a service. For example &lt;em&gt;IdealDotNET&lt;/em&gt; that specializes in providing custom code quality reports and optimization recommendations for .NET development projects, based on some proprietary algorithms. These algorithms are running against assemblies being uploaded by the customers. First 10 assemblies are analyzed for free.&lt;/p&gt;

&lt;p&gt;We’ll put aside financial feasibility of this endeavor and concentrate on the technological implementation side. It could be as simple as this:&lt;/p&gt;

&lt;p&gt;&lt;span class="full-image-block ssNonEditable"&gt;&lt;span&gt;&lt;img src="http://abdullin.com/storage/uploads/2009/06/2009-06-20_cloud-computing-scenario1-pix1.png" alt="ISV company without a cloud computing capabilities"/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;As we all know, running complex introspection rules against any assembly is a rather CPU-intensive process, especially if these rules include some extensive checks. So this &lt;em&gt;system will be able to handle only a limited amount of users per hour&lt;/em&gt;. Let’s assume that this setup can process 30 .NET assemblies per hour on a deployment that costs 100 EUR per month (entire system is located on one semi-dedicated server).&lt;/p&gt;

&lt;p&gt;As long as the number of uploads does not exceed 30 per hour, this setup will provide solution that just works for its money. Here’s how the usage statistics might look like:&lt;/p&gt;

&lt;p&gt;&lt;span class="full-image-block ssNonEditable"&gt;&lt;span&gt;&lt;img src="http://abdullin.com/storage/uploads/2009/06/2009-06-20_cloud-computing-scenario1-pix2.png" alt="Sample upload statistics for an ISV company without a cloud computing capabilities"/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Everything will go just fine till &lt;em&gt;IdealDotNET&lt;/em&gt; starts some marketing campaigns or simply gets mentioned by &lt;a href="http://www.hanselman.com/blog/" target="_blank" class="offsite-link-inline"&gt;Scott Hanselman&lt;/a&gt; in his blog (he once twitted about the power to take down a small site by linking to it).&lt;/p&gt;

&lt;p&gt;We’ll get into a nasty situation, when this happens. Number of upload attempts per hour will exceed our capacities:&lt;/p&gt;

&lt;p&gt;&lt;span class="full-image-block ssNonEditable"&gt;&lt;span&gt;&lt;img src="http://abdullin.com/storage/uploads/2009/06/2009-06-20_cloud-computing-scenario1-pix3.png" alt="Small ISV company is not capable of handling the Slashdot effect"/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;If the system had been designed to handle such a situation, then it would not crash down everything. Instead, all excessive visitors would be simply turned away by saying something like "We are sorry, but upload limit has been reached, please come later". &lt;/p&gt;

&lt;p&gt;This approach means &lt;em&gt;lost profit&lt;/em&gt;, because some of these visitors had a chance of liking the service and becoming customers. More than that, some of the existing customers may hit the limit, get discouraged by it and turn away to the competitors.&lt;/p&gt;

&lt;p&gt;What could we do?&lt;/p&gt;

&lt;p&gt;One option is to have more servers from the start. This way &lt;em&gt;IdealDotNet&lt;/em&gt; will have more capacity to handle usage spikes before they happen. Let’s say that the company got two more servers from the very start, boosting upload limit to 100 per hour. Then the &lt;a href="http://en.wikipedia.org/wiki/Slashdotted" target="_blank" class="offsite-link-inline"&gt;Slashdot effect&lt;/a&gt; would look much better for us:&lt;/p&gt;

&lt;p&gt;&lt;span class="full-image-block ssNonEditable"&gt;&lt;span&gt;&lt;img src="http://abdullin.com/storage/uploads/2009/06/2009-06-20_cloud-computing-scenario1-pix4.png" alt="Handling Slashdot effect by buying servers before it happens"/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;That’s an easy solution, yet it comes with two problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Additional servers come at a cost (for example, additional 200 EUR per month) and they will still sit idle most of the time. If &lt;em&gt;IdealDotNET&lt;/em&gt; had existed for mere 2 months, then total cost (simplified) of handling such a spike is 400 EUR.&lt;/li&gt;
&lt;li&gt;Buying exactly the right processing capacities the start is impossible.  Even with the best estimate you’ll either have excessive capacities or will miss some spikes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s where the technological opportunities of Cloud computing come to the rescue. With some tweaking infrastructure of &lt;em&gt;IdealDotNET&lt;/em&gt; could be modified to use only one server most of the time, while gracefully scaling up to handle the spikes.&lt;/p&gt;

&lt;p&gt;&lt;span class="full-image-block ssNonEditable"&gt;&lt;span&gt;&lt;img src="http://abdullin.com/storage/uploads/2009/06/2009-06-20_cloud-computing-scenario1-pix5.png" alt="ISV company enhanced with the capabilities to burst into the cloud"/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;We’ll talk about the implementation details later. Let’s focus on the economical benefits first. With this configuration our processing limits start looking more interesting - they elastically adapt to handle the demand:&lt;/p&gt;

&lt;p&gt;&lt;span class="full-image-block ssNonEditable"&gt;&lt;span&gt;&lt;img src="http://abdullin.com/storage/uploads/2009/06/2009-06-20_cloud-computing-scenario1-pix6.png" alt="Sample usage statistics for an ISV company capable of bursting into the cloud"/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;If &lt;em&gt;IdealDotNET&lt;/em&gt; had used &lt;a href="http://aws.amazon.com/ec2/" target="_blank" class="offsite-link-inline"&gt;Amazon EC2&lt;/a&gt; Medium CPU Virtual Machines to handle these spikes (their price is  0.20USD per hour each), then the total cost of handling this spike is around 40 EUR. That looks better than 400EUR, does not it? Plus we get the flexibility of elastically scaling to 1000 uploads per hour (or more) as needed.&lt;/p&gt;

&lt;p&gt;This scenario is called &lt;em&gt;Cloud Bursting&lt;/em&gt; or &lt;em&gt;Bursting into the cloud&lt;/em&gt;.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; theoretically &lt;em&gt;IdealDotNET&lt;/em&gt; could get a better deal from &lt;a href="http://www.mosso.com/cloudservers.jsp" target="_blank" class="offsite-link-inline"&gt;Mosso&lt;/a&gt; (their cloud machines start at 0.015 USD per hour). But it does not look like they have all the technological pieces in place for implementing cloud bursting scenario efficiently.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;How hard is it to implement a system that can elastically handle as much stress as it is needed? Answer is: it is not extremely hard, if you change your way of thinking a little bit towards elastic capacities.&lt;/p&gt;

&lt;p&gt;We start by adding a &lt;em&gt;Manager&lt;/em&gt; component to our system (it could be a separate process or simply a loop in a background thread). It will continuously watch for the number of uploads pending to be processed. Should it become obvious that our processing capacities are not enough to keep up with the demand; it will issue requests to the Cloud Computing API to deploy new virtual machines (Amazon EC2 already has such REST-based API available, while Windows Azure claims to release it later).&lt;/p&gt;

&lt;p&gt;Each virtual machine usually comes preconfigured with some worker role. This pre-configuration can be done by: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;deploying an application or scripts to the cloud (if this cloud service is a &lt;em&gt;Platform as a Service&lt;/em&gt; provider like Google App Engine or Windows Azure);&lt;/li&gt;
&lt;li&gt;uploading preconfigured VM image (if the cloud is an &lt;em&gt;Infrastructure as a Service&lt;/em&gt; provider like Amazon EC2).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When this worker boots up, it only needs the addresses of the task and result queues in order to start processing jobs. These parameters are usually passed as arguments along with the deployment calls.&lt;/p&gt;

&lt;p&gt;In order to let the cloud workers access these queues in a secure way we will need to expose them via some encrypted service API, implemented in a flavor of communication framework of your choice.&lt;/p&gt;

&lt;p&gt;When the Manager detects that we no longer need the some processing power from the cloud, it would gracefully shut down these workers, saving energy for the society and money for &lt;em&gt;IdealDotNET&lt;/em&gt;. &lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; obviously, there are few more technological challenges that have to be dealt with. These might include: reliable cloud management, remote exception handling and monitoring. However these problems do not have any black holes in their domain space (at least from my perspective) and thus are almost guaranteed to resolve to a finite and defined work time which could be used in project management schedules. This work time could be further reduced by applying &lt;a href="http://abdullin.com/shared-libraries/"&gt;established frameworks&lt;/a&gt; and &lt;a href="http://abdullin.com/xlim/"&gt;development principles&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Given all these advantages of the cloud computing why wouldn’t &lt;em&gt;IdealDotNET&lt;/em&gt; move everything to the cloud? There are several reasons for that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cloud computing solutions are generally more expensive when it comes to long-term consumption (compared to existing offerings by hosters).&lt;/li&gt;
&lt;li&gt;This would be a more complex solution to implement (from the delivery and maintenance standpoints).&lt;/li&gt;
&lt;li&gt;This comes with a certain lockdown cost. Once you have your entire infrastructure in a single cloud, it is not that easy to move it to a different cloud (especially since we don’t have well-established cloud computing market, yet). It is safer to keep primary resources closer to you, while using the cloud only to handle the spikes. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In fact, in order to reduce the dependency on a single cloud provider, &lt;em&gt;IdealDotNET&lt;/em&gt; company could use several cloud computing providers, picking whichever is better for the situation.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Does not this example of cloud bursting create an itch to use such a great resource to solve some business problems? There are more examples to follow in the &lt;a href="http://abdullin.com/cloud-computing-in-net/"&gt;Cloud Computing series&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;You can &lt;a href="http://feeds.abdullin.com/RinatAbdullin"&gt;subscribe to the updates&lt;/a&gt;, if you are interested.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Related links:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://abdullin.com/wiki/cloud-computing.html"&gt;What is Cloud computing?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://aws.amazon.com/ec2/" target="_blank" class="offsite-link-inline"&gt;Elastic Compute Cloud&lt;/a&gt; at Amazon&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.mosso.com/cloudservers.jsp" target="_blank" class="offsite-link-inline"&gt;Cloud Servers&lt;/a&gt; at Mosso&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=Mvjpkbn3CM0:ekLeCvGigkk:nQ_hWtDbxek"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?d=nQ_hWtDbxek" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=Mvjpkbn3CM0:ekLeCvGigkk:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=Mvjpkbn3CM0:ekLeCvGigkk:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=Mvjpkbn3CM0:ekLeCvGigkk:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=Mvjpkbn3CM0:ekLeCvGigkk:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=Mvjpkbn3CM0:ekLeCvGigkk:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=Mvjpkbn3CM0:ekLeCvGigkk:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=Mvjpkbn3CM0:ekLeCvGigkk:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RinatAbdullin/~4/Mvjpkbn3CM0" height="1" width="1"/&gt;</description><wfw:commentRss>http://abdullin.com/journal/rss-comments-entry-4390566.xml</wfw:commentRss><feedburner:origLink>http://abdullin.com/journal/2009/6/20/cloud-bursting-scenarios-for-small-companies.html</feedburner:origLink></item><item><title>Software Development Body of Knowledge - ABC 02</title><category>Articles</category><dc:creator>Rinat Abdullin</dc:creator><pubDate>Tue, 16 Jun 2009 14:14:53 +0000</pubDate><link>http://feedproxy.google.com/~r/RinatAbdullin/~3/cxa_vHUFQF4/software-development-body-of-knowledge-abc-02.html</link><guid isPermaLink="false">287483:2929700:4334574</guid><description>&lt;p&gt;In this &lt;a href="http://abdullin.com/software-development-bok/"&gt;Software Development ABC&lt;/a&gt; article we'll walk over the development terms that were quite a paradigm shift for me in the first years of my software-related career. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;There will be a short intro, followed by the compact definitions of 3 terms with the links leading to full articles (and even more links).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The first paradigm shift has happened while I was coding forecasting algorithms for my diploma in economics (back in Delphi and Pascal these days). It was about &lt;strong&gt;Version Control Systems&lt;/strong&gt;. They have allowed to stop worrying about manual backups or doing something wrong. Ability to instantly roll back to the previous working copy (or any other previous moment in history) gave an invaluable sense of confidence and flexibility.  I also was finally able to get rid of incremental archives scattered across the hard drives (all these "copy2.zip" and "copy2version4.zip"). &lt;/p&gt;

&lt;p&gt;The second paradigm shift was about &lt;strong&gt;Unit Testing&lt;/strong&gt; which is an extremely simple concept on its own - split the code in units and write assertions to rapidly verify correct behavior of these units. Unit testing has allowed to concentrate on the development by significantly reducing the risk of breaking something with a change (which is often the case with mathematical code). Green became my favorite color afterwards.&lt;/p&gt;

&lt;p&gt;The third paradigm shift took place some time later, when I started working remotely in my first development project. It was .NET 1.1 with a lot of fragile and complex legacy code. Changes there rarely went without breaking something else. &lt;/p&gt;

&lt;p&gt;Yet, the sales people didn't care about things like development friction and constantly demanded new features. They often went directly to the developers in order to get them. Planning and schedules were often sacrificed for the sake of moving forward with an important customer (which actually made sense in that project).&lt;/p&gt;

&lt;p&gt;The only way to deliver reliable functionality in such a brittle and fast paced environment was about using some methods from the &lt;strong&gt;Agile Software Development&lt;/strong&gt;. And, as it has turned out later, they did work and made development process more efficient and stable.&lt;/p&gt;

&lt;p&gt;So let's get into these three terms in a more detail. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;You can either continue reading through expanded definitions (which have links leading to even more material) or &lt;a href="http://feeds.abdullin.com/RinatAbdullin"&gt;subscribe to receive updates on this topic&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://abdullin.com/software-development-bok/"&gt;&lt;span class="full-image-block ssNonEditable"&gt;&lt;span&gt;&lt;img src="http://abdullin.com/storage/uploads/2009/06/SDBoK-ABC-terms.jpg" alt="Software Development Body of Knowledge ABC"/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;Version Control System - VCS&lt;/h1&gt;

&lt;p&gt;&lt;br /&gt;
&lt;em&gt;Version Control System&lt;/em&gt; (VCS) is a software that allows to manage changes of documents, programs, images and other information that is stored in form of computer files. Changes are usually identified by an incrementing number or letter code also known as &lt;em&gt;revision number&lt;/em&gt; or &lt;em&gt;revision&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;The simplest usage of versioning is - &lt;em&gt;you can easily go back to the previous working version of your files&lt;/em&gt;, should you mess something up with the latest changes.&lt;/p&gt;

&lt;p&gt;Changes could range from fixing a typo in a text file up to a huge refactoring in a software project, spanning hundreds of files. Each change usually has name of the person introduced it, time of the change and an optional description message.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://abdullin.com/wiki/version-control-system-vcs.html"&gt;Proceed to the full article on Version Control Systems&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;Unit Testing&lt;/h1&gt;

&lt;p&gt;&lt;br /&gt;
&lt;em&gt;Unit Testing&lt;/em&gt; in software development is a &lt;strong&gt;way to quickly verify that smallest blocks of software (units) behave as expected&lt;/strong&gt; even as the software changes and evolves.&lt;/p&gt;

&lt;p&gt;Here's how it works. &lt;/p&gt;

&lt;p&gt;Any program could be logically separated into distinct units (in &lt;em&gt;object-oriented programming&lt;/em&gt; the smallest unit usually being a &lt;em&gt;class&lt;/em&gt;). &lt;strong&gt;Developers, while coding these program units, also create tests for them&lt;/strong&gt; (code blocks containing some assertions and expectations about units). These tests could be used to rapidly verify behavior of the code being tested.&lt;/p&gt;

&lt;p&gt;When some other developer introduces new units or changes something in existing units, he can run all the tests available for the program and verify that everything is still operating as expected. Usually running unit tests is a fast operation (less than 30 seconds), so developers are encouraged to do that often.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://abdullin.com/wiki/unit-testing.html"&gt;Proceed to the full article on Unit Testing&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;Agile Software Development&lt;/h1&gt;

&lt;p&gt;&lt;br /&gt;
&lt;em&gt;Agile Software Development&lt;/em&gt; is an &lt;em&gt;iterative and incremental approach&lt;/em&gt; in software development, where &lt;em&gt;requirements and solutions evolve&lt;/em&gt; through a &lt;em&gt;tight collaboration&lt;/em&gt; of self-organizing cross-functional teams.&lt;/p&gt;

&lt;p&gt;Agile works quite well in situations when some &lt;strong&gt;unique software project has to be delivered really fast&lt;/strong&gt; in order to seize the market opportunity. This works because Agile software methodologies allow development teams to &lt;em&gt;adapt quickly to the rapidly changing business requirements&lt;/em&gt;. This happens because of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;short development iterations&lt;/strong&gt; allowing to start getting feedback early in the project's life-cycle and incorporate it into the product fast by delivering working software repeatedly and in a timely manner;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="http://abdullin.com/wiki/continuous-integration.html"&gt;continuous integration&lt;/a&gt;&lt;/strong&gt; helping to reduce development friction and improve quality of a rapidly developing project in self-organizing environment;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;feature-driven development&lt;/strong&gt; focusing development on delivering features (functionality) bringing real business value to the client (and the project);&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;lean software development&lt;/strong&gt; laying out common principles for efficient software development process;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;eXtreme Programming&lt;/strong&gt; pushing lightweight software development methodologies to the extreme.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="http://abdullin.com/wiki/agile-software-development.html"&gt;Proceed to the full article on Agile Software Development&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Interested in the series? You can stay tuned by &lt;a href="http://feeds.abdullin.com/RinatAbdullin"&gt;subscribing to the RSS feed of this Journal&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=cxa_vHUFQF4:6j5v4bFhEXg:nQ_hWtDbxek"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?d=nQ_hWtDbxek" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=cxa_vHUFQF4:6j5v4bFhEXg:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=cxa_vHUFQF4:6j5v4bFhEXg:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=cxa_vHUFQF4:6j5v4bFhEXg:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=cxa_vHUFQF4:6j5v4bFhEXg:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=cxa_vHUFQF4:6j5v4bFhEXg:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=cxa_vHUFQF4:6j5v4bFhEXg:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=cxa_vHUFQF4:6j5v4bFhEXg:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RinatAbdullin/~4/cxa_vHUFQF4" height="1" width="1"/&gt;</description><wfw:commentRss>http://abdullin.com/journal/rss-comments-entry-4334574.xml</wfw:commentRss><feedburner:origLink>http://abdullin.com/journal/2009/6/16/software-development-body-of-knowledge-abc-02.html</feedburner:origLink></item><item><title>Software Development Body of Knowledge - ABC 01</title><category>Articles</category><dc:creator>Rinat Abdullin</dc:creator><pubDate>Thu, 11 Jun 2009 19:40:14 +0000</pubDate><link>http://feedproxy.google.com/~r/RinatAbdullin/~3/WAkfdQe2QbI/software-development-body-of-knowledge-abc-01.html</link><guid isPermaLink="false">287483:2929700:4294953</guid><description>&lt;p&gt;There is a great discipline out there called &lt;em&gt;Project Management&lt;/em&gt;. It is about &lt;em&gt;planning, organizing, and managing resources to bring about the successful completion of specific project&lt;/em&gt;. Projects can range widely from writing a diploma to delivering an innovative automobile factory ready for mass-production.&lt;/p&gt;

&lt;p&gt;Core principles of this discipline are captured in a book called &lt;em&gt;&lt;a href="http://en.wikipedia.org/wiki/A_Guide_to_the_Project_Management_Body_of_Knowledge" target="_blank" class="offsite-link-inline"&gt;Project Management Body of Knowledge&lt;/a&gt;&lt;/em&gt; which basically lays out a foundation for a successful communication between the project managers and other people involved in the project (stakeholders).&lt;/p&gt;

&lt;p&gt;These principles could be applied to software development, too. In fact, they should be applied, since Project Management is the tool that allows to deliver really complex development projects on time, within the budget and quality constraints. &lt;/p&gt;

&lt;p&gt;This becomes even more important these days, as the &lt;strong&gt;complexity of enterprise applications keeps on growing with the introduction of new concepts like Software as a Service, Cloud Computing&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;However, before the Project Management approach could be applied consciously to the development domain, some steps ought to be taken. The first one starts with a dictionary of common terms from the domain of software development projects. &lt;/p&gt;

&lt;p&gt;So let me introduce &lt;strong&gt;&lt;a href="http://abdullin.com/software-development-bok"&gt;Software Development Body of Knowledge - ABC&lt;/a&gt;&lt;/strong&gt; series to you. Each article will present definitions of 3 terms essential to the software development these days. These definitions will attempt to provide common high-level overview of the term's meaning without going too deep into the details.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;As always, all feedback is extremely welcome. Please, feel free either to comment on this post, specific terms or to &lt;a href="http://abdullin.com/contact/"&gt;drop me a line directly&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class="full-image-block ssNonEditable"&gt;&lt;span&gt;&lt;img src="http://abdullin.com/storage/uploads/2009/06/SDBoK-ABC-terms.jpg?__SQUARESPACE_CACHEVERSION=1244755868056" alt="Software Development Body of Knowledge - Basic ABC terms"/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h1&gt;Test-Driven Development - TDD&lt;/h1&gt;

&lt;p&gt;&lt;br /&gt;
&lt;em&gt;Test-Driven Development&lt;/em&gt; (TDD) is a software design method that requires developers to &lt;strong&gt;create automated unit tests that define code requirements, before writing code itself&lt;/strong&gt;. These unit tests contain multiple assertions (returning true or false) that could be used to &lt;strong&gt;rapidly verify correct behavior of the code&lt;/strong&gt; being tested. Unit Tests allow developers to &lt;strong&gt;evolve and refactor code in a more secure manner&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Writing a test before the actual code helps to achieve higher quality, because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;it forces developer to refine code contracts before working on the implementation;&lt;/li&gt;
&lt;li&gt;it forces developer to make and keep code easily testable. This requires loose coupling and a separation of cross-cutting concerns;&lt;/li&gt;
&lt;li&gt;presence of unit tests gives developers more psychological freedom to experiment with the code and refactor it; managers get lower risks related to introducing high-level changes to the project.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="http://abdullin.com/wiki/test-driven-development-tdd.html"&gt;Proceed to the full article on Test-Driven Development&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;Continuous Integration&lt;/h1&gt;

&lt;p&gt;&lt;br /&gt;
&lt;em&gt;Continuous Integration (CI)&lt;/em&gt; in software development is a &lt;em&gt;set of practices and principles&lt;/em&gt; that &lt;strong&gt;speed up delivery of software projects and increase quality of their deliverables.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Simply put, Continuous Integration takes a lot of mundane and boring things away from the process of software development, while letting developers to concentrate on more enjoyable and creative tasks.&lt;/p&gt;

&lt;p&gt;As the name implies, Continuous Integration is about &lt;em&gt;integrating changes to the development project continuously and automatically&lt;/em&gt;. These changes usually come in form of modifications and additions to the source code. When we keep them as small as possible and automatically run all checks available (starting from the compilation process and up to the full test routines), we can &lt;strong&gt;detect most breaking issues whenever they are introduced&lt;/strong&gt;. Since the changes are small, it is much easier to isolate and fix the root cause.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://abdullin.com/wiki/continuous-integration.html"&gt;Proceed to the full article on Continuous Integration&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;Inversion of Control - IoC&lt;/h1&gt;

&lt;p&gt;&lt;br /&gt;
&lt;em&gt;Inversion of Control (IoC)&lt;/em&gt; is an approach in software development that favors &lt;em&gt;removing sealed dependencies between classes&lt;/em&gt; in order to make code more simple and flexible. We &lt;em&gt;push control of dependency creation outside of the class&lt;/em&gt;, while making this dependency explicit.&lt;/p&gt;

&lt;p&gt;Usage of Inversion of Control generally allows to &lt;strong&gt;create applications that are more flexible, unit-testable, simple and maintainable&lt;/strong&gt; in the long run.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://abdullin.com/wiki/inversion-of-control-ioc.html"&gt;Proceed to the full article on Inversion of Control&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Interested in the series? You can stay tuned by &lt;a href="http://feeds.abdullin.com/RinatAbdullin"&gt;subscribing to the RSS feed of this Journal&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=WAkfdQe2QbI:rItH1pYQxbU:nQ_hWtDbxek"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?d=nQ_hWtDbxek" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=WAkfdQe2QbI:rItH1pYQxbU:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=WAkfdQe2QbI:rItH1pYQxbU:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=WAkfdQe2QbI:rItH1pYQxbU:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=WAkfdQe2QbI:rItH1pYQxbU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=WAkfdQe2QbI:rItH1pYQxbU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=WAkfdQe2QbI:rItH1pYQxbU:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=WAkfdQe2QbI:rItH1pYQxbU:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RinatAbdullin/~4/WAkfdQe2QbI" height="1" width="1"/&gt;</description><wfw:commentRss>http://abdullin.com/journal/rss-comments-entry-4294953.xml</wfw:commentRss><feedburner:origLink>http://abdullin.com/journal/2009/6/12/software-development-body-of-knowledge-abc-01.html</feedburner:origLink></item><item><title>Developing Component-Driven Applications powered by IoC Containers</title><category>Articles</category><category>How To</category><category>IRepository</category><category>Integration</category><category>IoC</category><category>Snippets</category><category>TechOverview</category><category>Theory</category><category>Tips</category><category>autofac</category><category>management</category><dc:creator>Rinat Abdullin</dc:creator><pubDate>Wed, 03 Jun 2009 19:53:30 +0000</pubDate><link>http://feedproxy.google.com/~r/RinatAbdullin/~3/Bqie-_25sBQ/developing-component-driven-applications-powered-by-ioc-cont.html</link><guid isPermaLink="false">287483:2929700:4165520</guid><description>&lt;p&gt;&lt;em&gt;This article continues talk on the topic of &lt;a href="http://abdullin.com/journal/2009/5/31/component-driven-development-and-ioc-containers.html"&gt;Component-Driven Development with IoC Containers&lt;/a&gt;. We'll expand on the topic of the actual development process of new applications and migrating existing legacy applications.&lt;/em&gt;&lt;/p&gt;

&lt;h1&gt;Developing New Applications&lt;/h1&gt;

&lt;p&gt;In the ideal-world situation with established component libraries for the domain and an IoC ready to provide infrastructure, delivering an application becomes a pleasurable experience. Yet, this is rarely the case when a new project starts. &lt;/p&gt;

&lt;p&gt;In reality we neither have the actual components nor the project-specific knowledge required for rolling out the stable component library right in the first phase. Experience and shared libraries from similar projects &lt;strong&gt;may&lt;/strong&gt; provide a good start, but they still will not be able to get you all the way to the delivery.&lt;/p&gt;

&lt;p&gt;This is somewhat similar to developing a syntax for some new language - it is impossible to foresee and model all key words and syntax elements for the specific domain without a plethora of actual use cases and some iterations.&lt;/p&gt;

&lt;p&gt;So the only working way is about evolution, where design comes first and application evolves from top to the down (as we learn about efficient ways to reflect domain knowledge into the development realm of reusable components).&lt;/p&gt;

&lt;p&gt;&lt;span class="full-image-block ssNonEditable"&gt;&lt;span&gt;&lt;img src="http://abdullin.com/storage/uploads/2009/06/2009-06-04_CDD1_Evolution_Overview.gif?__SQUARESPACE_CACHEVERSION=1244055682433" alt="Component Driven Development Overview"/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Let's walk over the simplified development process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First&lt;/strong&gt;, as it usually happens in any project being initiated properly, we define what business functionality has to be delivered by the application (and then refine the definition a few times with all the major project stakeholders).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Second&lt;/strong&gt;, we implement this functionality by developing against some high-level service contracts, which are defined in the very process. A few short prototyping sprints might be needed here before we get a satisfactory design to proceed with. Deliverables of this step are interface specifications for the components within the service layer (prototypes are discarded).&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Side note.&lt;/strong&gt; Best results on this stage are obtained, when a single architect is capable of reimplementing the entire application in his mind, while evolving it to the best design within multiple iterations. Quality of the deliverable depends on the detalization level of the design, that a person can hold in his mind, while working it through and evolving. In this situation numerous real-world iterations (drawing away valuable and scarce development resources) could be saved at the cost of some head ache. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Third&lt;/strong&gt;, we create mock implementations for these services, hiding them inside the IoC Container.&lt;/p&gt;

&lt;p&gt;&lt;span class="full-image-block ssNonEditable"&gt;&lt;span&gt;&lt;img src="http://abdullin.com/storage/uploads/2009/06/2009-06-04_CDD2_Evolution1.gif?__SQUARESPACE_CACHEVERSION=1244055746318" alt=""/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;At this step we already have got a real application (although completely based on mocked services) that could be used for the demo and presentation purposes. This allows us to start receiving feedback from the involved people. At this point we can switch from the pure prototyping and project management approach to more flexible iterative development. &lt;a href="http://abdullin.com/wiki/continuous-integration.html"&gt;Continuous integration&lt;/a&gt; and automated deployment services will have to be established within the development environment in order to achieve this, while reducing development friction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Then&lt;/strong&gt;, we implement actual service layer below high-level service contracts, gradually replacing mock classes with the actual implementations. These actual implementations may (and probably will) require help from some other service contracts from lower levels (which would be implemented right away, mocked or implemented in a simple form). &lt;/p&gt;

&lt;p&gt;&lt;span class="full-image-block ssNonEditable"&gt;&lt;span&gt;&lt;img src="http://abdullin.com/storage/uploads/2009/06/2009-06-04_CDD3_Evolution2.gif?__SQUARESPACE_CACHEVERSION=1244055811010" alt=""/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;It is really common to discover some unforeseen interactions, threats or opportunities in the process, that will require for the top-level service contracts to evolve along with their implementations. This brings some sort of change shock, that originates at some point of the application logic and affects related components, requiring their redesign (or even change in service contracts).&lt;/p&gt;

&lt;p&gt;However, since components handle fine-grained responsibilities, while being loosely coupled by the IoC , such a shock usually does not go far in the infrastructure, usually being absorbed at the service contract boundaries. That's what makes the difference between "Oh, we've got to rewrite 50% of the code in order to implement this feature" and "Simple, we've just got to isolate this concern and swap the implementation".&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;We work this way all the way to the bottom of the application&lt;/strong&gt;, gradually stabilizing higher levels and evolving lower levels. Cross cutting-concerns are injected into the architecture along the process.&lt;/p&gt;

&lt;p&gt;&lt;span class="full-image-block ssNonEditable"&gt;&lt;span&gt;&lt;img src="http://abdullin.com/storage/uploads/2009/06/2009-06-04_CDD4_Evolution3.gif?__SQUARESPACE_CACHEVERSION=1244055938542" alt=""/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;In the end we might end up with an application that works and is flexible enough for the planned changes. Yet, this may not be the end of the evolution. Good components and even infrastructure bits tend to be reused in other similar applications (just because it is so easy to do that). This brings new constraints and requirements, creating new change shocks that require further evolution of the domain components. &lt;/p&gt;

&lt;p&gt;Good separation of concerns between components and logical component layers, their responsible reuse (sometimes it is better not to reuse in order to avoid unnecessary complexity) and a lot of planning can help to absorb these shocks, while letting the application to grow further, efficiently adapting to further changes in business requirements.&lt;/p&gt;

&lt;h1&gt;Migrating Legacy Applications&lt;/h1&gt;

&lt;p&gt;Unfortunately, greenfield scenario is not the most common in the world. More often we encounter situations, when existing legacy application can't evolve any more due to being strangled with manual wiring and plumbing code (let alone the complexity of the hard-coded interactions). Yet, these legacy applications happen to have a lot of business value and must be adapted to new business requirements.&lt;/p&gt;

&lt;p&gt;One of the options of loosing up the tension is to gradually introduce IoC and component infrastructure. Since this is not a complete redesign, application has to stay more-or-less production ready most of the time (although short destabilization spikes are allowed, as long as they are known and handled). So we can't mess with the top logical layers that represent business functionality (we would not be able due to the complexity anyway) and we'll have to evolve it from bottom to the top.&lt;/p&gt;

&lt;p&gt;At this point we are considering that &lt;a href="http://abdullin.com/wiki/continuous-integration.html"&gt;continuous integration&lt;/a&gt; is established to enforce consistently high quality of the new changes being introduced, while providing us with some protection against quality regressions that are likely to happen in the legacy codebase.&lt;/p&gt;

&lt;p&gt;We might start evolution in the lowest logical section of the application - in repository and DAL layers. We do that by abstracting the functionality behind the service contracts that are implemented by the components. &lt;/p&gt;

&lt;p&gt;At this point of time we do not have any IoC infrastructure in our application yet. So for the evolution process it is allowed to introduce injection points via the static service locators. However, as the evolution process goes, these static service locators would move higher and higher in the application logic till they either hit infrastructure limitations (i.e. resolving components in the web services) or get finally settled down in the places they belong to (application hosts).&lt;/p&gt;

&lt;p&gt;&lt;span class="full-image-block ssNonEditable"&gt;&lt;span&gt;&lt;img src="http://abdullin.com/storage/uploads/2009/06/2009-06-04_CDD5_Revolution1.gif?__SQUARESPACE_CACHEVERSION=1244057904564" alt=""/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Temporary static service locator might look like this in .NET (implementation for the &lt;a href="http://abdullin.com/autofac/"&gt;Autofac IoC Container&lt;/a&gt;):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;public static class GlobalSetup
{
  public static readonly IResolver Resolver;

  // this is fired when container is accessed first time
  static GlobalSetup()
  {
    var builder = new ContainerBuilder();
    builder.RegisterModule(new ConfigurationSettingsReader());
    var container = builder.Build();

    // create IoC-decoupled resolver
    Resolver = new Resolver(
      t =&amp;gt; container.Resolve(t),
      (t, s) =&amp;gt; container.Resolve(s));
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Where Resolver merely implements following IResolver interface via the lambda parameters:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;public interface IResolver
{
  // Methods
  TService Get&amp;lt;TService&amp;gt;();
  TService Get&amp;lt;TService&amp;gt;(string name);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You could look up its implementation in the &lt;a href="http://abdullin.com/shared-libraries/"&gt;Lokad Shared Libraries&lt;/a&gt;, but its really trivial.&lt;/p&gt;

&lt;p&gt;When legacy code uses components directly, we could reference their service contracts like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var repository = GlobalSetup.Resolver
  .Get&amp;lt;ICustomerRepository&amp;gt;();
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;When we don't control the resolution point (i.e.: this happens with .NET-instantiated classes like web services or object data sources), we could use simple proxy classes. These classes bring control of the component instantiation back into our hands and could probably be created with your favorite refactoring tool in less than in a minute. &lt;/p&gt;

&lt;p&gt;Sample IoC proxy class for &lt;em&gt;ICustomerRepository&lt;/em&gt; might look like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;public sealed class CustomerProxy : ICustomerRepository
{
  private readonly ICustomerRepository _repository;

  public CustomerProxy()
  {
    _repository = GlobalSetup.Resolver
      .Get&amp;lt;ICustomerRepository&amp;gt;();
  }


  public Guid CreateCustomer(Customer customer)
  {
    return _repository.CreateCustomer(customer);
  }

  public Customer GetCustomer(Guid customerID)
  {
    return _repository.GetCustomer(customerID);
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In order to quickly create such a component proxy with Visual Studio 2008 and R# we merely have to code the class declaration with the constructor:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;public sealed class CustomerProxy : ICustomerRepository
{
  private readonly ICustomerRepository _repository;

  public CustomerProxy()
  {
    _repository = GlobalSetup.Resolver
      .Get&amp;lt;ICustomerRepository&amp;gt;();
  }

  // place cursor here
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then place cursor below constructor and call for R# autogeneration popup menu (Alt+Ins for me). There we select "Generate | Delegating Members", hit [Space] to select everything and then [Enter] to generate. That's it.&lt;/p&gt;

&lt;p&gt;&lt;span class="full-image-block ssNonEditable"&gt;&lt;span&gt;&lt;img src="http://abdullin.com/storage/uploads/2009/06/2009-06-04_CDD6-Resharper.gif?__SQUARESPACE_CACHEVERSION=1244058961006" alt="Generating an IoC Component Proxy with Resharper"/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;The technique also works with the situations, where proxy has to implement multiple interfaces at once (i.e.: web service aggregating a few service contracts).&lt;/p&gt;

&lt;p&gt;There are a few more tips and tricks on developing components in for IoC infrastructure and enforcing common design guidelines upon them. So there might eventually be a third article in the series some time later.&lt;/p&gt;

&lt;p&gt;Meanwhile you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://feeds.abdullin.com/RinatAbdullin"&gt;Subscribe to the journal RSS feed&lt;/a&gt; to stay tuned for the updates.&lt;/li&gt;
&lt;li&gt;Share you thoughts about this article either in comments or &lt;a href="http://abdullin.com/contact/"&gt;privately&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Do you have a real world experience with component-driven development in complex projects? I'd love to hear about that!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Related articles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://abdullin.com/journal/2009/2/12/structuring-net-applications-with-autofac-ioc.html"&gt;Structuring .NET Applications with Autofac IoC&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://abdullin.com/journal/2008/2/7/managing-the-flexibility.html"&gt;Managing the flexibility: Inspector for the Components registered in the IoC Container&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=Bqie-_25sBQ:GU1t1YwGkRc:nQ_hWtDbxek"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?d=nQ_hWtDbxek" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=Bqie-_25sBQ:GU1t1YwGkRc:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=Bqie-_25sBQ:GU1t1YwGkRc:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=Bqie-_25sBQ:GU1t1YwGkRc:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=Bqie-_25sBQ:GU1t1YwGkRc:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=Bqie-_25sBQ:GU1t1YwGkRc:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=Bqie-_25sBQ:GU1t1YwGkRc:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=Bqie-_25sBQ:GU1t1YwGkRc:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RinatAbdullin/~4/Bqie-_25sBQ" height="1" width="1"/&gt;</description><wfw:commentRss>http://abdullin.com/journal/rss-comments-entry-4165520.xml</wfw:commentRss><feedburner:origLink>http://abdullin.com/journal/2009/6/3/developing-component-driven-applications-powered-by-ioc-cont.html</feedburner:origLink></item><item><title>Component-Driven Development and IoC Containers</title><category>Articles</category><category>IRepository</category><category>IoC</category><category>TechOverview</category><category>Theory</category><category>autofac</category><category>thoughts</category><dc:creator>Rinat Abdullin</dc:creator><pubDate>Sun, 31 May 2009 19:42:07 +0000</pubDate><link>http://feedproxy.google.com/~r/RinatAbdullin/~3/r0aDBI_pPfQ/component-driven-development-and-ioc-containers.html</link><guid isPermaLink="false">287483:2929700:4148365</guid><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/nblumhardt/" target="_blank" class="offsite-link-inline"&gt;Nicholas Blumhardt&lt;/a&gt; has recently made an appearance on &lt;a href="http://www.dotnetrocks.com/" target="_blank" class="offsite-link-inline"&gt;.NET Rocks&lt;/a&gt; (that's the podcast I'm listening on a regular basis). The talk was extremely interesting - starting from &lt;a href="http://abdullin.com/autofac/"&gt;Autofac&lt;/a&gt; and going all the way to the component driven development philosophy.&lt;/p&gt;

&lt;p&gt;Let's try to reiterate and summarize some ideas about the Component Driven Development, IoC containers and evolving enterprise applications in general.&lt;/p&gt;

&lt;h1&gt;What is a component-driven development?&lt;/h1&gt;

&lt;p&gt;We could try to describe component-driven development as an approach in which code is fragmented into reusable and testable components that are combined together to form application foundation for delivering business functionality. The combination and management of components is generally delegated to &lt;a href="http://abdullin.com/wiki/inversion-of-control-ioc.html"&gt;Inversion of Control&lt;/a&gt; Container.&lt;/p&gt;

&lt;p&gt;A component itself is a class that implements some service contract and explicitly defines the dependencies that it needs in order to fulfill this contract. Actual implementation is hidden from everybody else outside the component.&lt;/p&gt;

&lt;p&gt;An example of component would be:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[Immutable]
public sealed class CustomerRepository : ICustomerRepository
{
  private readonly IDalSettings _dal;

  public CustomerRepository(IDalSettings dal)
  {
    _dal = dal;
  }

  public Guid CreateCustomer(Customer customer)
  {
    return _dal
      .CreateCommand(Queries.CreateCustomer)
      .With(() =&amp;gt; customer.Name)
      .With(() =&amp;gt; customer.CompanyUrl)
      .ExecuteAndReturn&amp;lt;Guid&amp;gt;();
  }

  Customer ICustomerRepository.GetCustomer(Guid customerID)
  {
    return _dal
      .CreateCommand(Queries.GetCustomer)
      .With(() =&amp;gt; customerID)
      .ExecuteAndReturn(Queries.CustomerSelector);
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;As you can see, component explicitly declares its dependency on the &lt;em&gt;IDalSettings&lt;/em&gt; and implements following service contract:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;public interface ICustomerRepository
{
  Guid CreateCustomer(Customer customer);
  Customer GetCustomer(Guid customerID);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Components tend to be rather concrete and stick to the single responsibility principle, where each class is dealing with a single and a rather specific task.&lt;/p&gt;

&lt;p&gt;I personally perceive components as low-level building blocks that are just one level higher than the language elements and elements from the Base Class Library of .NET. Or you could also look at the components as elements from the Domain Specific Class Library, that is unique to your specific domain.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Side note.&lt;/strong&gt; In reality, the boundary between these BCL and DSCLs is blurred a bit. This allows, for example, to move certain components from domain libraries (provided, these building blocks are abstracted and reusable enough) into libraries shared between multiple projects. Most of the time these components are about &lt;a href="http://abdullin.com/wiki/cross-cutting-concern.html"&gt;cross-cutting concerns&lt;/a&gt; of an application. An example of such a library would be &lt;a href="http://abdullin.com/shared-libraries/"&gt;Lokad.Shared library&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;These components are used to create a foundation for delivering an actual enterprise application. This foundation is established by wiring and configuring components together through an Inversion of Control (IoC) technology. 
&lt;a href="http://abdullin.com/wiki/inversion-of-control-ioc.html"&gt;
Inversion of Control&lt;/a&gt; Containers generally take care of various things, relieving us from the need to do them by hand. Examples of these things are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;injecting &lt;a href="http://abdullin.com/wiki/cross-cutting-concern.html"&gt;cross-cutting concerns&lt;/a&gt; into the application;&lt;/li&gt;
&lt;li&gt;managing life cycles of components and ensuring their deterministic disposal;&lt;/li&gt;
&lt;li&gt;handling dependency resolutions, wiring and configuration.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This forms the application infrastructure (almost an Infrastructure of Components) that could be used to deliver a variety of actual applications in the same domain.&lt;/p&gt;

&lt;p&gt;No matter, how we organize our components, there are a few common rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every component is registered in this infrastructure by a service contract, while the implementation specifics stay hidden from the higher logical levels and even neighboring components.&lt;/li&gt;
&lt;li&gt;Components declare their dependencies explicitly in the constructor (it is advised to avoid property injection, as it tends to complicate the interactions).&lt;/li&gt;
&lt;li&gt;Generally in .NET (although not always) components are sealed classes that do not inherit from any other base class, while implementing an interface or two. We are favoring composition here.&lt;/li&gt;
&lt;li&gt;Most of the time, components are immutable and are merely an object-oriented representation of a function, which receives (and memorizes) its parameters via the constructor.&lt;/li&gt;
&lt;li&gt;Additionally, it usually is a good practice to &lt;a href="http://stackoverflow.com/questions/143405/c-interfaces-implicit-and-explicit-implementation/143606#143606" target="_blank" class="offsite-link-inline"&gt;implement interfaces explicitly&lt;/a&gt; for IoC in .NET. This will reduce the temptation to use components directly, instead of referring to their service contracts (aside from the fact that explicitly implemented classes do not trigger "Missing XML documentation" warnings).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Logical encapsulation and reliance on the service contracts significantly simplifies code reuse and unit testing, thus promoting good development practices. It also increases flexibility, since you could rather easily substitute one component for another, as long as they both abide to the same contract.&lt;/p&gt;

&lt;h1&gt;Component Layers&lt;/h1&gt;

&lt;p&gt;Sometimes building blocks are logically organized into the layers in order to make application feel more simple and decoupled. This makes it more manageable and flexible in the long run. &lt;/p&gt;

&lt;p&gt;Components in one layer tend to share some common features for the services they are providing. Also they tend to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;be located in the same project and even namespace;&lt;/li&gt;
&lt;li&gt;have similar dependency requirements;&lt;/li&gt;
&lt;li&gt;use similar resources and libraries;&lt;/li&gt;
&lt;li&gt;be grouped within the same container if nested container hierarchy is used.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's have a look at a sample picture below:&lt;/p&gt;

&lt;p&gt;&lt;span class="full-image-block ssNonEditable"&gt;&lt;span&gt;&lt;img src="http://abdullin.com/storage/uploads/2009/06/2009-06-01_component_infrastructure.gif?__SQUARESPACE_CACHEVERSION=1243796831630" alt="Sample Component Infrastructure"/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;For example, DAL Layer is about basic components that provide raw access to the database, abstracting away configuration settings. They are consumed by other components implementing certain service contracts about persisting, querying and manipulating objects (that's the Repository Layer). Repositories could be consumed by the decorators that adhere to the same contracts but inject &lt;a href="http://abdullin.com/wiki/cross-cutting-concern.html"&gt;cross-cutting concerns&lt;/a&gt; along the way (most common are: performance monitoring and retrying on dead-lock and timeout exceptions).&lt;/p&gt;

&lt;p&gt;Repository interfaces could be exposed to the higher-level component layer within the infrastructure -  Service Layer. This layer, in its turn, would use these contracts to expose functionality for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;API adapters, exposing services provided by an application via WCF, SOAP, REST or whatever communication technology is being used (validation, paging, authentication and authorization concerns are injected along the way).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Web applications, providing human-manageable UI to work with the same services
Automation Engines, leveraging repository and service interfaces to provide some business functionality (notifications, workflows, external integration etc).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If we look at the component infrastructure from the perspective of the top-level consumer, then we will not see something solid. There is just a set of service contracts that are readily available to be consumed and used.&lt;/p&gt;

&lt;p&gt;We don't have to worry about relations and dependencies between the components, because IoC Container handles it all for us, while take care of complex object hierarhies and activation chains. More than that, logically we are not even able to care about such things, because the implementation and interface details are hidden from as as well.&lt;/p&gt;

&lt;p&gt;That's our highest level development language, if you wish. In it, every service contract represents some syntax element that could be combined with the others in order to deliver business functionality.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;That's the first article from the short series of two on Component-Driven Development. In the next one &lt;a href="http://abdullin.com/journal/2009/6/3/developing-component-driven-applications-powered-by-ioc-cont.html"&gt;I'll talk about some common strategies&lt;/a&gt; for developing greenfield applications CDD-style and migrating existing legacy applications towards the brigher Component-driven and IoC-powered future (which happens to have less development friction and consume less resources).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Meanwhile you can:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Check out the article on &lt;a href="http://abdullin.com/journal/2009/2/12/structuring-net-applications-with-autofac-ioc.html"&gt;Structuring .NET applications with Autofac IoC&lt;/a&gt; (which shares a lot in common).&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Take your time to listen to &lt;a href="http://www.dotnetrocks.com/default.aspx?showNum=450" target="_blank" class="offsite-link-inline"&gt;Nicholas Blumhardt on Autofac Show&lt;/a&gt;.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;a href="http://feeds.abdullin.com/RinatAbdullin"&gt;Subscribe to RSS feed&lt;/a&gt; to stay tuned.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Drop a line in the comments, sharing your feedback which is really important for me.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=r0aDBI_pPfQ:vz599XSHWU8:nQ_hWtDbxek"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?d=nQ_hWtDbxek" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=r0aDBI_pPfQ:vz599XSHWU8:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=r0aDBI_pPfQ:vz599XSHWU8:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=r0aDBI_pPfQ:vz599XSHWU8:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=r0aDBI_pPfQ:vz599XSHWU8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=r0aDBI_pPfQ:vz599XSHWU8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=r0aDBI_pPfQ:vz599XSHWU8:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=r0aDBI_pPfQ:vz599XSHWU8:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RinatAbdullin/~4/r0aDBI_pPfQ" height="1" width="1"/&gt;</description><wfw:commentRss>http://abdullin.com/journal/rss-comments-entry-4148365.xml</wfw:commentRss><feedburner:origLink>http://abdullin.com/journal/2009/5/31/component-driven-development-and-ioc-containers.html</feedburner:origLink></item><item><title>Maintenance and Monitoring Infrastructure for the Enterprise Software Systems</title><category>Articles</category><category>Integration</category><category>TechOverview</category><category>Theory</category><category>management</category><category>thoughts</category><dc:creator>Rinat Abdullin</dc:creator><pubDate>Mon, 18 May 2009 20:22:27 +0000</pubDate><link>http://feedproxy.google.com/~r/RinatAbdullin/~3/Ywkvsov8sDI/maintenance-and-monitoring-infrastructure-for-the-enterprise.html</link><guid isPermaLink="false">287483:2929700:4019626</guid><description>&lt;p&gt;&lt;em&gt;Enterprise application software systems&lt;/em&gt; are about the software that organizations buy or develop to &lt;strong&gt;solve their business specific problems&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Usually these systems start rather small. However, over the time they tend to grow more and more complex, increasing the number of subsystems involved and developing numerous interactions and synergy effects between them.&lt;/p&gt;

&lt;p&gt;For example, a company &lt;em&gt;SmartForce&lt;/em&gt; might get started with a simple intranet web site and a database behind it. That's the most common scenario of getting started with an in-house enterprise system, that I've seen. That's the easiest one, too.&lt;/p&gt;

&lt;p&gt;As the company evolves, so does the software solving its problems. So over the time complex business rules and long-running workflows might be added to our system of &lt;em&gt;SmartForce&lt;/em&gt;. These workflows might involve integrating with the external information systems or scheduling document processing for the nights. End-users might get interested in receiving custom notifications or scheduled tasks along the way. One of the most common implementations for this scenario (I'm generalizing here) is the introduction of automation server(s) to our web site deployment with a database backend.&lt;/p&gt;

&lt;p&gt;Then, the complexity of the enterprise software system might increase even further, as project stake-holders decide to introduce rich business functionality, integration with office tools or offline capabilities to the external client applications. This might lead us to Smart Client architecture implementations (whether they are done as desktop or browser-hosted applications). This kind of architectural change, generally requires some sort of the public API to be deployed. External integration scenarios also require such an API.&lt;/p&gt;

&lt;p&gt;The overall setup looks slightly more complex already. As if it were not enough, we might eventually get to the point of having multiple API versions to maintain and support (that's what usually happens to any API that is exposed to public).&lt;/p&gt;

&lt;p&gt;So the overall enterprise software architecture at this point might look like the one displayed on the picture below.&lt;/p&gt;

&lt;p&gt;&lt;span class="full-image-block ssNonEditable"&gt;&lt;span&gt;&lt;img src="http://abdullin.com/storage/uploads/2009/05/2009-05-18_223555.png?__SQUARESPACE_CACHEVERSION=1242679151594" alt=""/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Obviously, things might get a lot more complicated, but we are not showing them on the picture in order to keep it small and clear for the next part of the article. Yet, one can clearly imagine that the system might expand in size and complexity due to the following requirements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;introducing multiple file storage servers integrated into the system;&lt;/li&gt;
&lt;li&gt;handling the traffic spikes by setting up a few API endpoints and web servers;&lt;/li&gt;
&lt;li&gt;integrating automated issue reporting and deployment updates into the system;&lt;/li&gt;
&lt;li&gt;distributing CPU-intensive tasks between multiple automation servers (or even delegating these tasks to the cloud);&lt;/li&gt;
&lt;li&gt;provide additional setups of the entire infrastructure for people from development, QA and marketing to play with.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Such an enterprise software system definitely requires some efficient maintenance and health monitoring in order to function properly despite all the problems. &lt;/p&gt;

&lt;p&gt;By saying &lt;em&gt;efficient&lt;/em&gt; I mean maintenance that does not require having a dedicated team in order detect problems before they happen (that's when fixing them is most cheap), simplifies and speeds up the resolution of issues encountered. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Information is critical&lt;/strong&gt; for this kind of maintenance (you have to know all about your patient in order to keep him healthy). We need a deep insight into the system, information on its behavior and its deviations under different conditions (as we all know, &lt;strong&gt;production reality may be quite different from the development&lt;/strong&gt; despite all attempts to reproduce real-life stress and behavior profiles in testing scenarios).&lt;/p&gt;

&lt;p&gt;For example, we might need to know such basic things as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;uptime and failures of subsystems;&lt;/li&gt;
&lt;li&gt;CPU and memory consumption on the machines hosting subsystems;&lt;/li&gt;
&lt;li&gt;utilization levels of the services and resources that our infrastructure provides;&lt;/li&gt;
&lt;li&gt;repository (database) statistics and performance&lt;/li&gt;
&lt;li&gt;network latency and response times of the external services;&lt;/li&gt;
&lt;li&gt;various exceptions captured and handled (or unhandled, which should be a rather exceptional scenario) within the code, failed sanity checks and warnings from the internal subsystems;&lt;/li&gt;
&lt;li&gt;low-level performance indicators in the code-base (i.e.: execution time, counts or loads of various methods, number of database dead-locks encountered and resolved by the reliability layer, custom counters).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is not enough just to capture these indicators. If we want to be efficient we could also:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;persist indicators in the operations database in order to see how system performance evolves over the time;&lt;/li&gt;
&lt;li&gt;present the data in form of real-time reports, making it more easy to spot problems or check the state;&lt;/li&gt;
&lt;li&gt;create and receive custom notifications when certain indicators or their aggregations go outside their threshold. For example, system going offline should result in an immediate notification to all involved parties, while slight performance degradation is just worth mentioning in the daily report.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Obviously this entire setup has to be implemented in an efficient manner that allows to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;change any indicator threshold in minutes;&lt;/li&gt;
&lt;li&gt;modify or add report in minutes;&lt;/li&gt;
&lt;li&gt;automatically version and deploy all changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note, that when providing time estimates, I'm taking into the consideration just the human labor required for the change. Automated deployment processes on their own might take anywhere from 5 minutes and up to 24 hours. This depends on the change propagation policies and processes employed by the specific development infrastructure.&lt;/p&gt;

&lt;p&gt;Let's take our previous picture of the enterprise system composition and add maintenance-related subsystems and interactions to the mix. One of the possible results might look like this:&lt;/p&gt;

&lt;p&gt;&lt;span class="full-image-block ssNonEditable"&gt;&lt;span&gt;&lt;img src="http://abdullin.com/storage/uploads/2009/05/2009-05-18_223631.png?__SQUARESPACE_CACHEVERSION=1242679103690" alt=""/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Basically, at this point we are talking about the &lt;em&gt;infrastructure for performing system-wide maintenance and monitoring related tasks&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;This sample design works like this.&lt;/p&gt;

&lt;p&gt;Every primary subsystem exposes a standard monitoring API that could be used by the monitoring server to capture information. Internally every subsystem is instrumented with simple performance counters, capturing low-level execution (and failure) information and making it available via the monitoring interface API. &lt;/p&gt;

&lt;p&gt;Additionally, you may have your external client applications report exceptions directly to your issue management and monitoring systems.&lt;/p&gt;

&lt;p&gt;Maintenance monitor then aggregates all the information, applies any notification and warning rules available (some of these may result in notifications being sent out), runs custom reports and publishes them to the dashboard.&lt;/p&gt;

&lt;p&gt;That's not that hard to implement with existing open source tools. And having an ability to check how many seconds on the average does that complex repository call run against production db in real-time scenario - &lt;em&gt;makes you wonder how could you live without such functionality before&lt;/em&gt;. &lt;strong&gt;It is like the ReSharper addiction&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;By the way, it may seem logical to extend the picture above by adding the maintenance server that would:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;aggregate information from the monitoring subjects across the infrastructure;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;match that information with the development and deployment reports in order to provide better OLAP analysis of the infrastructure performance across the:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;resource consumption growth&lt;/strong&gt;: How do our subsystems handle spikes? Do we provide graceful degradation as resource consumption growth (or is it an exponential curve indicating some critical bottleneck that should be handled soon)?&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;development process&lt;/strong&gt;: How do new versions affect the overall performance? Do they improve or degrade it?&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Host and run SLA rules to watch for the resource consumption and provision/surrender resources depending on their consumption levels. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But that's another story, that gets closer to the topic of cloud bursting (aka using cloud computing provider to handle spikes in the resource consumption).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What do you think about this post?&lt;/em&gt;: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Do you have monitoring infrastructures in your enterprise application system?&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;If &lt;strong&gt;yes&lt;/strong&gt;, is your implementation different from the provided simple architecture? What would you like to add to it, if you were able to?&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;If &lt;strong&gt;not&lt;/strong&gt;, do you think, that it is worth having such an infrastructure?&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=Ywkvsov8sDI:JL0o_xolXOU:nQ_hWtDbxek"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?d=nQ_hWtDbxek" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=Ywkvsov8sDI:JL0o_xolXOU:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=Ywkvsov8sDI:JL0o_xolXOU:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=Ywkvsov8sDI:JL0o_xolXOU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=Ywkvsov8sDI:JL0o_xolXOU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=Ywkvsov8sDI:JL0o_xolXOU:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=Ywkvsov8sDI:JL0o_xolXOU:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RinatAbdullin/~4/Ywkvsov8sDI" height="1" width="1"/&gt;</description><wfw:commentRss>http://abdullin.com/journal/rss-comments-entry-4019626.xml</wfw:commentRss><feedburner:origLink>http://abdullin.com/journal/2009/5/18/maintenance-and-monitoring-infrastructure-for-the-enterprise.html</feedburner:origLink></item><item><title>Visual Studio 2008 Locks or Freezes in ASPX</title><category>Tips</category><category>VS2008</category><dc:creator>Rinat Abdullin</dc:creator><pubDate>Tue, 12 May 2009 09:22:17 +0000</pubDate><link>http://feedproxy.google.com/~r/RinatAbdullin/~3/om2TgzxEA8I/visual-studio-2008-locks-or-freezes-in-aspx.html</link><guid isPermaLink="false">287483:2929700:3956343</guid><description>&lt;p&gt;Sometimes Microsoft Visual Studio 2008 (SP1) might lock down either in Solution Explorer or when you try editing ASPX file. All mouse clicks will be followed by Windows beeping sound (the one when you try to click outside the dialog window). Attempts to close VS 2008 will display a warning about waiting for a modal window.&lt;/p&gt;

&lt;p&gt;There is one other small detail that identifies this specific problem: when Visual Studio hangs it happens to spawn a Setup process that never exits.&lt;/p&gt;

&lt;p&gt;This setup.exe is located in the following directory:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;C:\Program Files (x86)\Common Files\microsoft shared\
  OFFICE12\Office Setup Controller\Setup.exe
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Running the setup.exe with administrative privilegies was not of much help, but reinstalling Microsoft Office 2007 did fix the issue.&lt;/p&gt;

&lt;p&gt;Also if you get unexpected errors in Visual Studio 2008 while closing it or switching the window layout (this happens, for example, when you start debugging), then you've probably encountered "VS 2008 Layout bug".&lt;/p&gt;

&lt;p&gt;Clicking "Menu - Window - Reset Window Layout" could help.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=om2TgzxEA8I:R8pNrGuuRNU:nQ_hWtDbxek"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?d=nQ_hWtDbxek" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=om2TgzxEA8I:R8pNrGuuRNU:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=om2TgzxEA8I:R8pNrGuuRNU:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=om2TgzxEA8I:R8pNrGuuRNU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=om2TgzxEA8I:R8pNrGuuRNU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/RinatAbdullin?a=om2TgzxEA8I:R8pNrGuuRNU:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/RinatAbdullin?i=om2TgzxEA8I:R8pNrGuuRNU:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RinatAbdullin/~4/om2TgzxEA8I" height="1" width="1"/&gt;</description><wfw:commentRss>http://abdullin.com/journal/rss-comments-entry-3956343.xml</wfw:commentRss><feedburner:origLink>http://abdullin.com/journal/2009/5/12/visual-studio-2008-locks-or-freezes-in-aspx.html</feedburner:origLink></item></channel></rss>
