<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Software Rockstar &#187; Architecture</title>
	<atom:link href="http://www.softwarerockstar.com/tag/architecture/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.softwarerockstar.com</link>
	<description>Coaching and mentoring on a journey from a Developer to an IT Leader</description>
	<lastBuildDate>Tue, 13 Sep 2011 17:18:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Complex Object Mapping Using AutoMapper</title>
		<link>http://www.softwarerockstar.com/2011/05/complex-object-mapping-using-automapper/</link>
		<comments>http://www.softwarerockstar.com/2011/05/complex-object-mapping-using-automapper/#comments</comments>
		<pubDate>Tue, 31 May 2011 03:39:23 +0000</pubDate>
		<dc:creator>SoftwareRockstar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[Cool Tools]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[open source library]]></category>
		<category><![CDATA[property]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[target class]]></category>
		<category><![CDATA[target customer]]></category>
		<category><![CDATA[target object]]></category>
		<category><![CDATA[target objects]]></category>
		<category><![CDATA[type]]></category>

		<guid isPermaLink="false">http://www.softwarerockstar.com/?p=654</guid>
		<description><![CDATA[AutoMapper is an awesome open source library that allows automatic object-to-object mapping.  There are various getting-started blog posts and articles on the web (e.g. Getting Started Guide and AutoMapper on CodeProject) that will get you started with AutoMapper.  I was recently challenged with a particular situation using AutoMapper that wasn&#8217;t immediately clear and took me a little [...]]]></description>
			<content:encoded><![CDATA[<p><a title="AutoMapper on CodePlex" href="http://automapper.codeplex.com/" target="_blank">AutoMapper</a> is an awesome open source library that allows automatic object-to-object mapping.  There are various getting-started blog posts and articles on the web (e.g. <a title="AutoMapper Getting Started Guide" href="http://automapper.codeplex.com/wikipage?title=Getting%20Started" target="_blank">Getting Started Guide</a> and <a title="AutoMapper article on CodeProject" href="http://www.codeproject.com/KB/library/AutoMapper.aspx" target="_blank">AutoMapper on CodeProject</a>) that will get you started with AutoMapper.  I was recently challenged with a particular situation using AutoMapper that wasn&#8217;t immediately clear and took me a little investigating and some trial and error work, so I will share that with you.</p>
<p>My source object exposed some simple properties as well as a generic List property of another type.  My target object had same simple properties, but the generic List property was of an interface type.  Following is a simplified illustration of my source and target objects:</p>
<p><strong>Source Object</strong><br />
<img src="http://www.softwarerockstar.com/wp-content/uploads/2011/05/AutoMapper05302011-1.png" alt="" title="Source Object (AutoMapper Test)" width="434" height="165" class="aligncenter size-medium wp-image-666" /></p>
<p><strong>Target Object</strong><br />
<img src="http://www.softwarerockstar.com/wp-content/uploads/2011/05/AutoMapper05302011-2.png" alt="" title="Target Object (AutoMapper Test)" width="409" height="172" class="aligncenter size-medium wp-image-666" /></p>
<p>A cool thing about AutoMapper is that when it encounters a target object of an interface, it automatically generates a dynamic proxy class using <a title="Castle Project: Dynamic Proxy" href="http://www.google.com/url?sa=t&amp;source=web&amp;cd=1&amp;sqi=2&amp;ved=0CBkQFjAA&amp;url=http%3A%2F%2Fwww.castleproject.org%2Fdynamicproxy%2Findex.html&amp;ei=kVzkTcyxDJObtweUm4iABw&amp;usg=AFQjCNHpoXQLSB90Ql7zaGC1ARzW9PQWwA" target="_blank">Castle Dynamic Proxy</a>.  This is usually the desired behavior when mapping to a non-existent target class.  In my case, however, the target class already existed, and dynamic proxy was just an overhead.  I tinkered with AutoMapper mappings to actually map to my existing target rather than generating a proxy:</p>
<p><img src="http://www.softwarerockstar.com/wp-content/uploads/2011/05/AutoMapper05302011-3.png" alt="" title="Mapping (AutoMapper Test)" width="732" height="133" class="aligncenter size-medium wp-image-667" /></p>
<p>Essentially what I am doing in my mapping is to first create a map between my source and target Orders objects.  Once that&#8217;s done, I create a map between my source and target Customer objects but provide a custom map for the Orders property.  In my custom map I simply use AutoMapper to map my source Orders property to target Orders property using the map definition I provided earlier (lines 1-2 above).  This works out great and I get my expected target object without incurring the overhead of expensive proxies.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarerockstar.com/2011/05/complex-object-mapping-using-automapper/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>POCO in ADO.NET Entity Framework 4</title>
		<link>http://www.softwarerockstar.com/2011/01/poco-in-ado-net-entity-framework-4/</link>
		<comments>http://www.softwarerockstar.com/2011/01/poco-in-ado-net-entity-framework-4/#comments</comments>
		<pubDate>Tue, 18 Jan 2011 22:45:42 +0000</pubDate>
		<dc:creator>SoftwareRockstar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ADO.NET]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Change]]></category>
		<category><![CDATA[data access technologies]]></category>
		<category><![CDATA[Entity Framework]]></category>
		<category><![CDATA[entity models]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[loading]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[object relational mapping]]></category>
		<category><![CDATA[OOA/OOD]]></category>
		<category><![CDATA[OR/M]]></category>
		<category><![CDATA[oriented domain]]></category>
		<category><![CDATA[POCO]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[trivial data]]></category>

		<guid isPermaLink="false">http://www.softwarerockstar.com/?p=625</guid>
		<description><![CDATA[ADO.NET Entity Framework means many things to many people.  At it’s core, however, it allows for Object Relational Mapping (ORM) by providing a layer of abstraction between relational databases and Object Oriented domain objects. The first version of Entity Framework was introduced with .NET Framework 3.5 SP1 and Visual Studio 2008 SP1.  While the intention [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://msdn.microsoft.com/en-us/library/aa697427(v=vs.80).aspx">ADO.NET Entity Framework</a> means many things to many people.  At it’s core, however, it allows for Object Relational Mapping (ORM) by providing a layer of abstraction between relational databases and Object Oriented domain objects.</p>
<p>The first version of Entity Framework was introduced with .NET Framework 3.5 SP1 and Visual Studio 2008 SP1.  While the intention was great, most of everyone that I know, including my own self who have ever tried using EFv1 for anything except trivial data access have developed a love-and-hate relationship with it.  The first version looked great at first, but turned out to be an immature product at best with severe restrictions as well as quite a few bugs.</p>
<p>With .NET 4 Microsoft released a new version of Entity Framework that has addressed many of the issues and made it a much more stable technology.  Amongst other things, Microsoft heard developer community at large and provided POCO support in EFv4.</p>
<p><strong>POCO Support &#8211; At Last!</strong></p>
<p>The biggest problem with EFv1 was that the domain classes had to be tightly integrated with EF.  Essentially these classes were generated from entity models and developers had no control over code generation.  This limitation didn’t fly very well with most developers, since we like to keep our domain classes generic enough to where we can easily migrate them to any underlying data access technology.  This is especially true since the data access technologies tend to change every so often.</p>
<p>In EFv4 Microsoft has gone to great lengths to support Plain Old CLR Objects (POCO), which is just a fancy name for simple .NET classes with properties that can be used as Data Transfer Objects (DTO) or simply Domain Objects.</p>
<p><a href="http://en.wikipedia.org/wiki/Plain_Old_CLR_Object">POCO</a> classes can be handwritten and easily hooked in to EFv4.  Better yet, EFv4 allows us to generate these classes based on our entity models.  Also we have complete control over code generation since EFv4 uses <a href="http://msdn.microsoft.com/en-us/library/bb126445.aspx">T4 templates</a>.  Speaking of <a href="http://msdn.microsoft.com/en-us/library/bb126445.aspx">T4 templates</a>, they can also be used to generate <a href="http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontext.aspx">ObjectContext</a> classes for our entity models.</p>
<p><strong>Lazy Loading, Explicit Loading, and Eager Loading</strong></p>
<p>In EFv1 the only way to automatically load related entities was using eager loading.  Essentially eager loading is a <a href="http://www.google.com/url?sa=t&amp;source=web&amp;cd=1&amp;ved=0CCgQFjAA&amp;url=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Fnetframework%2Faa904594&amp;ei=JcY0Tb32HsqWhQfy69S9Cw&amp;usg=AFQjCNFXPCT1aJ1K461wVDeLDLlRwCB7Vw&amp;sig2=yZcOmHzhHUottOaC-SApQA">LINQ</a> technique that allows loading related entities in one shot using the Include method on the LINQ query.</p>
<p>EFv4 allows for lazy loading on POCO’s.  The only requirement for this added functionality is that navigation properties on POCO’s be marked as virtual and <a href="http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontextoptions.lazyloadingenabled.aspx">LazyLoadingEnabled</a> property of <a href="http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontextoptions.aspx">ObjectContextOptions</a> be set to true.  The way EFv4 does this is very cool.  Essentially it generates dynamic proxies overriding the virtual properties on POCO’s and uses those proxies instead of the POCO classes at runtime.</p>
<p>In addition to eager and lazy loading, EFv4 allows explicit loading of related entities.  Explicit loading allows us to explicitly load related entities on demand whenever the need arises.  Using explicit loading is as easy as calling the <a href="http://msdn.microsoft.com/en-us/library/dd382880.aspx">LoadProperty</a> method of the <a href="http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontext.aspx">ObjectContext</a> using  the parent entity as well as the navigation property name as parameters.</p>
<p><strong>Change Tracking</strong></p>
<p>EFv4 supports two different types of change tracking which are as follows:</p>
<p><strong>Snapshot Change Tracking</strong>.  Using this kind of change tracking is more efficient in most cases but it might require a few additional lines of code.  When using snapshot change tracking (default behavior in EFv4), the developer must make explicit call to <a href="http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontext.aspx">ObjectContext</a>’s <a href="http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontext.detectchanges.aspx">DetectChanges</a> method in order for the EF change tracker to notice any data that has been changed on the entity since it was first retrieved.  Also calling the <a href="http://www.google.com/url?sa=t&amp;source=web&amp;cd=1&amp;sqi=2&amp;ved=0CBMQFjAA&amp;url=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fbb336792.aspx&amp;ei=Kcc0TcoZg8yEB7fe0M8L&amp;usg=AFQjCNE7rfcpXzJatP4e27jk4gjOGewMGg&amp;sig2=xpf8b9OofvMUSm3GB8arTQ">SaveChanges</a> method of the context automatically detects any changes to entities involved.</p>
<p><strong>Real-time Change Tracking</strong>.  Using real-time change tracking the tracker keeps track of all data changes to entities in real-time.  For real-time change tracking to work for POCO’s, all properties of POCO’s should be marked as virtual.  Also any navigation properties should have return types of <a href="http://www.google.com/url?sa=t&amp;source=web&amp;cd=1&amp;ved=0CBYQFjAA&amp;url=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2F92t2ye13.aspx&amp;ei=vcc0TeGPL4uwhQfRl728Cw&amp;usg=AFQjCNH9Rx-AertMm5Z70BoXDKVKjEf7zg&amp;sig2=qZlGJ7KMoxVlnZnGtwxeLw">ICollection&lt;T&gt;</a>.  Once these two conditions are met, EFv4 automatically generates dynamic proxies and uses them instead of the POCO’s and tracks changes made to data contained within those entities in real time.</p>
<p><strong>Design Techniques</strong></p>
<p>EFv4 allows a couple of different design techniques that ought to satisfy most situations.</p>
<p><strong>Model First</strong>.  For new projects where that database design is not already set in stone or is non-existent, model-first approach is more natural to most developers and makes a lot of sense.  What this entails is that the developer creates an entity model using the <a href="http://www.google.com/url?sa=t&amp;source=web&amp;cd=1&amp;ved=0CBoQFjAA&amp;url=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fcc716685.aspx&amp;ei=K8g0TYjSF4GGhQebm-CYCw&amp;usg=AFQjCNEisyxXXpKQ55JXj6LiDlN9upsjXg&amp;sig2=jiah8MV9pRlpkhyEbdcjLA">Entity Model Designer</a> for the domain objects involved.  This model can be easily changed during the design phase or the early development stages.  Once the architect/developer is happy with the entity design, he/she can use EFv4 to generate the data model using EFv4’s Data Definition Language (DDL) generation capabilities.  Not only that this is a more natural way of designing data access and domain model for a given solution, it’s more agile in that the model can easily be modified using a GUI tool.  Also as long as the underlying database is supported by EFv4, the developer need not worry about the exact syntax of the DDL as it can automatically be generated.  Once again the generation of DDL can be influenced using <a href="http://msdn.microsoft.com/en-us/library/bb126445.aspx">T4 templates</a>.</p>
<p><strong>Database First</strong>.  This technique is more suitable for when a project involves an existing database.  In such cases EF can easily generate domain models based on database schema.  This design technique is not new to EFv4 as it has been available since the first version of EF and this is probably what most of us are most familiar with.</p>
<p><strong>Code Only</strong>.  EFv4 introduced another design technique which requires no models to be created.  Essentially there are only code classes and EF infers the model from them.  Entire database including all required tables can be generated by EF at run-time.</p>
<p>There’s a lot more to EFv4.  What I have covered in this article only addresses a bit of POCO support in EFv4 since that has been the number 1 request of the development community since EFv1 was released.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarerockstar.com/2011/01/poco-in-ado-net-entity-framework-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simplify N-tier Development with WCF RIA Services</title>
		<link>http://www.softwarerockstar.com/2011/01/simplify-n-tier-development-with-wcf-ria-services/</link>
		<comments>http://www.softwarerockstar.com/2011/01/simplify-n-tier-development-with-wcf-ria-services/#comments</comments>
		<pubDate>Fri, 14 Jan 2011 18:59:36 +0000</pubDate>
		<dc:creator>SoftwareRockstar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[automatic batch]]></category>
		<category><![CDATA[batch updates]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[data validation]]></category>
		<category><![CDATA[developmentor]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Studio]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[tier]]></category>
		<category><![CDATA[tier development]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://www.softwarerockstar.com/?p=619</guid>
		<description><![CDATA[Last night I was at Dallas .NET User Group meeting where Tony Sneed of DevelopMentor made a presentation on WCF RIA Services called &#8220;Turbocharge Silverlight Development with WCF RIA Services&#8220;. I had read about this new technology before, but never had the time to play with it. The presentation turned out to be pretty cool. [...]]]></description>
			<content:encoded><![CDATA[<p>Last night I was at Dallas .NET User Group meeting where <a title="Tony Sneed's Blog" href="http://blog.tonysneed.com/" target="_blank">Tony Sneed</a> of <a title="DevlopMentor Home Page" href="http://www.develop.com/" target="_blank">DevelopMentor</a> made a presentation on <a title="WCF RIA Services Home Page" href="http://msdn.microsoft.com/en-us/library/ee707344(v=vs.91).aspx" target="_blank">WCF RIA Services</a> called &#8220;<a href="http://blog.tonysneed.com/2011/01/06/wcf-ria-services-talk/" target="_blank">Turbocharge Silverlight Development with WCF RIA Services</a>&#8220;.  I had read about this new technology before, but never had the time to play with it.</p>
<p>The presentation turned out to be pretty cool.  I think WCF RIA Services provides a very neat way to design n-tier apps without much hassle as it takes care of much of the heavy lifting for you providing very easy data validation, authentication, and role-based security amongst other awesomeness.  Also through code projection it automatically allows shared code between UI and the service tier, which makes it easy to write code once and use it cross-tier.  While WCF RIA Services can be used with any front-end, e.g. WinForms and ASP.NET, it really shines when combined with a Silverlight front-end.  The best part of the technology is automatic batch updates, which is really neat.</p>
<p><strong>Download and Install</strong></p>
<ol>
<li>Install WCF RIA Services for Silverlight 4
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=177508">Install WCF RIA Services</a> for Silverlight 4 and Visual Studio 2010</li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=185121">Install the WCF RIA Services Toolkit</a></li>
<li>If you already have the Silverlight 4 Tools and Visual Studio 2010 installed you can <a href="http://go.microsoft.com/fwlink/?LinkID=169231">download WCF RIA Services V1.0 directly</a></li>
</ul>
</li>
<li>Install WCF RIA Services SP1 Beta for Silverlight 4
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=205085">Install WCF RIA Services</a> SP1 Beta for Silverlight 4 and Visual Studio 2010</li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=205088">Install the WCF RIA Services December 2010 Toolkit</a> for WCF RIA Services SP1 Beta</li>
</ul>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarerockstar.com/2011/01/simplify-n-tier-development-with-wcf-ria-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learn ASP.NET MVC</title>
		<link>http://www.softwarerockstar.com/2009/03/learn-aps-net-mvc/</link>
		<comments>http://www.softwarerockstar.com/2009/03/learn-aps-net-mvc/#comments</comments>
		<pubDate>Sat, 14 Mar 2009 05:38:00 +0000</pubDate>
		<dc:creator>SoftwareRockstar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[application from scratch]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[downloadable ebook]]></category>
		<category><![CDATA[eBook]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[Nerddinner]]></category>
		<category><![CDATA[PDF]]></category>

		<guid isPermaLink="false">http://mharoon.wordpress.com/2009/03/13/learn-aps-net-mvc/</guid>
		<description><![CDATA[ScottGu  just made available a free downloadable eBook in PDF format as well as a simple and easy-to-understand sample project called Nerddinner. The eBook is actually a chapter from his upcoming book on MVC, but it is an end-to-end tutorial that walks through building a small but complete ASP.NET MVC application from scratch. Download eBook. [...]]]></description>
			<content:encoded><![CDATA[<div class="imageleft"><a href="http://www.amazon.com/gp/product/0470384611?ie=UTF8&amp;tag=softwrocks-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0470384611"><img style="border: 0px;" src="http://ecx.images-amazon.com/images/I/41vsFoLZq9L._BO2,204,203,200_PIsitb-sticker-arrow-big-search,TopRight,35,-76_AA240_SH20_OU01_.jpg" border="0" alt="" width="216" height="216" /></a><img style="border:none !important; margin:0px !important;" src="http://www.assoc-amazon.com/e/ir?t=softwrocks-20&amp;l=as2&amp;o=1&amp;a=0470384611" border="0" alt="" width="1" height="1" /></div>
<p>ScottGu  just made available a free downloadable eBook in PDF format as well as a simple and easy-to-understand sample project called Nerddinner.</p>
<p>The eBook is actually a chapter from his upcoming book on MVC, but it is an end-to-end tutorial that walks through building a small but complete ASP.NET MVC application from scratch.</p>
<p><a href="http://aspnetmvcbook.s3.amazonaws.com/aspnetmvc-nerdinner_v1.pdf" target="_blank">Download eBook</a>.</p>
<p><a href="http://nerddinner.codeplex.com/" target="_blank">Download Nerddinner sample code</a>.</p>
<p><a href="http://www.amazon.com/gp/product/0470384611?ie=UTF8&amp;tag=softwrocks-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0470384611">Buy ASP.NET MVC 1.0 Book at Amazon.com</a>. </p>
<p>If you do decide to read this book, please do not forget to share your thoughts with me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarerockstar.com/2009/03/learn-aps-net-mvc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Castle Project</title>
		<link>http://www.softwarerockstar.com/2007/08/the-castle-project/</link>
		<comments>http://www.softwarerockstar.com/2007/08/the-castle-project/#comments</comments>
		<pubDate>Fri, 17 Aug 2007 20:37:00 +0000</pubDate>
		<dc:creator>SoftwareRockstar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[article series]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[castle project]]></category>
		<category><![CDATA[Design Principles]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[inversion of control]]></category>
		<category><![CDATA[ioc]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[OOA/OOD]]></category>

		<guid isPermaLink="false">http://mharoon.wordpress.com/2007/08/17/the-castle-project/</guid>
		<description><![CDATA[In the last couple of years I have noticed a steadily growing interest in the .NET community around the&#160;Inversion of Control (IoC) and Dependency Injection (DI) patterns.&#160; This is partly due to the fact that a number of excellent frameworks have emerged and gained popularity that allow us to use these designs in our applications [...]]]></description>
			<content:encoded><![CDATA[<div class="imageleft"><img src="http://softwarerockstar.com/wp-content/uploads/2007/08/castleinabox1.gif" alt="Castle Project" title="Castle Project" width="191" height="108" /></div>
<p>In the last couple of years I have noticed a steadily growing interest in the .NET community around the&nbsp;<a href="http://en.wikipedia.org/wiki/Inversion_of_control">Inversion of Control (IoC)</a> and <a href="http://en.wikipedia.org/wiki/Dependency_injection">Dependency Injection (DI)</a> patterns.&nbsp; This is partly due to the fact that a number of excellent frameworks have emerged and gained popularity that allow us to use these designs in our applications relatively painlessly.&nbsp; One such framework is the open source <a href="http://www.castleproject.org/">Castle Project</a>.&nbsp; In my opinion <a href="http://www.castleproject.org/">Castle</a> is the best implementation of IoC and DI among many others that I have come across including <a href="http://www.springframework.net/">Spring.NET</a>, <a href="http://ninject.org/">NInject</a>, and&nbsp;<a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=ObjectBuilder">ObjectBuilder</a>.&nbsp; This is however my opinion; which framework you use largely depends upon your requirements and your preferences.</p>
<p>If you are just getting started with Castle or are curious about why the heck one should use IoC and DI, I strongly suggest you check out the <a href="http://dotnetslackers.com/articles/designpatterns/InversionOfControlAndDependencyInjectionWithCastleWindsorContainerPart1.aspx">3-part article series</a> by&nbsp;<a href="http://dotnetslackers.com/community/blogs/simoneb">Simone Busoli</a>.&nbsp; I just came across <a href="http://dotnetslackers.com/articles/designpatterns/InversionOfControlAndDependencyInjectionWithCastleWindsorContainerPart1.aspx">these articles</a> and I can&#8217;t stress enough how well they are written.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarerockstar.com/2007/08/the-castle-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ISP: Interface Segregation Principle</title>
		<link>http://www.softwarerockstar.com/2006/08/isp-interface-segregation-principle/</link>
		<comments>http://www.softwarerockstar.com/2006/08/isp-interface-segregation-principle/#comments</comments>
		<pubDate>Tue, 29 Aug 2006 00:10:00 +0000</pubDate>
		<dc:creator>SoftwareRockstar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Design Principles]]></category>
		<category><![CDATA[OOA/OOD]]></category>

		<guid isPermaLink="false">http://mharoon.wordpress.com/2006/08/28/isp-interface-segregation-principle/</guid>
		<description><![CDATA[The Interface Segregation Principle (ISP) deals with cohesion and is closely related to the Single Responsibility Principle (SRP). In Uncle Bob&#8217;s terms, the ISP states that: Clients should not be forced to depend on methods that they do not use. In other words, this principle states that if a class performs multiple functions that may [...]]]></description>
			<content:encoded><![CDATA[<p>The Interface Segregation Principle (ISP) deals with <a href="http://en.wikipedia.org/wiki/Cohesion_(computer_science)">cohesion</a> and is closely related to the <a href="http://mfharoon.blogspot.com/2006/08/srp-single-responsibility-principle.html">Single Responsibility Principle (SRP)</a>. In <a href="http://www.objectmentor.com/resources/articles/isp.pdf">Uncle Bob&#8217;s terms</a>, the ISP states that:</p>
<blockquote><p>Clients should not be forced to depend on methods that they do not use.</p></blockquote>
<p>In other words, this principle states that if a class performs multiple functions that may be used by different client classes, then those functions should be seperated out into different interfaces according to their usage.</p>
<p>The idea behind this principle is to confine the aount of rework to only clients that use a certain interface, should the interface of a depended-upon class changes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarerockstar.com/2006/08/isp-interface-segregation-principle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WWF 101: Introduction to Windows Workflow Foundation</title>
		<link>http://www.softwarerockstar.com/2006/08/wwf-101-introduction-to-windows-workflow-foundation/</link>
		<comments>http://www.softwarerockstar.com/2006/08/wwf-101-introduction-to-windows-workflow-foundation/#comments</comments>
		<pubDate>Mon, 28 Aug 2006 22:57:00 +0000</pubDate>
		<dc:creator>SoftwareRockstar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[composite activities]]></category>
		<category><![CDATA[conditional logic]]></category>
		<category><![CDATA[declarative model]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[platform]]></category>
		<category><![CDATA[sql server dts]]></category>
		<category><![CDATA[using biztalk server]]></category>
		<category><![CDATA[WF]]></category>
		<category><![CDATA[WinFX (.NET 3.0)]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://mharoon.wordpress.com/2006/08/28/wwf-101-introduction-to-windows-workflow-foundation/</guid>
		<description><![CDATA[Windows Workflow Foundation (WF) is Microsoft&#8217;s latest platform for building workflow-enabled applications. Along with Windows Presentation Foundation (WPF) and Windows Communication Foundation (WCF), WF is part of the WinFX platform, now officially named as .NET Framework 3.0. While workflow capability has been available to developers using BizTalk Server and other third-party products, WF provides a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://wf.netfx3.com/">Windows Workflow Foundation</a> (WF) is Microsoft&#8217;s latest platform for building <a href="http://en.wikipedia.org/wiki/Workflow">workflow-enabled</a> applications. Along with <a href="http://wpf.netfx3.com/">Windows Presentation Foundation (WPF)</a> and <a href="http://mfharoon.blogspot.com/2006/08/wcf-101-introduction-to-windows.html">Windows Communication Foundation (WCF)</a>, WF is part of the WinFX platform, now officially named as .NET Framework 3.0.</p>
<p>While workflow capability has been available to developers using <a href="http://www.microsoft.com/biztalk/">BizTalk Server</a> and other third-party products, WF provides a single platform and programming model for Microsoft products (e.g. <a href="http://office.microsoft.com/">Office</a>) and non-Microsoft products (developed using <a href="http://microsoft.com/net">.NET</a>) making workflow more of a mainstream paradigm.</p>
<p>In it&#8217;s simplest form, the workflow-based programming model consists of a set of business activities along with repetition and conditional logic that is modelled using some sort of a user interface. At run-time, the conditionals are evaluated and activities are executed based on the modelled workflow. If you have ever created a SQL Server <a href="http://www.sqldts.com/default.aspx">DTS </a>or <a href="http://msdn.microsoft.com/SQL/bi/integration/">SSIS</a> package then you are already familiar with workflow-based programming model.</p>
<p>Some of the advantages of workflow-based programming include durability, transparency, and tolerance to dynamic change. It allows for rule-based programming and supports a declarative model which allows for easy modelling and modification of business processes.</p>
<p>WF nicely integrates into <a href="http://msdn.microsoft.com/vstudio/">Visual Studio</a> offering a rich design-time and debugging environment. Workflows can be hosted by any .NET executable assemblies including Win Forms and ASP.NET applications. WF comes with an array of built-in activities e.g. Code, Delay, Invoke, Throw, Suspend, etc., but the best part is that custom activities can be created as simply as deriving from the Activity base class and overriding the Execute method. Even composite activities can be created providing a rich and extensible programming model.</p>
<p>The Activity Framework in WF provides several of out-of-the-box services such as transactions, compensation, serialization, etc. Other services can be added as desired. For example, by default workflows are persisted using <a href="http://www.xaml.net/">XAML</a>, but if needed custom serialization may be added.</p>
<p>In conclusion, WF provides a very rich and highly extensible workflow-based programming model. With the passage of time we shall witness more and more Microsoft and non-Microsoft products using the WF to build and enhance applications that could use workflow functionality in new and innovative ways. As they say in French, <em>the best is yet to come!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarerockstar.com/2006/08/wwf-101-introduction-to-windows-workflow-foundation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WCF 101: Introduction to Windows Communication Foundation</title>
		<link>http://www.softwarerockstar.com/2006/08/wcf-101-introduction-to-windows-communication-foundation/</link>
		<comments>http://www.softwarerockstar.com/2006/08/wcf-101-introduction-to-windows-communication-foundation/#comments</comments>
		<pubDate>Mon, 28 Aug 2006 00:08:00 +0000</pubDate>
		<dc:creator>SoftwareRockstar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[.NET Remoting]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[WinFX (.NET 3.0)]]></category>

		<guid isPermaLink="false">http://mharoon.wordpress.com/2006/08/27/wcf-101-introduction-to-windows-communication-foundation/</guid>
		<description><![CDATA[Windows Communication Foundation (WCF) is Microsoft&#8217;s next generation platform for distributed systems. Along with Windows Presentation Foundation (WPF) and Windows Workflow Foundation (WWF), WCF (code-named &#8220;Indigo&#8221;) is part of the WinFX platform, now officially named as .NET Framework 3.0. With such a diverse array of distributed technologies already floating around, each one with a distinct [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://wcf.netfx3.com/">Windows Communication Foundation</a> (WCF) is Microsoft&#8217;s next generation platform for <a href="http://en.wikipedia.org/wiki/Client-server_architecture">distributed systems</a>. Along with <a href="http://wpf.netfx3.com/">Windows Presentation Foundation (WPF)</a> and <a href="http://msdn.microsoft.com/workflow/">Windows Workflow Foundation (WWF)</a>, WCF (code-named &#8220;Indigo&#8221;) is part of the WinFX platform, now officially named as .NET Framework 3.0.</p>
<p>With such a diverse array of distributed technologies already floating around, each one with a distinct benefit, Microsoft decided to unify these technologies under a single unified platform that would not only simply developers&#8217; lives but also pull in the benefits of all such existing technologies into one.</p>
<p><a href="http://msdn.microsoft.com/webservices/">ASP.NET web services</a>, for example, offer ease of programability, <a href="http://msdn.microsoft.com/webservices/webservices/building/wse/">WSE</a> offers security, <a href="http://msdn2.microsoft.com/en-us/library/system.messaging.aspx">System.Messaging</a> offers guaranteed delivery of asynchronous messages, <a href="http://msdn2.microsoft.com/en-us/library/system.enterpriseservices.aspx">Enterprise Services</a> offers attribute based transaction support, and yet <a href="http://msdn.microsoft.com/webservices/remoting/default.aspx">.NET Remoting</a> offers transparent use of objects. WCF unifies all these benefits and more such that the code base remains the same, while depending upon the requirements, features such as transactions can be configured mostly through XML configuration settings.</p>
<p>WCF is based on Microsoft&#8217;s vision of <a href="http://en.wikipedia.org/wiki/Client/SOA">Service Oriented Architecture (SOA)</a>, where developers shall be able to combine multiple services (could be cross-platform and cross-vendor) to invent software applications that have not yet been possible.</p>
<p>WCF is based on a well-thought-out design where services and clients define one or more end-points. Each end-point defines the address, binding, and contract (ABC) which can be configured independently, but work together to provide a distributed message-oriented communication infrastructure.</p>
<p>WCF runs on <a href="http://www.microsoft.com/windowsvista/">Windows Vista</a>, <a href="http://www.microsoft.com/windowsxp/">XP</a> and <a href="http://www.microsoft.com/windowsserver2003/default.mspx">2003</a>. Beta versions of .NET Framework 3.0 (including WCF) can be downloaded from <a href="http://msdn.microsoft.com/windowsvista/downloads/products/getthebeta/default.aspx">Microsoft</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarerockstar.com/2006/08/wcf-101-introduction-to-windows-communication-foundation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DIP: Dependency Inversion Principle</title>
		<link>http://www.softwarerockstar.com/2006/08/dip-dependency-inversion-principle/</link>
		<comments>http://www.softwarerockstar.com/2006/08/dip-dependency-inversion-principle/#comments</comments>
		<pubDate>Sun, 27 Aug 2006 13:58:00 +0000</pubDate>
		<dc:creator>SoftwareRockstar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[business entities]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[default implementation]]></category>
		<category><![CDATA[definition]]></category>
		<category><![CDATA[Design Principles]]></category>
		<category><![CDATA[domino effect]]></category>
		<category><![CDATA[level modules]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[OOA/OOD]]></category>
		<category><![CDATA[Principle]]></category>
		<category><![CDATA[principle deals]]></category>
		<category><![CDATA[Uncle]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://mharoon.wordpress.com/2006/08/27/dip-dependency-inversion-principle/</guid>
		<description><![CDATA[The Dependency Inversion Principle deals with how to correctly design classes such that their dependency on one another causes the least amount of work in case of a change. Uncle Bob&#8217;s definition of DIP states: High-level modules should not depend on low-level modules. Both should depend on abstractions. Abstractions should not depend on details. Details [...]]]></description>
			<content:encoded><![CDATA[<p>The Dependency Inversion Principle deals with how to correctly design classes such that their dependency on one another causes the least amount of work in case of a change. <a href="http://www.objectmentor.com/resources/articles/dip.pdf">Uncle Bob&#8217;s definition</a> of DIP states:</p>
<blockquote>
<ul>
<li>High-level modules should not depend on low-level modules. Both should depend on abstractions.</li>
<li>Abstractions should not depend on details. Details should depend on abstractions.</li>
</ul>
</blockquote>
<p>Essentially what this principle means is that in a tiered design, higher level modules and lower level modules should not directly depend on each other; instead they should only depend on <a href="http://en.wikipedia.org/wiki/Abstraction">abstractions</a>. Moreover, abstractions should not have any knowledge of details (other classes in the system).</p>
<p>This principle closely relates to <a href="http://mfharoon.blogspot.com/search?label=Design+Principles">some of the other design principles</a> I discussed previously in that it yields a design that is highly decoupled ensuring that minor changes in one part of the application do not cause a domino effect in other parts of the application. Moreover such a design is extensible &#8212; as new business entities are added, usually such as design scales well by requiring only new code to be added rather than existing code to be modified.  ASP.NET 2.0&#8242;s <a href="http://aspnet.4guysfromrolla.com/articles/101905-1.aspx">Provider Model</a> is a great example of such a design that provides a default implementation for various sub-systems such as Membership, Personalization, Navigation, etc. but also allows developers to modify the default behavior by extending certain classes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarerockstar.com/2006/08/dip-dependency-inversion-principle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LSP: Liskov Substitution Principle</title>
		<link>http://www.softwarerockstar.com/2006/08/lsp-liskov-substitution-principle/</link>
		<comments>http://www.softwarerockstar.com/2006/08/lsp-liskov-substitution-principle/#comments</comments>
		<pubDate>Thu, 24 Aug 2006 00:23:00 +0000</pubDate>
		<dc:creator>SoftwareRockstar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[Design Principles]]></category>
		<category><![CDATA[liskov substitution principle]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[mortgage account]]></category>
		<category><![CDATA[mortgage business]]></category>
		<category><![CDATA[new mortgage]]></category>
		<category><![CDATA[OOA/OOD]]></category>
		<category><![CDATA[public abstract void]]></category>
		<category><![CDATA[teller]]></category>
		<category><![CDATA[void]]></category>

		<guid isPermaLink="false">http://mharoon.wordpress.com/2006/08/23/lsp-liskov-substitution-principle/</guid>
		<description><![CDATA[The Liskov Substitution Principle dictates when and where it is correct to derive a subtype from an existing supertype. As defined by Barbara Liskov and Jeannette Wing, it essentially states that: Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where [...]]]></description>
			<content:encoded><![CDATA[<p>The Liskov Substitution Principle dictates when and where it is correct to derive a <a href="http://en.wikipedia.org/wiki/Subtype">subtype</a> from an existing supertype.  As defined by <a href="http://www.pmg.csail.mit.edu/~liskov/">Barbara Liskov</a> and Jeannette Wing, it essentially states that:</p>
<blockquote><p>Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.</p></blockquote>
<p>What it means is that if S is a subtype of T, then a function q(x) must behave in the same manner irrespective of the type of x whether it be S or T.  In other words, if a piece of code behaves differently for a subtype than a supertype, then that code violates the LSP (and consequently the OCP).</p>
<p>Let&#8217;s say that we work for a bank and that we have a simple teller application.  Currently the teller application works with checking and savings account types.</p>
<pre class="brush: csharp">
public abstract class Account
{
    public abstract double CurrentBalance { get; }
    public abstract void Deposit(double amount);
}

public class CheckingAccount : Account
{
    private double _currentBalance;

    public override double CurrentBalance
    {
        get { return _currentBalance; }
    }

    public override void Deposit(double amount)
    {
        _currentBalance += amount;
    }
}

public class SavingsAccount : Account
{
    /* Savings account implementation */
}
</pre>
<p>Our bank just entered the mortgage business so we need to modify our teller application to support this new account type.  During the short analysis phase we decide that since mortgage account is type of an account (IS-A relationship), we can simply create a new mortgage class deriving from the Account abstract class, override a method and a property, and we should be in business.  We add a new class as follows:</p>
<pre class="brush: csharp">
public class MortgageAccount : Account
{
    private double _currentBalance;

    public override double CurrentBalance
    {
        get { return _currentBalance; }
    }

    public override void Deposit(double amount)
    {
        _currentBalance -= amount;
    }
}
</pre>
<p>Everything sounds logical, that is until we come across this code in the teller application:</p>
<pre class="brush: csharp">
public class Bank
{
    public void ReceiveMoney(Account account, double amount)
    {
        double oldBalance = account.CurrentBalance;
        account.Deposit(amount);
        Debug.Assert(account.CurrentBalance = oldBalance + amount);
    }
}
</pre>
<p>Based on our pre-existing code, the ReceiveMoney() method is making a reasonable assumption that the new balance should be equal to the old balance plus the newly deposited amount.  This assumption is, however, violated if we pass an instance of the Mortgage class to this method.  This is a clear violation of the LSP.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarerockstar.com/2006/08/lsp-liskov-substitution-principle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

