<?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>ganshani.com &#187; best practices</title>
	<atom:link href="http://www.ganshani.com/tag/best-practices/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ganshani.com</link>
	<description>Puneet Ghanshani - .NET, Silverlight, Sharepoint Articles, Blogs, Poems, Photograph</description>
	<lastBuildDate>Sat, 24 Apr 2010 10:17:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Silverlight 2 Best Practices &#8211; IV</title>
		<link>http://www.ganshani.com/2009/07/13/silverlight-2-best-practices-iv/</link>
		<comments>http://www.ganshani.com/2009/07/13/silverlight-2-best-practices-iv/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 11:00:17 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[Microsoft .NET]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[best practices]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=220</guid>
		<description><![CDATA[
			
				
			
		
This is in continuation to my previous post Silverlight 2 Best Practices – III, where the focus was what should be and what should not be done while developing a Silverlight Application. It was purely from a developer’s perspective.  In this post, we would consider designing the ‘Data Access Layer’ 
Designing Data Access Layer
In most [...]


<h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/07/10/silverlight-2-best-practices-ii/' rel='bookmark' title='Permanent Link: Silverlight 2 Best Practices &#8211; II'>Silverlight 2 Best Practices &#8211; II</a></li>
<li><a href='http://www.ganshani.com/2009/07/09/silverlight-2-best-practices-i/' rel='bookmark' title='Permanent Link: Silverlight 2 &#8211; Best Practices &#8211; I'>Silverlight 2 &#8211; Best Practices &#8211; I</a></li>
<li><a href='http://www.ganshani.com/2008/06/19/silverlight-20-advantages-limitations-tools/' rel='bookmark' title='Permanent Link: Silverlight 2.0 &#8211; Advantages, Limitations &#038; Tools'>Silverlight 2.0 &#8211; Advantages, Limitations &#038; Tools</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2009%2F07%2F13%2Fsilverlight-2-best-practices-iv%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2009%2F07%2F13%2Fsilverlight-2-best-practices-iv%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p class="MsoNormal" style="margin: 0in 0in 10pt;"><em style="mso-bidi-font-style: normal;"><span style="line-height: 115%; font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; color: #0000cc; font-size: 10pt; mso-bidi-font-size: 11.0pt;">This is in continuation to my previous post </span></em><em style="mso-bidi-font-style: normal;"><span style="line-height: 115%; font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; color: #006600; font-size: 10pt; mso-bidi-font-size: 11.0pt;"><a href="http://www.ganshani.com/2009/07/10/silverlight-2-best-practices-iii/"><span style="color: #006600;">Silverlight 2 Best Practices – III</span></a></span></em><em style="mso-bidi-font-style: normal;"><span style="line-height: 115%; font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; color: #0000cc; font-size: 10pt; mso-bidi-font-size: 11.0pt;">, where the focus was what should be and what should not be done while developing a Silverlight Application. It was purely from a developer’s perspective.<span style="mso-spacerun: yes;">  </span>In this post, we would consider designing the ‘Data Access Layer’ </span></em></p>
<p class="MsoNormal" style="margin: 0in 0in 10pt;"><strong style="mso-bidi-font-weight: normal;"><span style="font-size: small;"><span style="font-family: Calibri;">Designing Data Access Layer</span></span></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 10pt;"><span style="font-family: Calibri; font-size: small;">In most of the web applications, data access layer comprises of 3 components: </span></p>
<ul style="margin-top: 0in;" type="disc">
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-list: l0 level1 lfo1;"><span style="font-family: Calibri; font-size: small;">Utilities – that help in accessing data components. Example, converters and alike </span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-list: l0 level1 lfo1;"><span style="font-family: Calibri; font-size: small;">Data components – core components that access the data sources</span></li>
<li class="MsoNormal" style="text-align: justify; line-height: normal; margin: 0in 0in 0pt; mso-list: l0 level1 lfo1;"><span style="font-family: Calibri; font-size: small;">Service Agents – this is an additional layer (proxies) over the services that are called from DAL. Mostly done to bring an additional isolation, entity mapping, or service-specific conversions.</span></li>
</ul>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;"> </span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;">Here, we will concentrate on ‘Data Components’ as the other two components are relatively easier to design and readily available as well or tools can generate them too.</span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;"> </span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><strong style="mso-bidi-font-weight: normal;"><span style="font-size: small;"><span style="font-family: Calibri;">Managing Connections</span></span></strong></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><strong style="mso-bidi-font-weight: normal;"><span style="font-family: Calibri; font-size: small;"> </span></strong></p>
<p class="MsoNormal" style="text-align: justify; line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;">Which connection remains open/closed should be monitored by a single interface. All calls should be redirected to a single function which would manage opening, closing of a connection and its timeout. <span style="mso-spacerun: yes;"> </span>Connections can be cached for smallest duration of time to increase performance – however, security should of sensitive information like hostname, password should be taken care of as well.</span></p>
<p class="MsoNormal" style="text-align: justify; line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;"> </span></p>
<p class="MsoNormal" style="text-align: justify; line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;">The application should also take care that the fan-out does not reach.<span style="mso-spacerun: yes;">  </span>This will ensure that no user gets a timeout error.</span></p>
<p class="MsoNormal" style="text-align: justify; line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;"> </span></p>
<p class="MsoNormal" style="text-align: justify; line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;">Design should enable switching between two replicas of data sources. This is most important during maintenance shutdown, or release of a newer version of application, or when database crashes.</span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;"> </span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><strong style="mso-bidi-font-weight: normal;"><span style="font-size: small;"><span style="font-family: Calibri;">Exception Handling </span></span></strong></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;"> </span></p>
<p class="MsoNormal" style="text-align: justify; line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;">DAL should ideally handle all exceptions and should not crash in any scenario; however all CRUD operations MUST be handled by DAL. </span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;"> </span></p>
<p class="MsoNormal" style="text-align: justify; line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;">Exceptions concerning data access (data source unavailable, timeout, etc) should be handled by DAL; while other business related errors should be returned in an <strong style="mso-bidi-font-weight: normal;">Error</strong> object in a serialized format.</span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;"> </span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><strong style="mso-bidi-font-weight: normal;"><span style="font-size: small;"><span style="font-family: Calibri;">Profile for best performance</span></span></strong></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;"> </span></p>
<p class="MsoNormal" style="text-align: justify; line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;">In Internet applications DAL is the most accessed-by, making it prone to crashes and security risks.<span style="mso-spacerun: yes;">  </span>Profiling of DAL is must to gauge the impact of high number of concurrent users.<span style="mso-spacerun: yes;">  </span>Also, in such scenario DAL should be prevented against attacks from hackers.<span style="mso-spacerun: yes;">  </span>Any other source of access should be give least privilege and only the web application should be at a higher privilege.</span></p>
<p class="MsoNormal" style="text-align: justify; line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;"> </span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: Calibri; font-size: small;">Consider using Batch Processes to reduce round-trip to database server. </span></p>
<p class="MsoNormal" style="text-align: justify; line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;"> </span></p>
<p class="MsoNormal" style="text-align: justify; line-height: normal; margin: 0in 0in 0pt;"><strong style="mso-bidi-font-weight: normal;"><span style="font-family: Calibri; font-size: small;"> </span></strong></p>
<p class="MsoNormal" style="text-align: justify; line-height: normal; margin: 0in 0in 0pt;"><strong style="mso-bidi-font-weight: normal;"><span style="font-family: Calibri; font-size: small;"> </span></strong></p>
<p class="MsoNormal" style="text-align: justify; line-height: normal; margin: 0in 0in 0pt;"><strong style="mso-bidi-font-weight: normal;"><span style="font-size: small;"><span style="font-family: Calibri;">Managing data</span></span></strong></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><strong style="mso-bidi-font-weight: normal;"><span style="font-family: Calibri; font-size: small;"> </span></strong></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;">One of the common problems seen in many projects while doing profiling exercises is degraded performance due to improper data handling.<span style="mso-spacerun: yes;">  </span>So let us see some important guidelines:-</span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;"> </span></p>
<ul style="margin-top: 0in;" type="disc">
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-list: l2 level1 lfo2;"><span style="font-family: Calibri; font-size: small;">If the system involves lot of documents and image storing – prefer to store them in BLOB, than on a file system</span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-list: l2 level1 lfo2;"><span style="font-family: Calibri; font-size: small;">Avoid Outer Joins wherever possible</span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-list: l2 level1 lfo2;"><span style="font-size: small;"><span style="font-family: Calibri;">Use of cursors should not be preferred – use <strong style="mso-bidi-font-weight: normal;">in-memory</strong> temporary tables instead.<strong style="mso-bidi-font-weight: normal;"></strong></span></span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-list: l2 level1 lfo2;"><span style="font-family: Calibri; font-size: small;">Open connections as late as possible.</span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-list: l2 level1 lfo2;"><span style="font-family: Calibri; font-size: small;">Use XML pameters for bulk inserts or updates – this will save execution time.</span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-list: l2 level1 lfo2;"><span style="font-family: Calibri; font-size: small;">Use parameterized SQL statements and typed parameters to mitigate security issues and reduce the chance of SQL injection attacks succeeding.</span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-list: l2 level1 lfo2;"><span style="font-family: Calibri; font-size: small;">Do <span style="text-transform: uppercase;">not</span> use string concatenation to build dynamic queries in the data layer.</span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-list: l2 level1 lfo2;"><span style="font-family: Calibri; font-size: small;">Use typed parameters as input values to the procedure and output parameters to return single values.</span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-list: l2 level1 lfo2; mso-layout-grid-align: none;"><span style="font-size: small;"><span style="font-family: Calibri;">Use optimistic concurrency with non-volatile data to mitigate the cost of locking data in the<span style="font-size: 12pt; mso-bidi-font-family: Calibri;"> database</span></span></span></li>
</ul>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;"> </span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><strong style="mso-bidi-font-weight: normal;"><span style="font-size: small;"><span style="font-family: Calibri;">Dynamic Queries or Stored Procedure</span></span></strong></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;"> </span></p>
<ol style="margin-top: 0in;" type="1">
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-list: l1 level1 lfo3;"><span style="font-family: Calibri; font-size: small;">For a small footprint application with lesser clients and few business rules, prefer Dynamic Queries. IF NO, STEP 2</span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-list: l1 level1 lfo3;"><span style="font-family: Calibri; font-size: small;">Larger application, multiple clients – abstraction can be at</span>
<ol style="margin-top: 0in;" type="a">
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-list: l1 level2 lfo3;"><span style="font-size: small;"><span style="font-family: Calibri;">Database level in Stored Proc – minimal code changes <span style="mso-spacerun: yes;"> </span></span></span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-list: l1 level2 lfo3;"><span style="font-family: Calibri; font-size: small;">DAL using patterns <span style="mso-spacerun: yes;"> </span>- best till the schema does not change, can be debugged</span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-list: l1 level2 lfo3;"><span style="font-family: Calibri; font-size: small;">DAL using ORM &#8211; best till the schema does not change, can be debugged</span></li>
</ol>
</li>
</ol>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;"> </span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><strong style="mso-bidi-font-weight: normal;"><span style="font-size: small;"><span style="font-family: Calibri;">ADO.NET Services</span></span></strong></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;"> </span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;">I would suggest a very good tutorial on MSDN. Click here to </span><a href="http://msdn.microsoft.com/en-us/library/cc838239(VS.95).aspx"><span style="font-family: Calibri; font-size: small;">read</span></a><span style="font-family: Calibri; font-size: small;"> through.</span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;"> </span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: small;"> </span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><em style="mso-bidi-font-style: normal;"><span style="color: #0000cc;"><span style="font-size: small;"><span style="font-family: Calibri;">Now, let’s take a break from the best practices and create some Silverlight applications. You’ll soon see some small Silverlight applications that can help you ease your efforts.</span></span></span></em></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><em style="mso-bidi-font-style: normal;"><span style="color: #0000cc;"><span style="font-family: Calibri; font-size: small;"> </span></span></em></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><em style="mso-bidi-font-style: normal;"><span style="color: #0000cc;"><span style="font-size: small;"><span style="font-family: Calibri;">Punit</span></span></span></em></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><em style="mso-bidi-font-style: normal;"><span style="color: #0000cc;"><span style="font-size: small;"><span style="font-family: Calibri;">MCTS – Sharepoint</span></span></span></em></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"><em style="mso-bidi-font-style: normal;"><span style="color: #0000cc;"><span style="font-size: small;"><span style="font-family: Calibri;">MCP &#8211; .NET</span></span></span></em></p>


<p><h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/07/10/silverlight-2-best-practices-ii/' rel='bookmark' title='Permanent Link: Silverlight 2 Best Practices &#8211; II'>Silverlight 2 Best Practices &#8211; II</a></li>
<li><a href='http://www.ganshani.com/2009/07/09/silverlight-2-best-practices-i/' rel='bookmark' title='Permanent Link: Silverlight 2 &#8211; Best Practices &#8211; I'>Silverlight 2 &#8211; Best Practices &#8211; I</a></li>
<li><a href='http://www.ganshani.com/2008/06/19/silverlight-20-advantages-limitations-tools/' rel='bookmark' title='Permanent Link: Silverlight 2.0 &#8211; Advantages, Limitations &#038; Tools'>Silverlight 2.0 &#8211; Advantages, Limitations &#038; Tools</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2009/07/13/silverlight-2-best-practices-iv/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Silverlight 2 Best Practices &#8211; II</title>
		<link>http://www.ganshani.com/2009/07/10/silverlight-2-best-practices-ii/</link>
		<comments>http://www.ganshani.com/2009/07/10/silverlight-2-best-practices-ii/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 06:47:53 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[Microsoft .NET]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[best practices]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=213</guid>
		<description><![CDATA[
			
				
			
		
This is in continuation to my previous post Silverlight 2 Best Practices – I, where I talked about Design Considerations.  These design considerations were a bird’s view and the posts to come will explain these in detail.  In this post, I shall deal with the Business Layer, its components, steps to design these components, and [...]


<h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/07/09/silverlight-2-best-practices-i/' rel='bookmark' title='Permanent Link: Silverlight 2 &#8211; Best Practices &#8211; I'>Silverlight 2 &#8211; Best Practices &#8211; I</a></li>
<li><a href='http://www.ganshani.com/2009/07/13/silverlight-2-best-practices-iv/' rel='bookmark' title='Permanent Link: Silverlight 2 Best Practices &#8211; IV'>Silverlight 2 Best Practices &#8211; IV</a></li>
<li><a href='http://www.ganshani.com/2008/06/19/silverlight-20-advantages-limitations-tools/' rel='bookmark' title='Permanent Link: Silverlight 2.0 &#8211; Advantages, Limitations &#038; Tools'>Silverlight 2.0 &#8211; Advantages, Limitations &#038; Tools</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2009%2F07%2F10%2Fsilverlight-2-best-practices-ii%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2009%2F07%2F10%2Fsilverlight-2-best-practices-ii%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><em style="mso-bidi-font-style: normal;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; color: #0000cc; font-size: 10pt; mso-bidi-font-size: 11.0pt;">This is in continuation to my previous post </span></em><em style="mso-bidi-font-style: normal;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; color: #006600; font-size: 10pt; mso-bidi-font-size: 11.0pt;"><a href="http://www.ganshani.com/2009/07/09/silverlight-2-best-practices-i/"><span style="color: #006600;">Silverlight 2 Best Practices – I</span></a></span></em><em style="mso-bidi-font-style: normal;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; color: #0000cc; font-size: 10pt; mso-bidi-font-size: 11.0pt;">, where I talked about Design Considerations.<span style="mso-spacerun: yes;">  </span>These design considerations were a bird’s view and the posts to come will explain these in detail.<span style="mso-spacerun: yes;">  </span>In this post, I shall deal with the Business Layer, its components, steps to design these components, and design considerations.<span style="mso-spacerun: yes;">  </span>This post can be considered not just for Silverlight Applications, but for other Web Applications as well.</span></em></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<h1 class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Business Layer</span></h1>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Let us take on the parts of the business layer for those who are newbie </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l2 level1 lfo1;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">1.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Application Façade – layer that combines multiple business operations into single message based operation</span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l2 level1 lfo1;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">2.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Business Components – Business Rules &amp; Validations</span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l2 level1 lfo1;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">3.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Entities – Used to pass data between business components</span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l2 level1 lfo1;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">4.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Business Workflow – Multi-step and/or long-running business process</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<h2 class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Design Considerations</span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Before you jump into designing of business layer, do these</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo2;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">1.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Identify ACTORS or CONSUMERS</span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo2;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">2.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">How these ACTORS will communicate to your business layer.</span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l1 level2 lfo2;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">a.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Concurrency needs to be addressed for access to STATIC data.</span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l1 level2 lfo2;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">b.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Long-running transactions should not LOCK the data.</span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo2;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">3.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">SECURITY requirements for business layer</span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l1 level2 lfo2;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">a.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Apply AUTHENTICATION wherever required.</span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l1 level2 lfo2;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">b.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Use SSO where appropriate.</span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo2; mso-layout-grid-align: none;"><span style="font-size: 12pt; mso-bidi-font-family: Calibri;"><span style="mso-list: Ignore;"><span style="font-family: Calibri;">4.</span><span style="font: 7pt &quot;Times New Roman&quot;;">      </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">VALIDATION and EXCEPTION HANDLING strategies</span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l1 level2 lfo2;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">a.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">DONOT RELY on validations at presentation layer – reuse the VALIDATION logic.<span style="mso-tab-count: 1;">      </span></span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l1 level2 lfo2;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">b.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Should NOT reveal sensitive information to the end user.</span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l1 level2 lfo2;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">c.<span style="font: 7pt &quot;Times New Roman&quot;;">     </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Should NOT use exceptions for application logic.</span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 1in; mso-list: l1 level2 lfo2;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">d.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Log SUFFICIENT detail from exceptions.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<h2 class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Authentication &amp; Authorization Module Design</span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Authentication is not a mandate requirement and should be done if the Business Layer is to be used by several clients.<span style="mso-spacerun: yes;">  </span>An easier said – public web services need authentication, but an application oriented service does not.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Consider IP filtering to restrict hacks and unauthorized usage or to have access only through the presentation layer.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">For business decisions –<span style="text-decoration: underline;">role based</span> or <span style="text-decoration: underline;">claim based</span> authorization needs to be implemented.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Impersonation can screw-up your performance. So prefer avoiding it.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<h2 class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Business Components &amp; Entities</span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Keep them light and encapsulated.<span style="mso-spacerun: yes;">  </span>Do not mix data access logic and business logic. Break them into two assemblies. Volatile business rules ought to be kept in rules engine (Workflow, DROOLS.NET, etc) </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Use ONLY CUSTOM objects as Business Entities, even if it means encapsulating only a string object.<span style="mso-spacerun: yes;">  </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Choose between the three patterns while designing these entities-</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo3;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">1.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Table Module Pattern – this is typically used when database tables can represent entities.<span style="mso-spacerun: yes;">  </span>This model is suited for large database applications or applications that use LINQ to SQL.</span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo3;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">2.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Domain Module Patter – this pattern is widely used for stateful application that has complex business rules.</span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo3;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">3.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">XML – this is used for relatively smaller applications.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Serialize your objects if it requires passing between network boundaries.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<h2 class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Caching and Concurrency</span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Appropriate <a href="http://msdn.microsoft.com/en-us/library/cc309502.aspx">caching mechanism</a> can speed up your performance by leaps and bounds by avoiding duplicate processing.<span style="mso-spacerun: yes;">  </span>To avoid client delays, caching should be a background process.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Cache the data (non-sensitive ONLY) in a ready-to-use format.<span style="mso-spacerun: yes;">  </span>In other words, data taken from cache should not necessarily require processing before use.<span style="mso-spacerun: yes;">  </span>Caching resources should avoid locks due to threading.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Use connection based <a href="http://msevents.microsoft.com/cui/WebCastEventDetails.aspx?culture=en-US&amp;EventID=1032295238&amp;CountryCode=US">transactions</a> to access single data source. Which means &#8211; a rollback should let you get back to previous state. When a rollback or commit cannot be applied (for processes that are long-running), then compensating methods should be in place.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<h2 class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Logging and Audit Mechanism</span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Logging and Auditing cannot be compromised at an enterprise level application.<span style="mso-spacerun: yes;">  </span>It can open doors to threats without getting noticed.<span style="mso-spacerun: yes;">  </span>Auditing, if generated at granular level, can let us know precise time, IP, location of resource access.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">One can use <a href="http://msdn.microsoft.com/en-us/library/dd203099.aspx">Enterprise Library</a> or any other component to implement logging mechanism – but it needs to be centralized.<span style="mso-spacerun: yes;">   </span>However unexpected failure of this centralized block should not cause stop the business functionalities.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<h2 class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Workflows</span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Windows Workflow is a great-gift by Microsoft to the technologies. Workflows – state machine or sequential &#8211; should be initiated on a separate thread for long-running process.<span style="mso-spacerun: yes;">  </span>Faulty conditions should be handled as exceptions.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<h2 class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Deployment</span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Towards the end, an incorrect deployment will surely not deliver excellent results. Use TCP protocol and SSL to support remote business layer in a safe manner.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><em style="mso-bidi-font-style: normal;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; color: #0000cc; font-size: 10pt; mso-bidi-font-size: 11.0pt;">The next to come in this series will be a post on what <strong style="mso-bidi-font-weight: normal;"><span style="text-decoration: underline;">not to do</span></strong> in Silverlight while developing an application. This will focus on best practices that a developer needs to take care of.</span></em></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><em style="mso-bidi-font-style: normal;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; color: #0000cc; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></em></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><em style="mso-bidi-font-style: normal;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; color: #0000cc; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Punit </span></em></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><em style="mso-bidi-font-style: normal;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; color: #0000cc; font-size: 10pt; mso-bidi-font-size: 11.0pt;">MCTS &#8211; Sharepoint </span></em></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><em style="mso-bidi-font-style: normal;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; color: #0000cc; font-size: 10pt; mso-bidi-font-size: 11.0pt;">MCP &#8211; .NET &amp; SQL</span></em></p>


<p><h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/07/09/silverlight-2-best-practices-i/' rel='bookmark' title='Permanent Link: Silverlight 2 &#8211; Best Practices &#8211; I'>Silverlight 2 &#8211; Best Practices &#8211; I</a></li>
<li><a href='http://www.ganshani.com/2009/07/13/silverlight-2-best-practices-iv/' rel='bookmark' title='Permanent Link: Silverlight 2 Best Practices &#8211; IV'>Silverlight 2 Best Practices &#8211; IV</a></li>
<li><a href='http://www.ganshani.com/2008/06/19/silverlight-20-advantages-limitations-tools/' rel='bookmark' title='Permanent Link: Silverlight 2.0 &#8211; Advantages, Limitations &#038; Tools'>Silverlight 2.0 &#8211; Advantages, Limitations &#038; Tools</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2009/07/10/silverlight-2-best-practices-ii/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Silverlight 2 &#8211; Best Practices &#8211; I</title>
		<link>http://www.ganshani.com/2009/07/09/silverlight-2-best-practices-i/</link>
		<comments>http://www.ganshani.com/2009/07/09/silverlight-2-best-practices-i/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 11:18:53 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[Microsoft .NET]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[Design]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=210</guid>
		<description><![CDATA[
			
				
			
		
For the past 6 months, I have been working on Performance and Memory Analysis for few projects, that became critical when developers chose not to adhere to the best practices.  Teams have started calling me ‘Dr. Perf’ as I board the ship to diagnose the applications – web and windows.  So here I go with [...]


<h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/07/10/silverlight-2-best-practices-ii/' rel='bookmark' title='Permanent Link: Silverlight 2 Best Practices &#8211; II'>Silverlight 2 Best Practices &#8211; II</a></li>
<li><a href='http://www.ganshani.com/2009/07/13/silverlight-2-best-practices-iv/' rel='bookmark' title='Permanent Link: Silverlight 2 Best Practices &#8211; IV'>Silverlight 2 Best Practices &#8211; IV</a></li>
<li><a href='http://www.ganshani.com/2009/09/23/silverlight-training-kit/' rel='bookmark' title='Permanent Link: Silverlight Training Kit'>Silverlight Training Kit</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2009%2F07%2F09%2Fsilverlight-2-best-practices-i%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2009%2F07%2F09%2Fsilverlight-2-best-practices-i%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><em style="mso-bidi-font-style: normal;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"><span style="color: #0000ff;">For the past 6 months, I have been working on Performance and Memory Analysis for few projects, that became critical when developers chose not to adhere to the best practices.<span style="mso-spacerun: yes;">  </span>Teams have started calling me ‘Dr. Perf’ as I board the ship to diagnose the applications – web and windows.<span style="mso-spacerun: yes;">  </span>So here I go with one of the most looked after topic ‘Best Practices for Silverlight 2.’<span style="mso-spacerun: yes;">  </span>Wherever required, I would direct you to appropriate sites, books and links to have a further read.</span></span></em></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<h1 class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 12pt; mso-bidi-font-size: 11.0pt;">Design Considerations</span></h1>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<h2 class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Silverlight – yes or no?</span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><strong style="mso-bidi-font-weight: normal;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">This decision is very vital decision as you are pressing your money, time and your resources behind application development. Choose Silverlight only when</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">1.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Your clients hardware/software supports RIAs</span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">2.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">A good network bandwidth to download XAP components</span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">3.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Sections that have more visualizations than that provided by HTML and ASP.NET markups</span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">4.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">High-streaming of video/audio is required.</span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">5.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Best for single-screen applications; but can be extended to multi-screens.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.25in;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Where not to choose Silverlight? Say NO when</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo2;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">1.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Pages are highly complex</span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo2;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">2.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Multi-page user interfaces</span></p>
<p class="MsoListParagraph" style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo2;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Trebuchet MS'; mso-bidi-font-family: 'Trebuchet MS';"><span style="mso-list: Ignore;">3.<span style="font: 7pt &quot;Times New Roman&quot;;">    </span></span></span><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Browser specific programming is required (though you actually can do it, you must prefer not to use platform-specific-APIs)</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Design your application such a way that plug-in installation is non-interruptive</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<h2 class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Data Accessibility</span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Accessing business logic directly from a Silverlight Application is not advisable.<span style="mso-spacerun: yes;">  </span>It is better to encapsulate such logic in <strong style="mso-bidi-font-weight: normal;">Web Services</strong> (read: WCF services), just like any other Web Application.<span style="mso-spacerun: yes;">  </span>For <strong style="mso-bidi-font-weight: normal;">security reasons</strong>, do not put highly sensitive unencrypted business logic on the client. Transferring <span style="text-decoration: underline;">logic to UI-layer</span> (Silverlight) is preferred only when the performance is a huge hit, but this is done as a trade-off between performance and security.<span style="mso-spacerun: yes;">  </span>Put your <span style="text-decoration: underline;">business validation/rules</span> in a separate assembly so that it can updated independently when rules change.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Data store (DB, XML, etc), obviously, will be accessed through these services.<span style="mso-spacerun: yes;">  </span>Do not attempt to use local client databases.<span style="mso-spacerun: yes;">  </span>Minimize number of round-trips by filtering data at server rather than client end.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Accessing local resources of client machine (in client-server arch) will be possible in limits only. So define the scalability of application and request appropriate space from user for your application. Avoid unhandled exceptions by checking if <span style="text-decoration: underline;">Storage Space is sufficient or not</span>. The .NET cryptography APIs are available in Silverlight and should be utilized when storing and communicating sensitive data to the server if not already encrypted using another mechanism.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<h2 class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Application Performance Methods</span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Use appropriate methodologies to boost the application performance.<span style="mso-spacerun: yes;">  </span>Ensure that your application has a lightweight foot-print so that users don’t spend too much time in downloading XAP file. <span style="mso-spacerun: yes;"> </span>Initially load only code stubs which can lazy-load other modules.<span style="mso-spacerun: yes;">  </span>Prefer using <span style="text-decoration: underline;">inbuilt RIA controls</span> than using 3<sup>rd</sup> party controls.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"><span style="text-decoration: underline;">Cache your business logic</span> and divide your modules very intelligently. Cache objects that not likely to change during a session.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Validate the data before call is given to Web Services. This will reduce the number of trips and make the system more responsive.<span style="mso-spacerun: yes;">  </span>If validation logic is too large, consider putting it into a separate assembly.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<h2 class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Communication</span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Prefer allocating data pull calls to <span style="text-decoration: underline;">background worker processes</span> or in separate threads.<span style="mso-spacerun: yes;">  </span>If your web service is slow in response, make sure that you keep polling it regularly (say every 5 minutes in a separate thread) to retrieve data.<span style="mso-spacerun: yes;">  </span>Long-running processes should be executed in a separate thread to avoid blocking of UI.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Ensure that cross-domain configuration is done aptly to have communication with services hosted in other domains.<span style="mso-spacerun: yes;">  </span>Consider using <span style="text-decoration: underline;">Sockets over Web Services</span> when high-amount of information needs to be pushed/pulled to/from server. Example: Rich gaming sites, Stock-trading sites, etc.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<h2 class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Exception Handling &amp; Logging</span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Using Exception Handling to control business logic is not advisable.<span style="mso-spacerun: yes;">  </span>Catch internal exceptions and decide an appropriate exception <span style="text-decoration: underline;">propagation strategy</span> – bubbling up to boundary layers.<span style="mso-spacerun: yes;">  </span>Provide appropriate notification services for critical errors.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Logging component in Silverlight has several limitations. Hence, log errors at client-end and <span style="text-decoration: underline;">transfer them to server</span>. If using services to implement logging, consider the increased overhead. The added overhead may also change message behavior on the server thus making it harder to use logging to troubleshoot message timing issues.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<h2 class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Mobility</span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Check if the plug-in has <span style="text-decoration: underline;">reduced functionalities</span> for Mobile devices or the same.<span style="mso-spacerun: yes;">  </span>If required, incorporate device specific features to improve user experience. Re-examine UI layout using simulators for a smaller screen size.<span style="mso-spacerun: yes;">  </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<h2 class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Deployment</span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Design <span style="text-decoration: underline;">several modules</span> (XAP-files) instead of a single-large XAP-file, so that individual modules can be downloaded and cached as and when required.<span style="mso-spacerun: yes;">  </span>This will also ensure extensibility and modularity in the architecture.<span style="mso-spacerun: yes;">  </span>Prefer to have a <span style="text-decoration: underline;">separate Web Application Server and a Database Server</span>.<span style="mso-spacerun: yes;">  </span>A Web Farm can be configured to improve response time.<span style="mso-spacerun: yes;">  </span>However, <span style="text-decoration: underline;">cross domain policies</span> should be implemented and tested. To avoid hardware failures, <span style="text-decoration: underline;">clustering</span> should be done.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"><span style="text-decoration: underline;">Version</span> your components and label them in Source-Safe.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Provide <span style="text-decoration: underline;">Internet and Intranet links </span>to manually download and install the plug-in if automatic installation cannot be done.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;">Ensure that your DLLs are <span style="text-decoration: underline;">obfuscated</span> before deployed to any server.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><em style="mso-bidi-font-style: normal;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"><span style="color: #0000ff;">Well, that’s for the first time. I’ll add more to this soon.. Please add in your expertise by commenting to this blog.</span></span></em></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><em style="mso-bidi-font-style: normal;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"></span></em></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><em style="mso-bidi-font-style: normal;"><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"><span style="color: #0000ff;">Punit Ganshani</span></span></em><span style="font-family: &quot;Trebuchet MS&quot;,&quot;sans-serif&quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt;"></span></p>


<p><h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/07/10/silverlight-2-best-practices-ii/' rel='bookmark' title='Permanent Link: Silverlight 2 Best Practices &#8211; II'>Silverlight 2 Best Practices &#8211; II</a></li>
<li><a href='http://www.ganshani.com/2009/07/13/silverlight-2-best-practices-iv/' rel='bookmark' title='Permanent Link: Silverlight 2 Best Practices &#8211; IV'>Silverlight 2 Best Practices &#8211; IV</a></li>
<li><a href='http://www.ganshani.com/2009/09/23/silverlight-training-kit/' rel='bookmark' title='Permanent Link: Silverlight Training Kit'>Silverlight Training Kit</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2009/07/09/silverlight-2-best-practices-i/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>ASP.NET Best Practices</title>
		<link>http://www.ganshani.com/2009/03/10/aspnet-best-practices/</link>
		<comments>http://www.ganshani.com/2009/03/10/aspnet-best-practices/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 13:09:57 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[best practices]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=340</guid>
		<description><![CDATA[
			
				
			
		
This has been pending since long. People have been requesting this information and I&#8217;ve not been able to find time to write on Best Practices. And this fine day, finally I pen this down.
I hope this helps to you.  These best practices are direct-from-real-world i.e. noted down as observations from live projects.
String Concatenation
Use of StringBuilder [...]


<h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2008/04/23/validation/' rel='bookmark' title='Permanent Link: Validation'>Validation</a></li>
<li><a href='http://www.ganshani.com/2008/04/21/ajax-what-not-to-do/' rel='bookmark' title='Permanent Link: Ajax &#8211; what not to do!'>Ajax &#8211; what not to do!</a></li>
<li><a href='http://www.ganshani.com/2007/12/21/debate-over-iframes-in-html/' rel='bookmark' title='Permanent Link: Debate over iFrames in HTML'>Debate over iFrames in HTML</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2009%2F03%2F10%2Faspnet-best-practices%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2009%2F03%2F10%2Faspnet-best-practices%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>This has been pending since long. People have been requesting this information and I&#8217;ve not been able to find time to write on Best Practices. And this fine day, finally I pen this down.</p>
<p>I hope this helps to you.  These best practices are direct-from-real-world i.e. noted down as observations from live projects.</p>
<h3>String Concatenation</h3>
<p>Use of StringBuilder is preferred over String.Concat or use of operator &#8216;+&#8217;</p>
<p>It is observed that when number of strings to be concatenated is greater than 3, StringBuilder does it much faster than String.Concat. For lesser number of strings, String.Concat can also be used.</p>
<h3>Avoid round trips to server</h3>
<ul>
<li>Usage of Ajax UpdatePanel is preferred to avoid full postback to the server.</li>
<li>Client side scripts for validations should be used.</li>
<li>Check Page.IsPostBack at Page Load to ensure that only page initialization logic is performed when a page is loaded the first time and not in response to client postbacks.</li>
</ul>
<h3>ViewState &amp; HiddenFields</h3>
<ul>
<li>ViewState is valid only for postback of same pages &#8211; as data is passed to client &amp; returned in a hidden field</li>
<li>Keep minimal data in ViewState &#8211; higher the data, slower the system</li>
<li>Disable ViewState at PageLevel using EnableViewState</li>
</ul>
<h3>Session Variables</h3>
<ul>
<li>Not more than <strong><span style="text-decoration: underline;">20 session variables</span></strong> should exist in application context.</li>
<li>Keep Session TimeOut</li>
<li>Disable Session State, if you are not using in particular Page/Application.</li>
</ul>
<h3>Server.Transfer vs Response.Redirect</h3>
<ul type="disc">
<li>Use Server.Transfer to redirect between pages of same application.</li>
<li>Use Response.Redirect to redirect to external page or when new context needs to be started.</li>
</ul>
<h3>Use DataReader for data binding</h3>
<ul>
<li>If application does not demand caching, DataReader can be used. Use DataReader to retrieve data &amp; then load it in a DataSet</li>
<li>Don&#8217;t pass this DataSet across layers. Pass custom serialize-able entities across layers.</li>
</ul>
<h3>Grid Pagination at SQL end</h3>
<ul>
<li>Pagination logic can be written @ SQL end, than writing it at Grid level.</li>
<li>Send Page Number, number of records to Stored Procedure to retrieve records from DB</li>
<li><strong>Sorting</strong> should also be implemented @ DB.</li>
<li>Check for <strong>SQL Injection</strong>.</li>
</ul>
<h3>Close resources</h3>
<ul>
<li>Close the connections when not in use &#8211; improves security &amp; enhances the performance.</li>
<li>Such closures should be done in <strong>finally</strong> block</li>
</ul>
<h3>Optimize loops</h3>
<ul>
<li>Avoid foreach &#8211; use for, while loops<br />
foreach degrades the performance. It is better to use for loop instead of a foreach</li>
<li>While deleting records/rows from a collection, iterate backward (counter=Max to 1). This will avoid Stack Overflow exceptions</li>
<li>Avoid try-catch in for loops &#8211; it degrades performance.</li>
</ul>
<h3>Variable Initialization @ right place</h3>
<ul>
<li>Initializing variable @ start &amp; using it at a later stage will cause many PUSH/POP operations. Hence initialize variables at right place.</li>
<li>Integer variables need not to be initialized to ZERO. They are automatically initialized; String variables need to be initialized explicitly.</li>
</ul>
<h3>Use Fiddler to intercept HTTP requests.</h3>
<ul>
<li>Use Fiddler to intercept the HTTP requests and to know which request is consuming more time.</li>
<li>Also find out the exceptions caused during each HTTP request.</li>
</ul>
<h3>URL Rewriting</h3>
<ul>
<li>For URLs that have confidential information, it is advisable to implement URL Rewriters.</li>
<li>URLs should be consistent</li>
</ul>
<h3>Caching Mechanism</h3>
<ul>
<li>Cache static content for longer period &#8211; use high value for Expires property</li>
<li>Use Friendly folder structure &#8211; content\images\header.gif, etc.</li>
<li>Minimize use of SSL as SSL is not cached</li>
<li>Use IIS HTTP Headers to configure static caching.</li>
</ul>
<h3>Application Settings</h3>
<ul type="disc">
<li>Content-Length should be fixed. This keeps the connection open for limited time &amp; closes automatically when the content length is greater than declared one.</li>
<li>Encrypt connection strings on server.</li>
<li>Make sure all the reference DLLs are present in GAC</li>
<li>Disable tracing and debugging<br />
Set &lt;deployment retail=&#8221;true&#8221; /&gt; in machine.config file &#8211; it forces debug to be false, disables output tracing, and redirects to custom error page rather than the actual error page.</li>
</ul>
<h3>Progressive UI</h3>
<ul type="disc">
<li>Progressive UI enables fast &amp; smooth surfing &#8211; load/visible the DIV tags only when required.</li>
</ul>
<h3>Web Services</h3>
<ul type="disc">
<li>Prevent overloading of web services through DoS (Denial of Service) attacks. Check if it is the First time visit, or repeated visit for the same function from same IP.</li>
<li>Use trusted SQL connections in Web Services</li>
<li>Make sure there are asynchronous calls to web services</li>
</ul>
<h3>Exception Handling</h3>
<ul type="disc">
<li>Log the exceptions &amp; display appropriate message to user.</li>
<li>Define a base class say : MyException</li>
<li>This class should have following information <strong>for display to user</strong>
<ul type="circle">
<li>What Happened</li>
<li>What has been affected</li>
<li>What actions to do</li>
<li>Support Information</li>
</ul>
</li>
<li>This class should have following information <strong>for logging purpose</strong>
<ul type="circle">
<li>Server Name</li>
<li>Instance id</li>
<li>User Id</li>
<li>Call Stack</li>
<li>Assembly Name &amp; Version</li>
<li>Exception Source, Type &amp; Message</li>
</ul>
</li>
<li>Redirect as per the Error-Level</li>
<li>Application Level: Catch errors in global.asax in Application_Error function.</li>
<li>Page Level: Use Page_Error function to log errors.</li>
</ul>
<h3>Deployment &#8211; IIS</h3>
<ul type="disc">
<li>Create separate application pool for your site</li>
<li>Use App_Offline.htm file. This will help you take your application offline by displaying user friendly message while fixing issues.</li>
<li>Automate the build process for
<ul type="circle">
<li>Development</li>
<li>Production environments</li>
</ul>
</li>
<li>Make sure application is not built in DEBUG mode.</li>
<li>Load test application.</li>
</ul>


<p><h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2008/04/23/validation/' rel='bookmark' title='Permanent Link: Validation'>Validation</a></li>
<li><a href='http://www.ganshani.com/2008/04/21/ajax-what-not-to-do/' rel='bookmark' title='Permanent Link: Ajax &#8211; what not to do!'>Ajax &#8211; what not to do!</a></li>
<li><a href='http://www.ganshani.com/2007/12/21/debate-over-iframes-in-html/' rel='bookmark' title='Permanent Link: Debate over iFrames in HTML'>Debate over iFrames in HTML</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2009/03/10/aspnet-best-practices/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight 2.0 &#8211; Advantages, Limitations &amp; Tools</title>
		<link>http://www.ganshani.com/2008/06/19/silverlight-20-advantages-limitations-tools/</link>
		<comments>http://www.ganshani.com/2008/06/19/silverlight-20-advantages-limitations-tools/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 17:36:38 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Microsoft .NET]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[best practices]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=91</guid>
		<description><![CDATA[
			
				
			
		

Advantages of Silverlight:
Rich UI applications using WPF (similar to Desktop applications)
Cross-browser, cross-platform plug-in
Rich Media experience. Possible to collaborate Media objects such as Video Streaming, Animations, etc.
Search-engine friendly
Application is firewall-compatible
Socket/TCP programming for multi-player networking support
Overlaying of Silverlight controls is possible as each Silverlight components is rendered in HTML DIV tags.

Limitations:

No support for auto-content scrolling of a [...]


<h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/12/15/floating-container-in-silverlight-3/' rel='bookmark' title='Permanent Link: Floating Container in Silverlight'>Floating Container in Silverlight</a></li>
<li><a href='http://www.ganshani.com/2009/07/09/silverlight-2-best-practices-i/' rel='bookmark' title='Permanent Link: Silverlight 2 &#8211; Best Practices &#8211; I'>Silverlight 2 &#8211; Best Practices &#8211; I</a></li>
<li><a href='http://www.ganshani.com/2009/07/24/silverlight-toolkit/' rel='bookmark' title='Permanent Link: Silverlight Toolkit'>Silverlight Toolkit</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2008%2F06%2F19%2Fsilverlight-20-advantages-limitations-tools%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2008%2F06%2F19%2Fsilverlight-20-advantages-limitations-tools%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<ul>
<li><strong>Advantages of Silverlight:</strong></li>
<li>Rich UI applications using WPF (similar to Desktop applications)</li>
<li>Cross-browser, cross-platform plug-in</li>
<li>Rich Media experience. Possible to collaborate Media objects such as Video Streaming, Animations, etc.</li>
<li>Search-engine friendly</li>
<li>Application is firewall-compatible</li>
<li>Socket/TCP programming for multi-player networking support</li>
<li>Overlaying of Silverlight controls is possible as each Silverlight components is rendered in HTML DIV tags.</li>
</ul>
<p><strong>Limitations:</strong></p>
<ol>
<li>No support for auto-content scrolling of a container.</li>
<li>Silverlight 1.0 : Doesn&#8217;t include any input controls of its own. If you need user input in your Silverlight controls, you either need to create the control manually via XAML layout and event handling (for key and mouse events, etc.) or you can use HTML controls for capturing input and passing the content to the Silverlight control. <em>Silverlight 2.0 allows this.</em></li>
<li>Silverlight 2.0 :
<ol>
<li>The relative positing is not currently supported in Silverlight (<span style="text-decoration: underline;">Fix</span>: we need to specify the Canvas.Top for each and every controls.)</li>
<li>Debugging with Firefox browser is not so good: VS 2008 can&#8217;t attach the firefox automatically when we run the application. so, we have to manually attach the firefox browser from Visual Studio.</li>
<li>Exception handling is not very good so far: Exceptions in XAML file do not show on the browsers and it will just show the emply canvas which is not good.</li>
<li>No build-in silverlight controls available in Silverlight Alpha.</li>
<li>The support of WPF is currently very limited.</li>
</ol>
</li>
</ol>
<p><strong>Tools:</strong></p>
<ul>
<li>Visual Studio 2008 : Writing C# code</li>
<li>Expression Design : To Convert a design into its XAML file.</li>
<li>Expression Blend : For designing purpose.</li>
<li>Silverlight 2.0 SDK : Help</li>
<li>Silverlight Tools for VS : VS2008 extensions.</li>
</ul>
<p><strong>Best Practices:</strong></p>
<p>Look out for the best practices on:</p>
<ol>
<li><a href="http://www.ganshani.com/2009/07/09/silverlight-2-best-practices-i/">http://www.ganshani.com/2009/07/09/silverlight-2-best-practices-i/</a></li>
<li><a href="http://www.ganshani.com/2009/07/10/silverlight-2-best-practices-ii/">http://www.ganshani.com/2009/07/10/silverlight-2-best-practices-ii/</a></li>
<li><a href="http://www.ganshani.com/2009/07/10/silverlight-2-best-practices-iii/">http://www.ganshani.com/2009/07/10/silverlight-2-best-practices-iii/</a></li>
<li><a href="http://www.ganshani.com/2009/07/13/silverlight-2-best-practices-iv/">http://www.ganshani.com/2009/07/13/silverlight-2-best-practices-iv/</a></li>
</ol>


<p><h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/12/15/floating-container-in-silverlight-3/' rel='bookmark' title='Permanent Link: Floating Container in Silverlight'>Floating Container in Silverlight</a></li>
<li><a href='http://www.ganshani.com/2009/07/09/silverlight-2-best-practices-i/' rel='bookmark' title='Permanent Link: Silverlight 2 &#8211; Best Practices &#8211; I'>Silverlight 2 &#8211; Best Practices &#8211; I</a></li>
<li><a href='http://www.ganshani.com/2009/07/24/silverlight-toolkit/' rel='bookmark' title='Permanent Link: Silverlight Toolkit'>Silverlight Toolkit</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2008/06/19/silverlight-20-advantages-limitations-tools/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
