<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Architecture on Amit Bahree&#39;s (useless?) insight!</title>
    <link>/tags/architecture/</link>
    <description>Recent content in Architecture on Amit Bahree&#39;s (useless?) insight!</description>
    <generator>Hugo -- 0.151.0</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 30 May 2018 00:00:00 +0000</lastBuildDate>
    <atom:link href="/tags/architecture/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Cloud and failure</title>
      <link>/post/2018/05/cloud-and-failure/</link>
      <pubDate>Wed, 30 May 2018 00:00:00 +0000</pubDate>
      <guid>/post/2018/05/cloud-and-failure/</guid>
      <description>&lt;p&gt;Despite all the cloud talk and where I live, it is like the cloud mecca, for enterprises it is still quite new and many are just starting to think about it. A hard lesson that many of us learn (and partly how we amass our scars) is to design for failures. For those, who run things in their enterprises data center, are quite spoilt I think. Failures are rare, and if machines or state goes down, moving to another one isn’t really a big deal (of course it is a little more complex, and not to say, there isn’t any down time, or business loss, etc.).&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Despite all the cloud talk and where I live, it is like the cloud mecca, for enterprises it is still quite new and many are just starting to think about it. A hard lesson that many of us learn (and partly how we amass our scars) is to design for failures. For those, who run things in their enterprises data center, are quite spoilt I think. Failures are rare, and if machines or state goes down, moving to another one isn’t really a big deal (of course it is a little more complex, and not to say, there isn’t any down time, or business loss, etc.).</p>
<p>When thinking about a cloud migration (hybrid or otherwise) – a key rule is that you are guaranteed to have failures – at many aspects, and those cannot be exceptional conditions, but rather the normal design and expected behavior. As a result, you app/services/API/whatever needs to be designed for failure. And not only how your loosely couple your architecture to be able to handle these situations, but also, how the response isn’t a binary (yay, or a <a
	
		href = "https://creativemarket.com/blog/the-best-404-pages-on-the-internet"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		fancy 404
	</span>
</a>); but rather a degraded experience, where your app/service/API/whatever still performs albeit in a deprecated mode.</p>
<p>Things that can throw one off, and is food for thought (not exhaustive, or on any particular order):</p>
<ul>
<li>Managing state (when failures is guaranteed)</li>
<li>Latency – cloud is fast, but slower than your internal data center; you know – physics. :) How are your REST API’s handling latency, and are they degrading performance?</li>
<li>“Chatiness” – how talkative, are your things on the wire? And how big is the payload?</li>
<li>Rollback, or fall forward?</li>
<li>Lossy transfers (if data structure sizes are large)</li>
<li>DevOps – mashing up of Developers, and Operations (what some call SRE) – you own the stuff you build, and, responsible for it.</li>
<li>AutoScale – most think this is to scale up, but it also means to scale down when resources are not needed.</li>
<li>Physical deployments – Regional deployment vs. global ones – there isn’t a right or wrong answer, it frankly depends on the service and what you are trying to do. Personally, I would lean towards regional first.</li>
<li>Production deployment strategies – various ways to skin a cat and no one is right or wrong per se (except, please don’t do a basic deployment) – that is suicide. I am use to A/B testing, but also what is now called Blue/Green deployment. Read up <a
	
		href = "https://harness.io/2018/02/deployment-strategies-continuous-delivery/"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		more here
	</span>
</a>. And of course use some kind of a deployment window (that works for your business) – this allows you and your team to watch what is going on, and take corrective actions if required.</li>
<li>Automate everything you can; yes its not free, but you recoup that investment pretty quick; and will still have hair on the scalp!</li>
<li>Instrument – if you can’t measure it, you can’t fix it.</li>
</ul>
<p>Again, not an exhaustive list, but rather meant to get one thinking. There are also some inherent assumptions – e.g. automation and production deployment suggests, there is some automated testing in place; and a CI/CD strategy and supporting tools.</p>
<p>Bottom line – when it comes to cloud (or any other distributed architecture), the best way to avoid failure is to fail constantly!</p>
]]></content:encoded>
    </item>
    <item>
      <title>Is rand() harmful?</title>
      <link>/post/2013/11/is-rand-harmful/</link>
      <pubDate>Wed, 06 Nov 2013 00:00:00 +0000</pubDate>
      <guid>/post/2013/11/is-rand-harmful/</guid>
      <description>&lt;p&gt;​I saw &lt;a
	
		href = &#34;http://channel9.msdn.com/Events/GoingNative/2013/rand-Considered-Harmful&#34;
	

	
		title = &#34;this&#34;
	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		this
	&lt;/span&gt;
&lt;/a&gt; awesome &lt;a
	
		href = &#34;http://video.ch9.ms/sessions/gonat/2013/STLGN13rand.pptx&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		presentation
	&lt;/span&gt;
&lt;/a&gt; on &lt;strong&gt;why rand() is considered harmful&lt;/strong&gt;. When you need a random number, don&amp;rsquo;t call rand() and especially don&amp;rsquo;t say rand() % 100! This presentation will explain why that&amp;rsquo;s so terrible, and how C++11&amp;rsquo;s header can make your life so much easier.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>​I saw <a
	
		href = "http://channel9.msdn.com/Events/GoingNative/2013/rand-Considered-Harmful"
	

	
		title = "this"
	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		this
	</span>
</a> awesome <a
	
		href = "http://video.ch9.ms/sessions/gonat/2013/STLGN13rand.pptx"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		presentation
	</span>
</a> on <strong>why rand() is considered harmful</strong>. When you need a random number, don&rsquo;t call rand() and especially don&rsquo;t say rand() % 100! This presentation will explain why that&rsquo;s so terrible, and how C++11&rsquo;s header can make your life so much easier.</p>
<p>If you need uniqueness and non-deterministic, especially on the context of security or crypto then you need to think about a few things. For example the frequency, non-uniform distribution, and not using a pseudo random number generator (such as <a
	
		href = "http://en.wikipedia.org/wiki/Mersenne_twister"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		Mersenne twister
	</span>
</a>) and not a <a
	
		href = "http://en.wikipedia.org/wiki/Linear_congruential_generator"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		linear congruential generator
	</span>
</a>.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Automated Code Reviews with Visual Studio?</title>
      <link>/post/2013/08/automated-code-reviews-with-visual-studio/</link>
      <pubDate>Wed, 21 Aug 2013 00:00:00 +0000</pubDate>
      <guid>/post/2013/08/automated-code-reviews-with-visual-studio/</guid>
      <description>&lt;p&gt;I have been thinking of doing some code &amp;lsquo;smelliness&amp;rsquo; test, and am keen to automate code reviews (as much as possible).&lt;/p&gt;
&lt;p&gt;I am interested to know what tools have you guys used? I want to use the tools to find the low hanging fruits and know off the 80% of things and then we manually look at the more interesting aspects, which the tools don&amp;rsquo;t (or can&amp;rsquo;t) pick up. Ideally, I would like this as an add-in to Visual Studio, which can run as part of a build and depending on how one configures it, can get to a gated check-in and/or work-items being created in TFS which then can be assigned and tracked. What I am thinking is to complement the likes of FxCop, the built-in Visual Studio tools. There was &lt;a
	
		href = &#34;http://teamreview.codeplex.com/&#34;
	

	
		title = &#34;Team Review&#34;
	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		TeamReview
	&lt;/span&gt;
&lt;/a&gt; which I had looked at some point in the past, but we never got it running successfully. I have not had a chance to see it since then. Someone has also attempted some of this via &lt;a
	
		href = &#34;http://tfscodereviewflow.codeplex.com/&#34;
	

	
		title = &#34;this&#34;
	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		this
	&lt;/span&gt;
&lt;/a&gt;, but it does not seem to go anywhere. Surely, there someone has already build this which we can look into?&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>I have been thinking of doing some code &lsquo;smelliness&rsquo; test, and am keen to automate code reviews (as much as possible).</p>
<p>I am interested to know what tools have you guys used? I want to use the tools to find the low hanging fruits and know off the 80% of things and then we manually look at the more interesting aspects, which the tools don&rsquo;t (or can&rsquo;t) pick up. Ideally, I would like this as an add-in to Visual Studio, which can run as part of a build and depending on how one configures it, can get to a gated check-in and/or work-items being created in TFS which then can be assigned and tracked. What I am thinking is to complement the likes of FxCop, the built-in Visual Studio tools. There was <a
	
		href = "http://teamreview.codeplex.com/"
	

	
		title = "Team Review"
	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		TeamReview
	</span>
</a> which I had looked at some point in the past, but we never got it running successfully. I have not had a chance to see it since then. Someone has also attempted some of this via <a
	
		href = "http://tfscodereviewflow.codeplex.com/"
	

	
		title = "this"
	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		this
	</span>
</a>, but it does not seem to go anywhere. Surely, there someone has already build this which we can look into?</p>
]]></content:encoded>
    </item>
    <item>
      <title>Fallacies of Distributed Computing</title>
      <link>/post/2012/07/fallacies-of-distributed-computing/</link>
      <pubDate>Sat, 07 Jul 2012 00:00:00 +0000</pubDate>
      <guid>/post/2012/07/fallacies-of-distributed-computing/</guid>
      <description>&lt;p&gt;I was reading something and came across these &lt;a
	
		href = &#34;http://en.wikipedia.org/wiki/Fallacies_of_Distributed_Computing&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		fallacies of Distributed Computing
	&lt;/span&gt;
&lt;/a&gt; which all beginners (to distributed computing) have. Oh how we all learn.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The network is reliable&lt;/li&gt;
&lt;li&gt;Latency is zero&lt;/li&gt;
&lt;li&gt;Bandwidth is infinite&lt;/li&gt;
&lt;li&gt;The network is secure&lt;/li&gt;
&lt;li&gt;Topology doesn&amp;rsquo;t change&lt;/li&gt;
&lt;li&gt;There is only one administrator&lt;/li&gt;
&lt;li&gt;Transport cost is zero&lt;/li&gt;
&lt;li&gt;The network is homogeneous&lt;/li&gt;
&lt;/ol&gt;</description>
      <content:encoded><![CDATA[<p>I was reading something and came across these <a
	
		href = "http://en.wikipedia.org/wiki/Fallacies_of_Distributed_Computing"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		fallacies of Distributed Computing
	</span>
</a> which all beginners (to distributed computing) have. Oh how we all learn.</p>
<ol>
<li>The network is reliable</li>
<li>Latency is zero</li>
<li>Bandwidth is infinite</li>
<li>The network is secure</li>
<li>Topology doesn&rsquo;t change</li>
<li>There is only one administrator</li>
<li>Transport cost is zero</li>
<li>The network is homogeneous</li>
</ol>
]]></content:encoded>
    </item>
    <item>
      <title>Concurrency and CEP</title>
      <link>/post/2012/04/concurrency-and-cep/</link>
      <pubDate>Wed, 18 Apr 2012 00:00:00 +0000</pubDate>
      <guid>/post/2012/04/concurrency-and-cep/</guid>
      <description>&lt;p&gt;The sooner we all understand the Concurrency ≠ CEP (Complex Event Processing), the better the world will be!&lt;/p&gt;
&lt;p&gt;CEP is generally used when we implement real-time systems (of course that is not the only area where CEP is used). Real-time does not mean concurrent or for that matter high-performing system.&lt;/p&gt;
&lt;p&gt;Of course there are correlations, but at the same time they are fundamentally different paradigms.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>The sooner we all understand the Concurrency ≠ CEP (Complex Event Processing), the better the world will be!</p>
<p>CEP is generally used when we implement real-time systems (of course that is not the only area where CEP is used). Real-time does not mean concurrent or for that matter high-performing system.</p>
<p>Of course there are correlations, but at the same time they are fundamentally different paradigms.</p>
]]></content:encoded>
    </item>
    <item>
      <title>What I am working on today? Optimisation Algorithms</title>
      <link>/post/2012/03/what-i-am-working-on-today-optimisation-algorithms/</link>
      <pubDate>Sat, 17 Mar 2012 00:00:00 +0000</pubDate>
      <guid>/post/2012/03/what-i-am-working-on-today-optimisation-algorithms/</guid>
      <description>&lt;p&gt;I often get the question – a what am I working on today? Some of the things I can’t discuss in an open forum, but some I can. Those that I can, I thought it was best to share via my blog and do quick small posts on it. Will this become a new series? Well time will tell – depends on how much bandwidth I will have.&lt;/p&gt;
&lt;p&gt;This weekend, I am researching &lt;a
	
		href = &#34;http://en.wikipedia.org/wiki/Optimization_%28mathematics%29&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		Optimisation Algorithms
	&lt;/span&gt;
&lt;/a&gt; – both Deterministic and Probabilistic. Specifically interested in &lt;a
	
		href = &#34;http://en.wikipedia.org/wiki/Swarm_intelligence&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		Swarm Intelligence
	&lt;/span&gt;
&lt;/a&gt; (which are a type of Monte Carlo algorithm) and in that in &lt;a
	
		href = &#34;http://en.wikipedia.org/wiki/Swarm_intelligence#Ant-based_routing&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		Ant Colony
	&lt;/span&gt;
&lt;/a&gt; and &lt;a
	
		href = &#34;http://en.wikipedia.org/wiki/Swarm_intelligence#Crowd_simulation&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		Particle Swarm
	&lt;/span&gt;
&lt;/a&gt; routing are the main ones I am researching.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>I often get the question – a what am I working on today? Some of the things I can’t discuss in an open forum, but some I can. Those that I can, I thought it was best to share via my blog and do quick small posts on it. Will this become a new series? Well time will tell – depends on how much bandwidth I will have.</p>
<p>This weekend, I am researching <a
	
		href = "http://en.wikipedia.org/wiki/Optimization_%28mathematics%29"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		Optimisation Algorithms
	</span>
</a> – both Deterministic and Probabilistic. Specifically interested in <a
	
		href = "http://en.wikipedia.org/wiki/Swarm_intelligence"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		Swarm Intelligence
	</span>
</a> (which are a type of Monte Carlo algorithm) and in that in <a
	
		href = "http://en.wikipedia.org/wiki/Swarm_intelligence#Ant-based_routing"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		Ant Colony
	</span>
</a> and <a
	
		href = "http://en.wikipedia.org/wiki/Swarm_intelligence#Crowd_simulation"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		Particle Swarm
	</span>
</a> routing are the main ones I am researching.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Occasionally Connected Architecture</title>
      <link>/post/2011/06/occasionally-connected-architecture/</link>
      <pubDate>Thu, 16 Jun 2011 00:00:00 +0000</pubDate>
      <guid>/post/2011/06/occasionally-connected-architecture/</guid>
      <description>&lt;p&gt;When implementing an occasionally connected architecture for a solution, there are three fundamental requirements:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Part of the overall solution, some smart client is deployed and installed on the desktop and a web only approach is not possible. The main rational being that a smart client can work in a disconnected mode which of course with a web application is not possible.&lt;/li&gt;
&lt;li&gt;Underlying infrastructure needs to be in place to support this. Infrastructure is not specifically networks and servers, but also both the operational environment and the user’s environment and machine. The operational environments need to allow things such as: data caching, local storage of user data, user profile details, etc.&lt;/li&gt;
&lt;li&gt;More robust exception management process – this is not only about handling errors but also understanding the fact that the application is in a disconnected state and needs to do things differently.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;When designing an occasionally connected application, there are two design approaches that one can take - data centric or service oriented.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>When implementing an occasionally connected architecture for a solution, there are three fundamental requirements:</p>
<ol>
<li>Part of the overall solution, some smart client is deployed and installed on the desktop and a web only approach is not possible. The main rational being that a smart client can work in a disconnected mode which of course with a web application is not possible.</li>
<li>Underlying infrastructure needs to be in place to support this. Infrastructure is not specifically networks and servers, but also both the operational environment and the user’s environment and machine. The operational environments need to allow things such as: data caching, local storage of user data, user profile details, etc.</li>
<li>More robust exception management process – this is not only about handling errors but also understanding the fact that the application is in a disconnected state and needs to do things differently.</li>
</ol>
<p>When designing an occasionally connected application, there are two design approaches that one can take - data centric or service oriented.</p>
<ol>
<li><strong><strong>Data Centric</strong> – Applications had a RDBMS of some sort installed locally and use the built-in capabilities of that RDBMS to propagate and sync data including resolving any conflicts.</strong>
<ol>
<li>Server publishes data, which a client subscribes to and is copied locally. The conflict resolution (as changes can be both on the server or client) needs to be agreed upfront.</li>
<li>Generally the database’s built-in conflict resolution is used – this makes it simpler for the application as one does not need to build this in the application.</li>
<li>As there is only one data repository, the data convergence is guaranteed between the client and the server.</li>
<li>Both the client and the server are tightly coupled.</li>
<li>As a database needs to run locally, machines with small footprints or devices such as mobile phones will not be able to run this.</li>
<li>If deployment is an issue then there is more work required here.</li>
</ol>
</li>
<li><strong>Service-Oriented</strong> – Applications use the SOA paradigm and store information in messages which are queued (when disconnected) and send to the server when connected for processing.
<ol>
<li>The client can interact with any service required and focuses on the service requests instead of the local data i.e. are loosely coupled.</li>
<li>No local RDBMS required; of course some state information would still need to be saved.</li>
<li>Better when needs to interact outside of the firewall (e.g. Internet or Intranet)</li>
<li>Deployment is still required, but is simpler.</li>
</ol>
</li>
</ol>
<p>For Data centric application, from a design perspective the following aspects should be factored in:</p>
<ol>
<li>Application needs to be aware of the merge-replication schemes that are implemented as the application needs to optimise for data updates and conflicts.</li>
<li>As a result, ACID properties are not used for transactions; instead a pub-sub model is implemented.</li>
</ol>
<p>On the other hand, for Service-oriented apps, the application design should address the following:</p>
<ul>
<li>Application has to implement asynchronous communication.</li>
<li>Overall solution needs to keep all the network interactions simple and cannot be complex.</li>
<li>Application needs to add data caching capabilities</li>
<li>Application needs to implement robust connection management (e.g. Manual vs. Automatic)</li>
<li>Implement a store-and-forward mechanism such as using MSMQ.</li>
<li>Application needs to implement a robust data and business rule conflict manager.</li>
<li>Interacting with CRUD like Web services.</li>
<li>The application and the work can be logically broken into “chunks” to allow one using a task-based approach.</li>
<li>The application should be able to handle both forward and reverse dependencies which in turn could be complex business logic.</li>
</ul>
<p>As a high level guide, a data centric approach should be used when:</p>
<ul>
<li>One can deploy a database instance on the client.</li>
<li>The application can function in a two-tier environment.</li>
<li>One can tightly couple the client to the server through data schema definitions and communication protocol.</li>
<li>There is a need for built-in change tracking and synchronization.</li>
<li>One wants to rely on the database to handle data reconciliation conflicts and minimize the amount of custom reconciliation code that needs to be written.</li>
<li>There is no need to interact with multiple disparate services.</li>
<li>Users are able to connect to a database directly through a LAN/VPN/IPsec.</li>
</ul>
<p>And, a service oriented approach should be taken when:</p>
<ul>
<li>One wants to decouple the client and server to allow independent versioning and deployment.</li>
<li>There is a need for more control and flexibility over data reconciliation issues.</li>
<li>The delivery team has expertise to write more advanced application infrastructure code.</li>
<li>There is a need for a lightweight client footprint.</li>
<li>The applications can be structured into a service-oriented architecture.</li>
<li>There is a need for specific business functionality (for example, custom business rules and processing, flexible reconciliation, and so on).
<ul>
<li>Note: One might also need to look at a few good rules engine if this is the case.</li>
</ul>
</li>
<li>One needs control over the schema of data stored on the client and flexibility that might be different from the server.</li>
<li>The application needs to interact with multiple services using different communication technologies (Web services, Message Queuing, RPC, etc.).</li>
<li>There is a need for a custom security scheme.</li>
<li>The application needs to operate outside of the firewall.</li>
</ul>
]]></content:encoded>
    </item>
    <item>
      <title>C&#43;&#43; Message queuing options?</title>
      <link>/post/2010/12/c-message-queuing-options/</link>
      <pubDate>Wed, 29 Dec 2010 00:00:00 +0000</pubDate>
      <guid>/post/2010/12/c-message-queuing-options/</guid>
      <description>&lt;p&gt;I am thinking of implementing a queue in one of the projects I am working on right now (sorry cannot go into more details until it gets published - hopefully in a few months). Anywyas, this is in C++ which needs to run on Ubuntu and my queueing experience (with C++ or otherwise) is only with &lt;a
	
		href = &#34;http://msdn.microsoft.com/en-us/library/ms711472%28VS.85%29.aspx&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		MSMQ
	&lt;/span&gt;
&lt;/a&gt; which is brilliant, but does not help me here as that run only on Windows. I also cannot use something like &lt;a
	
		href = &#34;http://www.cplusplus.com/reference/stl/queue/&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		STL Queue
	&lt;/span&gt;
&lt;/a&gt; as this will need to run across a number of machines and trying to sync between them would a royal pain. In other words, this needs to be distributed and async &amp;ldquo;loose&amp;rdquo; messaging. :-)&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>I am thinking of implementing a queue in one of the projects I am working on right now (sorry cannot go into more details until it gets published - hopefully in a few months). Anywyas, this is in C++ which needs to run on Ubuntu and my queueing experience (with C++ or otherwise) is only with <a
	
		href = "http://msdn.microsoft.com/en-us/library/ms711472%28VS.85%29.aspx"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		MSMQ
	</span>
</a> which is brilliant, but does not help me here as that run only on Windows. I also cannot use something like <a
	
		href = "http://www.cplusplus.com/reference/stl/queue/"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		STL Queue
	</span>
</a> as this will need to run across a number of machines and trying to sync between them would a royal pain. In other words, this needs to be distributed and async &ldquo;loose&rdquo; messaging. :-)</p>
<p>I am already using <a
	
		href = "http://desigeek.com/blog/amit/2010/11/06/moos/"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		MOOS
	</span>
</a>, so one option is for me to continue to use that - however this is for another part of the application and it <em>might</em> be easier for me to use something else (still need to think it through a little more).</p>
<p>These are the requirements (these are must haves!). Also if it makes a difference I am using <a
	
		href = "http://eclipse.org/cdt/"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		CDT
	</span>
</a> for this project.</p>
<ul>
<li>Needs to be able to run on Ubuntu 9.04 (and higher)</li>
<li>Needs to be Open Source (cannot be commercial)</li>
<li>Needs to be able to store messages &ldquo;offline&rdquo;</li>
<li>Needs to be able to run on TCP with minimal dependencies. It would be nice not to have a whole bunch of underlying dependencies.</li>
<li>Preferably be easy to use (as a consumer) - I don&rsquo;t have much time to read through loads of documentation just to get my head around the underlying object model and how to use it.</li>
<li>C++ support (if it was not obvious until now)</li>
</ul>
<p>I did a little research online and came across the following, and wanted to get some feedback:</p>
<ul>
<li><a
	
		href = "http://activemq.apache.org/"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		ActiveMQ
	</span>
</a> - seems like it has good C++ support via <a
	
		href = "http://activemq.apache.org/cms/"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		CMS
	</span>
</a> (C++ Messaging Service).</li>
<li><a
	
		href = "http://aws.amazon.com/sqs/"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		Amazon SQS
	</span>
</a> -  not sure how good the C++ support is. If there is no library per se that I can use, then writing things around REST APIs might be more painful. Also I suddenly have a dependency to be able to go to the public internet. Also it is not free (though there is a free 100K messages / month).</li>
<li><a
	
		href = "Amateurish"
	

	

	>
	
	<span>
		MQ4CPP
	</span>
</a> - seems quite amateurish (kudos to the guy writing it though - seems like an interesting project to pick up when once has time).</li>
<li><a
	
		href = "http://www.rabbitmq.com/"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		RabbitMQ
	</span>
</a> - I know some guys used this at work (though that was using it in .NET); nothing for C++, but there <a
	
		href = "http://www.rabbitmq.com/download-ex.html#rabbitmq-c"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		some C experimental code
	</span>
</a>; overall does not inspire confidence (in the context of C++).</li>
<li>OpenAMQ - seems quite interesting and also has a <a
	
		href = "http://www.openamq.org/doc:prog-wireapi"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		C++ API
	</span>
</a> based on its WireAPI.</li>
<li>Anything else??</li>
</ul>
<p>At face value it seems like this is down to ActiveMQ and OpenAMQ. Just looking at the quick samples between the two ActiveMQ seems like more <a
	
		href = "http://activemq.apache.org/cms/example.html"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		C++ friendly
	</span>
</a> and easier to use <a
	
		href = "http://www.openamq.org/doc:prog-wireapi"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		compared to OpenAMQ
	</span>
</a>. Of course this is just the first impression and I could be completely wrong - it is not like I have had a chance to play with this (yet anyways).</p>
<p>Does anyone have any experience and feedback on this matter? Feel free to comment on this post, or tweet me.</p>
]]></content:encoded>
    </item>
    <item>
      <title>MOOS</title>
      <link>/post/2010/11/moos/</link>
      <pubDate>Sat, 06 Nov 2010 00:00:00 +0000</pubDate>
      <guid>/post/2010/11/moos/</guid>
      <description>&lt;p&gt;I don&amp;rsquo;t think many people have heard of &lt;a
	
		href = &#34;http://www.robots.ox.ac.uk/~mobile/MOOS/wiki/pmwiki.php/Main/Introduction&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		MOOS
	&lt;/span&gt;
&lt;/a&gt; (which stands of Mission Oriented Operating Suite); I have been working with it for the past few months as part of my dissertation. And I must admit, the more I play with it, the more impressed I am. It is quite simple and yet powerful.&lt;/p&gt;
&lt;p&gt;Whilst MOOS&amp;rsquo;s roots are in robotics (&lt;a
	
		href = &#34;http://ori.ox.ac.uk/&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		MRG
	&lt;/span&gt;
&lt;/a&gt;) and embedded systems, I wonder if I can extend it to use it some of the grid computing scenarios. Maybe implement a pMapReduce or pHadoop? Or perhaps a .NET implementation. Hmm, just need some time. If you need a robust, cross platform communication layer then check out &lt;a
	
		href = &#34;http://www.robots.ox.ac.uk/~mobile/MOOS/wiki/pmwiki.php/Main/Introduction&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		MOOS
	&lt;/span&gt;
&lt;/a&gt;.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>I don&rsquo;t think many people have heard of <a
	
		href = "http://www.robots.ox.ac.uk/~mobile/MOOS/wiki/pmwiki.php/Main/Introduction"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		MOOS
	</span>
</a> (which stands of Mission Oriented Operating Suite); I have been working with it for the past few months as part of my dissertation. And I must admit, the more I play with it, the more impressed I am. It is quite simple and yet powerful.</p>
<p>Whilst MOOS&rsquo;s roots are in robotics (<a
	
		href = "http://ori.ox.ac.uk/"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		MRG
	</span>
</a>) and embedded systems, I wonder if I can extend it to use it some of the grid computing scenarios. Maybe implement a pMapReduce or pHadoop? Or perhaps a .NET implementation. Hmm, just need some time. If you need a robust, cross platform communication layer then check out <a
	
		href = "http://www.robots.ox.ac.uk/~mobile/MOOS/wiki/pmwiki.php/Main/Introduction"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		MOOS
	</span>
</a>.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Analysis of Algorithms</title>
      <link>/post/2010/03/analysis-of-algorithms/</link>
      <pubDate>Fri, 26 Mar 2010 00:00:00 +0000</pubDate>
      <guid>/post/2010/03/analysis-of-algorithms/</guid>
      <description>&lt;p&gt;If you were interested in algorithms and interested in some mathematical foundations for algorithm analysis? For example if you are interested in proof techniques, probability, Amortization analysis techniques, Case studies and Asymptotic notions (such as Big-Oh, Big-Omega, Little-oh, little-omega, Big-Theta) then check out &lt;a
	
		href = &#34;http://csc.csudh.edu/jhan/Spring2005/csc401/LectureNotes/LectureNotes02.ppt&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		these lecture notes
	&lt;/span&gt;
&lt;/a&gt; (in ppt, 224kb) from California State University.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>If you were interested in algorithms and interested in some mathematical foundations for algorithm analysis? For example if you are interested in proof techniques, probability, Amortization analysis techniques, Case studies and Asymptotic notions (such as Big-Oh, Big-Omega, Little-oh, little-omega, Big-Theta) then check out <a
	
		href = "http://csc.csudh.edu/jhan/Spring2005/csc401/LectureNotes/LectureNotes02.ppt"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		these lecture notes
	</span>
</a> (in ppt, 224kb) from California State University.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Good UML Tool (and free too)</title>
      <link>/post/2007/12/good-uml-tool-and-free-too/</link>
      <pubDate>Mon, 03 Dec 2007 00:00:00 +0000</pubDate>
      <guid>/post/2007/12/good-uml-tool-and-free-too/</guid>
      <description>&lt;p&gt;Love it or hate it UML is important for anyone involved (Architect/Developer/Whoever) - either you need to create designs based on UML and you need to understand that someone else has. Sure it has its challenges and for some specific things there are better solutions (DSL&amp;rsquo;s - more on that some other day). I am &amp;ldquo;old school&amp;rdquo; and over the years have used &lt;a
	
		href = &#34;http://www-306.ibm.com/software/awdtools/developer/rose/index.html&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		Rational Rose
	&lt;/span&gt;
&lt;/a&gt; (or whatever IBM has renamed it to since buying Rational out).&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Love it or hate it UML is important for anyone involved (Architect/Developer/Whoever) - either you need to create designs based on UML and you need to understand that someone else has. Sure it has its challenges and for some specific things there are better solutions (DSL&rsquo;s - more on that some other day). I am &ldquo;old school&rdquo; and over the years have used <a
	
		href = "http://www-306.ibm.com/software/awdtools/developer/rose/index.html"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		Rational Rose
	</span>
</a> (or whatever IBM has renamed it to since buying Rational out).</p>
<p>But as are aware Rational tools are very pricey and I was on the look out for something reasonable. Most people have heard of <a
	
		href = "http://www.sparxsystems.com.au/products/ea.html"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		EA
	</span>
</a> (no, not the game company) which is a decent tool and not too expensive (at least the Desktop edition).</p>
<p>Of course if you are stingy like me and want something completely free then check out <a
	
		href = "http://www.staruml.com/"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		StarUML
	</span>
</a> which is an open source UML/MDA platform and is pretty decent. When you work with it enough you will find some annoying things - most of which has workarounds. There are one or two things it just cannot do, but I only have been using it for a few months now and am quite impressed. Is it better than the likes of <a
	
		href = "http://www.sparxsystems.com.au/products/ea.html"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		EA
	</span>
</a> or Rose, nope but it is pretty damn good for the price.</p>
<!-- [![image](images/image_thumb.png)](http://www.bahree.com/amit/blog_images/GoodUMLTool_D0E7/image.png) -->
<p><p>

    <img src="images/staruml-screenshot.jpg" alt=""/>

</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>Rules of Threading</title>
      <link>/post/2007/09/rules-of-threading/</link>
      <pubDate>Thu, 20 Sep 2007 00:00:00 +0000</pubDate>
      <guid>/post/2007/09/rules-of-threading/</guid>
      <description>&lt;p&gt;As Mr. Kale so eloquently puts it (and of course 100% correct):&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;If you think you need multi-threading, you&amp;rsquo;re wrong&lt;/li&gt;
&lt;li&gt;If your specification says &amp;ldquo;you need threading&amp;rdquo;, see Rule 1&lt;/li&gt;
&lt;li&gt;(For advanced users only) If you think you need multi-threading, you&amp;rsquo;re &lt;em&gt;probably&lt;/em&gt; wrong.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;p&gt;

    &lt;img src=&#34;http://desigeek.com/weblog/aggbug.aspx?PostID=4662&#34; alt=&#34;&#34;/&gt;

&lt;/p&gt;&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>As Mr. Kale so eloquently puts it (and of course 100% correct):</p>
<ol>
<li>If you think you need multi-threading, you&rsquo;re wrong</li>
<li>If your specification says &ldquo;you need threading&rdquo;, see Rule 1</li>
<li>(For advanced users only) If you think you need multi-threading, you&rsquo;re <em>probably</em> wrong.</li>
</ol>
<p><p>

    <img src="http://desigeek.com/weblog/aggbug.aspx?PostID=4662" alt=""/>

</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>Architect Insight presentations available</title>
      <link>/post/2007/03/architect-insight-presentations-available/</link>
      <pubDate>Fri, 16 Mar 2007 00:00:00 +0000</pubDate>
      <guid>/post/2007/03/architect-insight-presentations-available/</guid>
      <description>&lt;p&gt;I &lt;a
	
		href = &#34;http://desigeek.com/weblog/amit/archive/2007/02/15/microsoft-architect-insight-conference.aspx&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		had the opportunity to present
	&lt;/span&gt;
&lt;/a&gt; on .NET 3.0 in the Enterprise at the Architect Insight Conference hosted by Microsoft earlier this month. All the presentations from the conference are &lt;a
	
		href = &#34;http://www.microsoft.com/uk/msdn/architecture/architectinsight/2007download.mspx&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		available for download
	&lt;/span&gt;
&lt;/a&gt; and of course &lt;a
	
		href = &#34;http://download.microsoft.com/documents/uk/msdn/architecture/architectinsight/2007/Collaboration/COL05-NET-3.0-in-the-Enterprise.ppt&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		including my presentation
	&lt;/span&gt;
&lt;/a&gt; (13.6 mb).&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>I <a
	
		href = "http://desigeek.com/weblog/amit/archive/2007/02/15/microsoft-architect-insight-conference.aspx"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		had the opportunity to present
	</span>
</a> on .NET 3.0 in the Enterprise at the Architect Insight Conference hosted by Microsoft earlier this month. All the presentations from the conference are <a
	
		href = "http://www.microsoft.com/uk/msdn/architecture/architectinsight/2007download.mspx"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		available for download
	</span>
</a> and of course <a
	
		href = "http://download.microsoft.com/documents/uk/msdn/architecture/architectinsight/2007/Collaboration/COL05-NET-3.0-in-the-Enterprise.ppt"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		including my presentation
	</span>
</a> (13.6 mb).</p>
<p><p>

    <img src="http://desigeek.com/weblog/aggbug.aspx?PostID=3643" alt=""/>

</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>Microsoft Architect Insight Conference</title>
      <link>/post/2007/02/microsoft-architect-insight-conference/</link>
      <pubDate>Thu, 15 Feb 2007 00:00:00 +0000</pubDate>
      <guid>/post/2007/02/microsoft-architect-insight-conference/</guid>
      <description>&lt;p&gt;Microsoft hosts an annual event in the UK called the &lt;a
	
		href = &#34;http://www.microsoft.com/uk/msdn/architecture/architectinsight/default.mspx&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		Architect Insight Conference
	&lt;/span&gt;
&lt;/a&gt;. I am one of the speakers this year and will be presenting on &amp;ldquo;.NET 3.0 in the Enterprise&amp;rdquo;. This is a pretty good event and I would recommend it if you have not been to one of these. You can check out the &lt;a
	
		href = &#34;http://www.microsoft.co.uk/Events/registermulti.aspx?event=ArchitectInsight2007&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		Agenda here
	&lt;/span&gt;
&lt;/a&gt; and if you want, &lt;a
	
		href = &#34;http://www.microsoft.co.uk/Events/registermulti.aspx?event=ArchitectInsight2007&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		register here
	&lt;/span&gt;
&lt;/a&gt; and you can find out more information on &lt;a
	
		href = &#34;http://microsoft.com/uk/msdn/architecture/architectinsight/2007speakers.mspx&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		the Speakers here
	&lt;/span&gt;
&lt;/a&gt;. Here is a blurb from Microsoft on what can you expect to hear:&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Microsoft hosts an annual event in the UK called the <a
	
		href = "http://www.microsoft.com/uk/msdn/architecture/architectinsight/default.mspx"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		Architect Insight Conference
	</span>
</a>. I am one of the speakers this year and will be presenting on &ldquo;.NET 3.0 in the Enterprise&rdquo;. This is a pretty good event and I would recommend it if you have not been to one of these. You can check out the <a
	
		href = "http://www.microsoft.co.uk/Events/registermulti.aspx?event=ArchitectInsight2007"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		Agenda here
	</span>
</a> and if you want, <a
	
		href = "http://www.microsoft.co.uk/Events/registermulti.aspx?event=ArchitectInsight2007"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		register here
	</span>
</a> and you can find out more information on <a
	
		href = "http://microsoft.com/uk/msdn/architecture/architectinsight/2007speakers.mspx"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		the Speakers here
	</span>
</a>. Here is a blurb from Microsoft on what can you expect to hear:</p>
<blockquote>
<p>You’ll be able to engage in the technology debate with thought-provoking in-depth sessions from customer and partner architects along with members of the UK Microsoft Architect Council such as Avanade, Capgemini, Conchango and Solidsoft.</p>
<p>The agenda is split into seven tracks covering Enterprise, Real World, Identity, Lifecycle, SaaS, Collaboration and Dynamic Systems; the main content sessions will be 75 or 150 minutes in length to accommodate the different formats and levels of interaction that may be required.</p>
<p>There will be an emphasis on architectural ‘investigation’ through the use of small focus groups, as well as a structured networking clinic where individuals from similar vertical business backgrounds can discuss and work through a particular problem domain.</p></blockquote>
<p><p>

    <img src="http://desigeek.com/weblog/aggbug.aspx?PostID=3632" alt=""/>

</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>One man&#39;s feature is another man&#39;s bloat - The Java Performance Debate</title>
      <link>/post/2005/06/one-mans-feature-is-another-mans-bloat-the-java-performance-debate/</link>
      <pubDate>Tue, 14 Jun 2005 00:00:00 +0000</pubDate>
      <guid>/post/2005/06/one-mans-feature-is-another-mans-bloat-the-java-performance-debate/</guid>
      <description>&lt;p&gt;Firstly this is not a Java bashing and I don&amp;rsquo;t preach to say .NET/C++, etc is faster. However, based on what I have seen it sure is slow - slow like a snail. Maybe its the time that takes to load the VM or maybe it Swing - gurk! I like how Andy puts it - &amp;ldquo;One man&amp;rsquo;s feature is another man&amp;rsquo;s bloat&amp;rdquo;. He has a &lt;a
	
		href = &#34;http://www.osnews.com/story.php?news_id=10729&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		very objective article
	&lt;/span&gt;
&lt;/a&gt; on the area which are slow, what Sun is doing to address it and what the main issues (with the developers) are - who don&amp;rsquo;t know how to use it. He talks about the Memory, JVM, Desktop and Java2D.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Firstly this is not a Java bashing and I don&rsquo;t preach to say .NET/C++, etc is faster. However, based on what I have seen it sure is slow - slow like a snail. Maybe its the time that takes to load the VM or maybe it Swing - gurk! I like how Andy puts it - &ldquo;One man&rsquo;s feature is another man&rsquo;s bloat&rdquo;. He has a <a
	
		href = "http://www.osnews.com/story.php?news_id=10729"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		very objective article
	</span>
</a> on the area which are slow, what Sun is doing to address it and what the main issues (with the developers) are - who don&rsquo;t know how to use it. He talks about the Memory, JVM, Desktop and Java2D.</p>
]]></content:encoded>
    </item>
    <item>
      <title>CLR: Under the Hood</title>
      <link>/post/2005/06/clr-under-the-hood/</link>
      <pubDate>Thu, 02 Jun 2005 00:00:00 +0000</pubDate>
      <guid>/post/2005/06/clr-under-the-hood/</guid>
      <description>&lt;p&gt;The CLR team has a &lt;a
	
		href = &#34;http://www.microsoft.com/downloads/details.aspx?familyid=12f73ce1-7144-4077-b88d-976d82d64c6d&amp;amp;displaylang=en&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		couple of slides from their roadshow
	&lt;/span&gt;
&lt;/a&gt; where they talk about two tracks, one discusses what happens insight the CLR, if you have some of the books recommended in the presentation, none of this would be new to you. It covers things like the IL which is the abstract representation of an execution semantic and how that is represented using an abstract stack machine, where we consecutively execute each instruction, using the stack as the evaluation of that execution and how this stack abstraction works. And two, there is a discussion on perf engineering including the GC, costs and pitfalls, etc.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>The CLR team has a <a
	
		href = "http://www.microsoft.com/downloads/details.aspx?familyid=12f73ce1-7144-4077-b88d-976d82d64c6d&amp;displaylang=en"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		couple of slides from their roadshow
	</span>
</a> where they talk about two tracks, one discusses what happens insight the CLR, if you have some of the books recommended in the presentation, none of this would be new to you. It covers things like the IL which is the abstract representation of an execution semantic and how that is represented using an abstract stack machine, where we consecutively execute each instruction, using the stack as the evaluation of that execution and how this stack abstraction works. And two, there is a discussion on perf engineering including the GC, costs and pitfalls, etc.</p>
<p>On a different note, been out and about on a few days of holiday with family visiting, but its good to be back now. :)</p>
<p><p>

    <img src="http://desigeek.com/weblog/aggbug.aspx?PostID=764" alt=""/>

</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>Which encoding is better for webservices?</title>
      <link>/post/2005/04/which-encoding-is-better-for-webservices/</link>
      <pubDate>Tue, 12 Apr 2005 00:00:00 +0000</pubDate>
      <guid>/post/2005/04/which-encoding-is-better-for-webservices/</guid>
      <description>&lt;p&gt;There are two options when it comes to encoding in the context of webservices, e.g. .NET and Weblogic use document literal encoding while IBM and other vendors (Java) use RPC encoding. What is the difference and which one is better for which scenarios? Also, how easy is it to switch between the two?&lt;/p&gt;
&lt;p&gt;Well for those new to webservices, there are two options that you can choose when encoding your wsdl messages.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>There are two options when it comes to encoding in the context of webservices, e.g. .NET and Weblogic use document literal encoding while IBM and other vendors (Java) use RPC encoding. What is the difference and which one is better for which scenarios? Also, how easy is it to switch between the two?</p>
<p>Well for those new to webservices, there are two options that you can choose when encoding your wsdl messages.</p>
<p>So, how do they look like. If I &ldquo;borrow&rdquo; and example from <a
	
		href = "http://java.sun.com/developer/technicalArticles/xml/jaxrpcpatterns/"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		Sun
	</span>
</a>, if below was your original class in Java:</p>
<p><code>package com.examples.xmlstring;   import java.rmi.Remote;   import java.rmi.RemoteException;   public interface IStringService extends Remote {       public String sayXMLHello(String xml)           throws RemoteException;       }</code></p>
<p>The rpc encoding for that looks like this:</p>
<p><code>&lt;binding name=&quot;IStringServiceBinding&quot; type=&quot;tns:IStringService&quot;&gt;       &lt;soap:binding transport=&quot;http://schemas.xmlsoap.org/soap/http&quot; **style=&quot;rpc&quot;**/&gt;       &lt;operation name=&quot;sayXMLHello&quot;&gt;           &lt;soap:operation soapaction=&quot;&quot;/&gt;               &lt;input&gt;                   &lt;soap:body encodingstyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; **use=&quot;encoded&quot;** namespace=&quot;http://www.examples.com/wsdl/StringService&quot;/&gt;               &lt;/input&gt;               &lt;output&gt;                   &lt;soap:body encodingstyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; **use=&quot;encoded&quot;** namespace=&quot;http://www.examples.com/wsdl/StringService&quot;/&gt;               &lt;/output&gt;       &lt;/operation&gt;   &lt;/binding&gt;</code></p>
<p>And the document encoding looks like:</p>
<p><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;       &lt;env:envelope xmlns:env=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:enc=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; xmlns:ns0=&quot;http://www.examples.com/types&quot;&gt;           &lt;env:body&gt;               &lt;ns0:sayxmlhello&gt;                   &lt;string_1&gt;Hello World&lt;/string_1&gt;               &lt;/ns0:sayxmlhello&gt;           &lt;/env:body&gt;   &lt;/env:envelope&gt;</code></p>
<p>I think in the end the real thing to keep in perspective is who and what will be consuming this? If your clients are primarily MS-based (COM/.NET) then you are better off with literal encoding, on the other hand if its primarily J2EE client then you are better off with the other one. But, more interestingly if you don&rsquo;t know (or in other words can be both), then which road to take?</p>
<p><p>

    <img src="http://desigeek.com/weblog/aggbug.aspx?PostID=672" alt=""/>

</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>Web Services are not distributed objects</title>
      <link>/post/2005/03/web-services-are-not-distributed-objects/</link>
      <pubDate>Thu, 24 Mar 2005 00:00:00 +0000</pubDate>
      <guid>/post/2005/03/web-services-are-not-distributed-objects/</guid>
      <description>&lt;p&gt;Werner Vogel, CTO of Amazon.com &lt;a
	
		href = &#34;http://weblogs.cs.cornell.edu/AllThingsDistributed/archives/000343.html&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		has an article
	&lt;/span&gt;
&lt;/a&gt; which was published a few months ago where we talks about the misconception of how most people think that web services are distributed objects. Here is an excerpt from the article.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The hype surrounding Web services has generated many common misconceptions about the fundamentals of this emerging technology.&lt;/p&gt;
&lt;p&gt;Web services are frequently described as the latest incarnation of distributed object technology. This misconception, perpetuated by people from both industry and academia, seriously limits broader acceptance of the true Web services architecture. Although the architects of many distributed and Internet systems have been vocal about the differences between Web services and distributed objects, dispelling the myth that they are closely related appears difficult.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Werner Vogel, CTO of Amazon.com <a
	
		href = "http://weblogs.cs.cornell.edu/AllThingsDistributed/archives/000343.html"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		has an article
	</span>
</a> which was published a few months ago where we talks about the misconception of how most people think that web services are distributed objects. Here is an excerpt from the article.</p>
<blockquote>
<p>The hype surrounding Web services has generated many common misconceptions about the fundamentals of this emerging technology.</p>
<p>Web services are frequently described as the latest incarnation of distributed object technology. This misconception, perpetuated by people from both industry and academia, seriously limits broader acceptance of the true Web services architecture. Although the architects of many distributed and Internet systems have been vocal about the differences between Web services and distributed objects, dispelling the myth that they are closely related appears difficult.</p>
<p>Many believe that Web services is a distributed systems technology that relies on some form of distributed object technology. Unfortunately, this is not the only common misconception about Web services. In this article, I seek to clarify several widely held beliefs about the technology that are partially or completely wrong.</p>
<p><strong>Fundamental Errors</strong>: At the International World Wide Web Conference in May 2003, a smart and gifted Internet architect I will call Peter asked me, “Don’t you think Web services will fail like all the other wide-area distributed object technologies that people have tried to build?” I was baffled. How could someone like Peter still view Web services as distributed object technology? Yet, he is not alone in his stubbornness: many developers, architects, managers, and academics still see Web services as the next episode in a saga that includes Corba, DCOM, and remote method invocation (RMI). Web services are distributed systems technologies, but that is where the common ground ends. The only possible relation is that Web services are now sometimes deployed in areas where distributed object applications have failed in the past. Within the distributed technology world, it is probably more appropriate to associate Web services with messaging technologies because they share a common architectural view, although they address different application types.</p>
<p>Given that Web services are based on XML documents and document exchange, we could say their technological underpinning is document-oriented computing. However, exchanging documents is very different from requesting an object’s instantiation, requesting a method’s invocation on the basis of the specific object instance, receiving that invocation’s result in a response, and releasing the object instance after several such exchanges.</p>
<p>I frequently encounter about a dozen other statements that fall into the same basic category. I hear people say, for example, that “Web services are just remote procedure calls for the Internet,” or “You need HTTP to make Web services work.” Before addressing several of the more common misconceptions, we should define a Web service in its purest form in order to begin with a clear model.</p></blockquote>
<p><p>

    <img src="http://desigeek.com/weblog/aggbug.aspx?PostID=644" alt=""/>

</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>Examination of Data Structures in .NET 2.0</title>
      <link>/post/2005/03/examination-of-data-structures-in-net-2-0/</link>
      <pubDate>Tue, 01 Mar 2005 00:00:00 +0000</pubDate>
      <guid>/post/2005/03/examination-of-data-structures-in-net-2-0/</guid>
      <description>&lt;p&gt;You might have seen this already, if not, MSDN has a &lt;a
	
		href = &#34;http://msdn.microsoft.com/vcsharp/using/understanding/netfundamentals/datastructures/&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		six-part article extensively examining
	&lt;/span&gt;
&lt;/a&gt; the data structures in .NET 2.0 covering the usual suspects and then some not-so-usual unless you have written some compilers such as BST’s, graphs, red-back trees, etc. Quite an interesting read when you have some time.&lt;/p&gt;
&lt;p&gt;&lt;p&gt;

    &lt;img src=&#34;http://desigeek.com/weblog/aggbug.aspx?PostID=615&#34; alt=&#34;&#34;/&gt;

&lt;/p&gt;&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>You might have seen this already, if not, MSDN has a <a
	
		href = "http://msdn.microsoft.com/vcsharp/using/understanding/netfundamentals/datastructures/"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		six-part article extensively examining
	</span>
</a> the data structures in .NET 2.0 covering the usual suspects and then some not-so-usual unless you have written some compilers such as BST’s, graphs, red-back trees, etc. Quite an interesting read when you have some time.</p>
<p><p>

    <img src="http://desigeek.com/weblog/aggbug.aspx?PostID=615" alt=""/>

</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>Enterprise Library</title>
      <link>/post/2005/01/enterprise-library/</link>
      <pubDate>Sat, 29 Jan 2005 00:00:00 +0000</pubDate>
      <guid>/post/2005/01/enterprise-library/</guid>
      <description>&lt;p&gt;Microsoft released the &lt;a
	
		href = &#34;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/entlib.asp&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		Enterprise Library
	&lt;/span&gt;
&lt;/a&gt; based on &lt;a
	
		href = &#34;http://www.avanade.com/_uploaded/pdf/solution/acanet.pdf&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		ACA.NET
	&lt;/span&gt;
&lt;/a&gt; which our engineering guys here at Avanade, work their butts off! Enterprise Library features new and updated versions of application blocks that were previously available as stand-alone application blocks. All Enterprise Library application blocks have been updated with a particular focus on consistency, extensibility, ease of use, and integration.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Microsoft released the <a
	
		href = "http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/entlib.asp"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		Enterprise Library
	</span>
</a> based on <a
	
		href = "http://www.avanade.com/_uploaded/pdf/solution/acanet.pdf"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		ACA.NET
	</span>
</a> which our engineering guys here at Avanade, work their butts off! Enterprise Library features new and updated versions of application blocks that were previously available as stand-alone application blocks. All Enterprise Library application blocks have been updated with a particular focus on consistency, extensibility, ease of use, and integration.</p>
<p>The application blocks that comprise the Enterprise Library are the following:</p>
<ul>
<li>Caching Application Block. This application block allows developers to incorporate a local cache in their applications.</li>
<li>Configuration Application Block. This application block allows applications to read and write configuration information.</li>
<li>Data Access Application Block. This application block allows developers to incorporate standard database functionality in their applications.</li>
<li>Cryptography Application Block. This application block allows developers to include encryption and hashing functionality in their applications.</li>
<li>Exception Handling Application Block. This application block allows developers and policy makers to create a consistent strategy for processing exceptions that occur throughout the architectural layers of enterprise applications.</li>
<li>Logging and Instrumentation Application Block. This application block allows developers to incorporate standard logging and instrumentation functionality in their applications.</li>
<li>Security Application Block. This application block allows developers to incorporate security functionality in their applications. Applications can use the application block in a variety of situations, such as authenticating and authorising users against a database, retrieving role and profile information, and caching user profile information.</li>
</ul>
<p>Different applications have different requirements and you will not find that every application block is useful in every application that you build. Before using an application block, you should have a good understanding of your application requirements and of the scenarios that the application block is designed to address.</p>
<p>You can also get some more information on <a
	
		href = "http://weblogs.asp.net/tomholl/"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		Tom&rsquo;s blog
	</span>
</a>.</p>
<p><p>

    <img src="http://desigeek.com/weblog/aggbug.aspx?PostID=578" alt=""/>

</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>Testing .NET Application Blocks (Version 1.0)</title>
      <link>/post/2005/01/testing-net-application-blocks-version-1-0/</link>
      <pubDate>Tue, 18 Jan 2005 00:00:00 +0000</pubDate>
      <guid>/post/2005/01/testing-net-application-blocks-version-1-0/</guid>
      <description>&lt;p&gt;A little while ago while I was one of the industry advisors for the &lt;a
	
		href = &#34;http://www.microsoft.com/resources/practices/&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		PAG group
	&lt;/span&gt;
&lt;/a&gt; at Microsoft. One of the last things I did in that capacity was provide input to the the &lt;a
	
		href = &#34;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/mtf.asp&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		Testing App blocks
	&lt;/span&gt;
&lt;/a&gt; for MS. Microsoft has finally released this and can be &lt;a
	
		href = &#34;http://www.microsoft.com/downloads/details.aspx?FamilyId=BC99325A-59AE-401D-9812-D40D10366396&amp;amp;displaylang=en&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		downloaded here
	&lt;/span&gt;
&lt;/a&gt;.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>A little while ago while I was one of the industry advisors for the <a
	
		href = "http://www.microsoft.com/resources/practices/"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		PAG group
	</span>
</a> at Microsoft. One of the last things I did in that capacity was provide input to the the <a
	
		href = "http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/mtf.asp"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		Testing App blocks
	</span>
</a> for MS. Microsoft has finally released this and can be <a
	
		href = "http://www.microsoft.com/downloads/details.aspx?FamilyId=BC99325A-59AE-401D-9812-D40D10366396&amp;displaylang=en"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		downloaded here
	</span>
</a>.</p>
<blockquote>
<p>Testing .NET Application Blocks covers many testing areas that were used during testing and verification of the various application blocks provided by Microsoft&rsquo;s patterns &amp; practices group, such as functional, globalization, performance, integration, and security. The guide uses code examples, sample test cases, and checklists to demonstrate how to plan and implement each type of test; the guide also recommends tools to use to run the tests. It covers test considerations to be taken into account when customizing these application blocks or integrating them with your own applications.</p>
<p>Because this guide focuses on testing NET application blocks, its scope does not include user interface (UI) testing or database testing. Although the guidance is developed within the context of Microsoft patterns &amp; practices application blocks, it still applies to testing .NET code in general.</p></blockquote>
<p>[Listening to: Nach Deutschland - The Bourne Supremacy - The Bourne Supremacy (02:40)]</p>
<p><p>

    <img src="http://desigeek.com/weblog/aggbug.aspx?PostID=563" alt=""/>

</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>Data Concurrency and Mobile Applications</title>
      <link>/post/2004/11/data-concurrency-and-mobile-applications/</link>
      <pubDate>Sat, 27 Nov 2004 00:00:00 +0000</pubDate>
      <guid>/post/2004/11/data-concurrency-and-mobile-applications/</guid>
      <description>&lt;p&gt;As I start working on some stuff, I have been thinking of this. Essentially when you are dealing with mobile devices, by their very nature they are disconnected in nature, and not always on a network (such as desktop or laptop). In multi-user environments, the challenge is how to you keep the data concurrent between the &amp;ldquo;online&amp;rdquo; and &amp;ldquo;offline&amp;rdquo; version? Typically there are two scenarios either you do optimistic concurrency or pessimistic concurrency. The earlier being a device (rather a client/user), submits both the currents and previous state and then the data is updated only if there have not been any changes since the device last synched. Pessimistic locking is when the application locks all the records the device intents to update - this of course is not a good idea.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>As I start working on some stuff, I have been thinking of this. Essentially when you are dealing with mobile devices, by their very nature they are disconnected in nature, and not always on a network (such as desktop or laptop). In multi-user environments, the challenge is how to you keep the data concurrent between the &ldquo;online&rdquo; and &ldquo;offline&rdquo; version? Typically there are two scenarios either you do optimistic concurrency or pessimistic concurrency. The earlier being a device (rather a client/user), submits both the currents and previous state and then the data is updated only if there have not been any changes since the device last synched. Pessimistic locking is when the application locks all the records the device intents to update - this of course is not a good idea.</p>
<p>But, in real life, neither of these issues are really ideal. How best to deal with situations where e.g. a sales person who is on the road could not (or does not) connect to the network to synch up and the person in the office updates the record? How do you deal with those situations. One solution is to update only the changes fields, and the rest are either rejected or the user needs to manually confirm each change and pick which ones take precedence. This along with the fact that in real life data can be segregated to some extent on a user level would suffice? Another thing to dwell upon, for most Mobile applications (especially disconnected), going the SOA way is what makes more sense. Since each time you sync up or submit something (if its on gprs for example), your client running on the device should just consume the service and really cannot be bothered by any more details than that (more on this on another post soon).</p>
<p>But, still seems quite fragile with lots of areas for failure. What are you thoughts? Is there a better way to do this that would make it more robust?</p>
<p><p>

    <img src="http://desigeek.com/weblog/aggbug.aspx?PostID=460" alt=""/>

</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>HTTP Modules and HTTP Handlers</title>
      <link>/post/2004/10/http-modules-and-http-handlers/</link>
      <pubDate>Thu, 28 Oct 2004 00:00:00 +0000</pubDate>
      <guid>/post/2004/10/http-modules-and-http-handlers/</guid>
      <description>&lt;p&gt;ASP.NET has a pretty interesting HTTP runtime architecture if you have ever dug into the covers. The basic run-time support has API&amp;rsquo;s as powerful as ISAPI (in IIS). ASP.NET offers IHttpHandler and IHttpModule interfaces that offer you similar functionality. I will get into each one in a little bit of detail, but at a high level IHttpHandler is analogous to what would be an ISAPI extension in IIS and IHttpModule would be analogous to what a ISAPI filter in IIS. As a matter of fact, each asp.net page (.aspx) you have in your project is essentially an HTTP Handler.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>ASP.NET has a pretty interesting HTTP runtime architecture if you have ever dug into the covers. The basic run-time support has API&rsquo;s as powerful as ISAPI (in IIS). ASP.NET offers IHttpHandler and IHttpModule interfaces that offer you similar functionality. I will get into each one in a little bit of detail, but at a high level IHttpHandler is analogous to what would be an ISAPI extension in IIS and IHttpModule would be analogous to what a ISAPI filter in IIS. As a matter of fact, each asp.net page (.aspx) you have in your project is essentially an HTTP Handler.</p>
<p><strong>HTTP Handlers:</strong></p>
<p>The “handlers” are nothing but assemblies (class libraries) that implement IHttpHandler and IHttpAsyncHandler interfaces. Essentially, ASP.NET maps each http request to a http handler. The handler in turn enables processing individual url&rsquo;s or groups of url&rsquo;s with similar extensions such as .aspx, .asmx, .ascx, .disco, etc. The handler can be synchronous or asynchronous, the earlier does not return until it finished processing and the latter typically launches a separate process.</p>
<p>When you inherit from IHttpHandler handler, you need to implement both the ProcessRequest method (which processes the individual http requests) and the IsReusable property (which specifies if pooling is supported or not). If you have a more complex set of logic then you should look at inheriting IHttpHandlerFactory, as that allows finer control and you can create different handler based on your need. E.g. you can create a separate handler for GET and PUT.</p>
<p>When you are finished building the handler (essentially compiling your assembly), you need to register it to use it. To register a handler essentially you copy the assembly in the bin folder of where you web app is running and create a section in the web.config. (I&rsquo;ll have a sample in a bit in this post). You might also want to ensure that the HTTP handler&rsquo;s extension is registered with IIS.</p>
<p><strong>General process of Building a Handler:</strong></p>
<ol>
<li>Implement the IHttpHandler interface</li>
<li>Handle the ProcessRequest method and IsRuseable property.</li>
<li>Deploy the assembly</li>
<li>Register the handler</li>
</ol>
<p>Below is an example of a handler that processes request for the files with the extension “.desigeek”. Note, that you do not need to have a physical file present with that extension.</p>
<div class="highlight"><div style="color:#cad3f5;background-color:#24273a;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#cad3f5;background-color:#24273a;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="1"><a style="outline:none;text-decoration:none;color:inherit" href="#1"> 1</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="2"><a style="outline:none;text-decoration:none;color:inherit" href="#2"> 2</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="3"><a style="outline:none;text-decoration:none;color:inherit" href="#3"> 3</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="4"><a style="outline:none;text-decoration:none;color:inherit" href="#4"> 4</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="5"><a style="outline:none;text-decoration:none;color:inherit" href="#5"> 5</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="6"><a style="outline:none;text-decoration:none;color:inherit" href="#6"> 6</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="7"><a style="outline:none;text-decoration:none;color:inherit" href="#7"> 7</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="8"><a style="outline:none;text-decoration:none;color:inherit" href="#8"> 8</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="9"><a style="outline:none;text-decoration:none;color:inherit" href="#9"> 9</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="10"><a style="outline:none;text-decoration:none;color:inherit" href="#10">10</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="11"><a style="outline:none;text-decoration:none;color:inherit" href="#11">11</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="12"><a style="outline:none;text-decoration:none;color:inherit" href="#12">12</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="13"><a style="outline:none;text-decoration:none;color:inherit" href="#13">13</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="14"><a style="outline:none;text-decoration:none;color:inherit" href="#14">14</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="15"><a style="outline:none;text-decoration:none;color:inherit" href="#15">15</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="16"><a style="outline:none;text-decoration:none;color:inherit" href="#16">16</a>
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#cad3f5;background-color:#24273a;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-csharp" data-lang="csharp"><span style="display:flex;"><span><span style="color:#ed8796">public</span> <span style="color:#c6a0f6">class</span> <span style="color:#eed49f">DesigeekHandler</span> : IHttpHandler {
</span></span><span style="display:flex;"><span>   <span style="color:#ed8796">bool</span> IHttpHandler.IsReusable { 
</span></span><span style="display:flex;"><span>      <span style="color:#c6a0f6">get</span> { 
</span></span><span style="display:flex;"><span>        <span style="color:#c6a0f6">return</span> <span style="color:#f5a97f">false</span>;
</span></span><span style="display:flex;"><span>      }  
</span></span><span style="display:flex;"><span>   }
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#c6a0f6">void</span> IHttpHandler.ProcessRequest( HttpContext context ) {
</span></span><span style="display:flex;"><span>    HttpResponse response = context.Response;  
</span></span><span style="display:flex;"><span>    
</span></span><span style="display:flex;"><span>    response.Write( <span style="color:#a6da95">&#34;&lt; html&gt;&#34;</span> );  
</span></span><span style="display:flex;"><span>    response.Write( <span style="color:#a6da95">&#34;&lt; body&gt;&#34;</span> );  
</span></span><span style="display:flex;"><span>    response.Write( <span style="color:#a6da95">&#34;&lt; h1&gt; Hello from Desigeek custom handler. &lt; /h1&gt;&#34;</span> );  
</span></span><span style="display:flex;"><span>    response.Write( <span style="color:#a6da95">&#34;&lt; /body&gt;&#34;</span> );  
</span></span><span style="display:flex;"><span>    response.Write( <span style="color:#a6da95">&#34;&lt; /html&gt;&#34;</span> );
</span></span><span style="display:flex;"><span>}</span></span></code></pre></td></tr></table>
</div>
</div>
<p>Register the HTTP handler by creating an entry in the web.config:</p>
<div class="highlight"><div style="color:#cad3f5;background-color:#24273a;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#cad3f5;background-color:#24273a;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="1"><a style="outline:none;text-decoration:none;color:inherit" href="#1">1</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="2"><a style="outline:none;text-decoration:none;color:inherit" href="#2">2</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="3"><a style="outline:none;text-decoration:none;color:inherit" href="#3">3</a>
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#cad3f5;background-color:#24273a;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-xml" data-lang="xml"><span style="display:flex;"><span><span style="color:#c6a0f6">&lt;httpHandlers</span><span style="color:#ed8796">\</span><span style="color:#c6a0f6">&gt;</span>  
</span></span><span style="display:flex;"><span> <span style="color:#c6a0f6">&lt;add</span> <span style="color:#ed8796">verb\=&#34;\*&#34;</span> <span style="color:#ed8796">path\=&#34;\*.desigeek&#34;</span> <span style="color:#ed8796">type\=&#34;MyHTTPHandler.DesigeekHandler,</span> <span style="color:#ed8796">MyHTTPHandler&#34;</span><span style="color:#c6a0f6">/&gt;</span>  
</span></span><span style="display:flex;"><span>httpHandlers\&gt;</span></span></code></pre></td></tr></table>
</div>
</div>
<p>Below is a sample of what the request would look like. Notice the URL requested is “foo.desigeek” (and there is no physical file with that name on the file system. The first screen-shot is of the web application (which basically is one label which is updated with the system time on PageLoad). The second one is where the handler kicks in.</p>
<p><p>

    <img src="images/httphandler1.png" alt=""/>

</p></p>
<p><p>

    <img src="images/httphandler2.png" alt=""/>

</p></p>
<p><strong>HTTP Module:</strong></p>
<p>HTTP modules are classes that can be configured to run in response to events that fire during the request for an ASP.NET resource (which can be serviced by any handler). An HTTP module is an assembly that implements the IHttpModule interface and handles events. ASP.NET ships with a number of modules out of the box e.g. SessionStateModule is used to supply session state services to an application.</p>
<p>If you check your machine.config you will there are a number of handlers that come with ASP.NET. e.g you might look at something like:</p>
<div class="highlight"><div style="color:#cad3f5;background-color:#24273a;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#cad3f5;background-color:#24273a;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="1"><a style="outline:none;text-decoration:none;color:inherit" href="#1">1</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="2"><a style="outline:none;text-decoration:none;color:inherit" href="#2">2</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="3"><a style="outline:none;text-decoration:none;color:inherit" href="#3">3</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="4"><a style="outline:none;text-decoration:none;color:inherit" href="#4">4</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="5"><a style="outline:none;text-decoration:none;color:inherit" href="#5">5</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="6"><a style="outline:none;text-decoration:none;color:inherit" href="#6">6</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="7"><a style="outline:none;text-decoration:none;color:inherit" href="#7">7</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="8"><a style="outline:none;text-decoration:none;color:inherit" href="#8">8</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="9"><a style="outline:none;text-decoration:none;color:inherit" href="#9">9</a>
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#cad3f5;background-color:#24273a;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-xml" data-lang="xml"><span style="display:flex;"><span><span style="color:#c6a0f6">&lt; httpModules&gt;</span>  
</span></span><span style="display:flex;"><span>    <span style="color:#c6a0f6">&lt; add</span> <span style="color:#8aadf4">name=</span><span style="color:#a6da95">&#34;OutputCache&#34;</span> <span style="color:#8aadf4">type=</span><span style="color:#a6da95">&#34;System.Web.Caching.OutputCacheModule, .../&gt;  
</span></span></span><span style="display:flex;"><span><span style="color:#a6da95">    &lt; add name=&#34;</span><span style="color:#ed8796">Session&#34;</span> <span style="color:#8aadf4">type=</span><span style="color:#a6da95">&#34;System.Web.SessionState.SessionStateModule, .../&gt;  
</span></span></span><span style="display:flex;"><span><span style="color:#a6da95">    &lt; add name=&#34;</span><span style="color:#ed8796">WindowsAuthentication&#34;</span> <span style="color:#8aadf4">type=</span><span style="color:#a6da95">&#34;System.Web.Security.WindowsAuthenticationModule, .../&gt;  
</span></span></span><span style="display:flex;"><span><span style="color:#a6da95">    &lt; add name=&#34;</span><span style="color:#ed8796">FormsAuthentication&#34;</span> <span style="color:#8aadf4">type=</span><span style="color:#a6da95">&#34;System.Web.Security.FormsAuthenticationModule .../&gt;  
</span></span></span><span style="display:flex;"><span><span style="color:#a6da95">    &lt; add name=&#34;</span><span style="color:#ed8796">PassportAuthentication&#34;</span> <span style="color:#8aadf4">type=</span><span style="color:#a6da95">&#34;System.Web.Security.PassportAuthenticationModule .../&gt;  
</span></span></span><span style="display:flex;"><span><span style="color:#a6da95">    &lt; add name=&#34;</span><span style="color:#ed8796">UrlAuthorization&#34;</span> <span style="color:#8aadf4">type=</span><span style="color:#a6da95">&#34;System.Web.Security.UrlAuthorizationModule, .../&gt;  
</span></span></span><span style="display:flex;"><span><span style="color:#a6da95">    &lt; add name=&#34;</span><span style="color:#ed8796">FileAuthorization&#34;</span> <span style="color:#8aadf4">type=</span><span style="color:#a6da95">&#34;System.Web.Security.FileAuthorizationModule,</span> <span style="color:#ed8796">...</span><span style="color:#c6a0f6">/&gt;</span>  
</span></span><span style="display:flex;"><span><span style="color:#c6a0f6">&lt; /httpModules&gt;</span></span></span></code></pre></td></tr></table>
</div>
</div>
<p>Basically you follow the similar process as HTTP handlers. Once you have created your assembly you deploy it to the bin folder and register your handler. The general process for writing an HTTP module is:</p>
<ul>
<li>Implement the IHttpModule interface.</li>
<li>Handle the Init method and register for the events you need.</li>
<li>Handle the events.</li>
<li>Optionally implement the Dispose method if you have to do cleanup.</li>
<li>Register the module in Web.config.</li>
</ul>
<p>Here is an example which hooks into the BeginRequest and EndRequest events of HttpApplication and adds “DesigeekModule: Begin of Request“ and “DesigeekModule: End of Request“ to the response being send out to the client. The <code>Init()</code> function is where your register the hooks you want.</p>
<div class="highlight"><div style="color:#cad3f5;background-color:#24273a;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#cad3f5;background-color:#24273a;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="1"><a style="outline:none;text-decoration:none;color:inherit" href="#1"> 1</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="2"><a style="outline:none;text-decoration:none;color:inherit" href="#2"> 2</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="3"><a style="outline:none;text-decoration:none;color:inherit" href="#3"> 3</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="4"><a style="outline:none;text-decoration:none;color:inherit" href="#4"> 4</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="5"><a style="outline:none;text-decoration:none;color:inherit" href="#5"> 5</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="6"><a style="outline:none;text-decoration:none;color:inherit" href="#6"> 6</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="7"><a style="outline:none;text-decoration:none;color:inherit" href="#7"> 7</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="8"><a style="outline:none;text-decoration:none;color:inherit" href="#8"> 8</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="9"><a style="outline:none;text-decoration:none;color:inherit" href="#9"> 9</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="10"><a style="outline:none;text-decoration:none;color:inherit" href="#10">10</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="11"><a style="outline:none;text-decoration:none;color:inherit" href="#11">11</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="12"><a style="outline:none;text-decoration:none;color:inherit" href="#12">12</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="13"><a style="outline:none;text-decoration:none;color:inherit" href="#13">13</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="14"><a style="outline:none;text-decoration:none;color:inherit" href="#14">14</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="15"><a style="outline:none;text-decoration:none;color:inherit" href="#15">15</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="16"><a style="outline:none;text-decoration:none;color:inherit" href="#16">16</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="17"><a style="outline:none;text-decoration:none;color:inherit" href="#17">17</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="18"><a style="outline:none;text-decoration:none;color:inherit" href="#18">18</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="19"><a style="outline:none;text-decoration:none;color:inherit" href="#19">19</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="20"><a style="outline:none;text-decoration:none;color:inherit" href="#20">20</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="21"><a style="outline:none;text-decoration:none;color:inherit" href="#21">21</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="22"><a style="outline:none;text-decoration:none;color:inherit" href="#22">22</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="23"><a style="outline:none;text-decoration:none;color:inherit" href="#23">23</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="24"><a style="outline:none;text-decoration:none;color:inherit" href="#24">24</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="25"><a style="outline:none;text-decoration:none;color:inherit" href="#25">25</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="26"><a style="outline:none;text-decoration:none;color:inherit" href="#26">26</a>
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#cad3f5;background-color:#24273a;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-csharp" data-lang="csharp"><span style="display:flex;"><span><span style="color:#ed8796">public</span> <span style="color:#c6a0f6">class</span> <span style="color:#eed49f">DesigeekModule</span> : IHttpModule  {
</span></span><span style="display:flex;"><span>  
</span></span><span style="display:flex;"><span>  <span style="color:#6e738d;font-style:italic">//you register the events you are want to hook in this function</span>
</span></span><span style="display:flex;"><span>  <span style="color:#c6a0f6">void</span> IHttpModule.Init( HttpApplication context ) {
</span></span><span style="display:flex;"><span>       context.BeginRequest += ( <span style="color:#c6a0f6">new</span> EventHandler( <span style="color:#c6a0f6">this</span>.App<span style="color:#ed8796">\</span>_BeginRequest ) );  
</span></span><span style="display:flex;"><span>       context.EndRequest += ( <span style="color:#c6a0f6">new</span> EventHandler( <span style="color:#c6a0f6">this</span>.App<span style="color:#ed8796">\</span>_EndRequest ) );  
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#ed8796">private</span> <span style="color:#c6a0f6">void</span> App<span style="color:#ed8796">\</span>_EndRequest( <span style="color:#ed8796">object</span> source, EventArgs e ) {
</span></span><span style="display:flex;"><span>      HttpApplication app = (HttpApplication)source;  
</span></span><span style="display:flex;"><span>      HttpContext context = app.Context;  
</span></span><span style="display:flex;"><span>      context.Response.Write( <span style="color:#a6da95">&#34;DesigeekModule: END of Request&#34;</span> );
</span></span><span style="display:flex;"><span>  }  
</span></span><span style="display:flex;"><span>  
</span></span><span style="display:flex;"><span>  <span style="color:#ed8796">private</span> <span style="color:#c6a0f6">void</span> App<span style="color:#ed8796">\</span>_BeginRequest( <span style="color:#ed8796">object</span> source, EventArgs e ) {
</span></span><span style="display:flex;"><span>      HttpApplication app = (HttpApplication)source;  
</span></span><span style="display:flex;"><span>      HttpContext context = app.Context;  
</span></span><span style="display:flex;"><span>      context.Response.Write( <span style="color:#a6da95">&#34;DesigeekModule: BEGIN of Request&#34;</span> );
</span></span><span style="display:flex;"><span>  }  
</span></span><span style="display:flex;"><span>  
</span></span><span style="display:flex;"><span>  <span style="color:#ed8796">public</span> <span style="color:#ed8796">string</span> ModuleName {  
</span></span><span style="display:flex;"><span>      <span style="color:#c6a0f6">get</span> {
</span></span><span style="display:flex;"><span>        <span style="color:#c6a0f6">return</span> <span style="color:#a6da95">&#34;DesigeekModule&#34;</span>;
</span></span><span style="display:flex;"><span>      }  
</span></span><span style="display:flex;"><span>  }  
</span></span><span style="display:flex;"><span>}</span></span></code></pre></td></tr></table>
</div>
</div>
<p>You register the HTTP Module by adding the following section in your web.config.</p>
<div class="highlight"><div style="color:#cad3f5;background-color:#24273a;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#cad3f5;background-color:#24273a;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="1"><a style="outline:none;text-decoration:none;color:inherit" href="#1">1</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="2"><a style="outline:none;text-decoration:none;color:inherit" href="#2">2</a>
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#cad3f5;background-color:#24273a;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-xml" data-lang="xml"><span style="display:flex;"><span><span style="color:#c6a0f6">&lt; httpModules</span><span style="color:#ed8796">\</span><span style="color:#c6a0f6">&gt;</span> <span style="color:#c6a0f6">&lt; add</span> <span style="color:#ed8796">name\=&#34;DesigeekModule&#34;</span> <span style="color:#ed8796">type\=&#34;MyHTTPModule.DesigeekModule,</span> <span style="color:#ed8796">MyHTTPHandler&#34;</span><span style="color:#c6a0f6">/&gt;</span>  
</span></span><span style="display:flex;"><span><span style="color:#ed8796">&lt;</span> /httpModules\&gt;</span></span></code></pre></td></tr></table>
</div>
</div>
<p>When you run this (see the screen shots below), you will notice that when I goto the default.aspx I see the label with the date-time and the BEGIN and END strings. Another interesting point, if I get to one of my custom handler (e.g. foo.desigeek) then as shown below I get output from both the HTTP Module and HTTP Handler, which means there are many powerful things you can get by combining these.</p>
<p><p>

    <img src="images/httpmodule1.png" alt=""/>

</p></p>
<p><p>

    <img src="images/httpmodule2.png" alt=""/>

</p></p>
<p>Overall, the image below shows graphical representation of the process of a ASP.NET HTTP pipeline. The process starts with a request arriving at IIS. If the requested resource is configured to be handled by the ASP.NET ISAPI Extension, IIS dispatches the request to the unmanaged aspnet_isapi.dll ISAPI Extension. This ISAPI Extension passes off the request to the managed ASP.NET engine. It is important to note that during the request life cycle, one or more HTTP modules may execute, depending on what modules have been registered and what events they have subscribed to. Finally, the ASP.NET engine determines the HTTP handler that is responsible for rendering the content, invoking the handler and returning the generated content back to IIS, which returns it back to the requesting client. If you want to get creative and do some more processing, you can use the HTTP Factory. Remember, an HTTP handler factory is a class that is not directly responsible for rendering the content, but instead is responsible for selecting and returning an HTTP handler instance. This returned HTTP handler instance is then the one that is tasked with rendering the requested resource.</p>
<p>More Information:</p>
<ul>
<li><a
	
		href = "http://tinyurl.com/6qb4r"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		http://tinyurl.com/6qb4r
	</span>
</a></li>
<li><a
	
		href = "http://tinyurl.com/4x8yt"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		http://tinyurl.com/4x8yt
	</span>
</a></li>
<li><a
	
		href = "http://tinyurl.com/5wthn"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		http://tinyurl.com/5wthn
	</span>
</a></li>
<li><a
	
		href = "http://tinyurl.com/47cp2"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		http://tinyurl.com/47cp2
	</span>
</a></li>
</ul>
]]></content:encoded>
    </item>
    <item>
      <title>Yes, the GC *can* leak memory - there I said it!</title>
      <link>/post/2004/09/yes-the-gc-can-leak-memory-there-i-said-it/</link>
      <pubDate>Tue, 21 Sep 2004 00:00:00 +0000</pubDate>
      <guid>/post/2004/09/yes-the-gc-can-leak-memory-there-i-said-it/</guid>
      <description>&lt;p&gt;&lt;a
	
		href = &#34;http://weblogs.asp.net/savanness/archive/2004/04/18/115685.aspx&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		Shawn Van ness
	&lt;/span&gt;
&lt;/a&gt; has an excellent article, that spells out how event listeners can cause memory leaks, yep even when running in managed code. Steve Main sums it up pretty well:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The main issue is the “lapsed listener” problem. This occurs when objects subscribe to events and subsequently get out of scope. The problem is that the event subscriber doesn’t get garbage collected because the event is still holding a reference to it inside of the event’s invocation list. The event subscriber is still considered reachable from the GC’s point of view. As such, it doesn’t get collected until the &lt;em&gt;event&lt;/em&gt; goes out of scope (which is usually at application shutdown) which means that the event subscriber is effectively “leaked”.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><a
	
		href = "http://weblogs.asp.net/savanness/archive/2004/04/18/115685.aspx"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		Shawn Van ness
	</span>
</a> has an excellent article, that spells out how event listeners can cause memory leaks, yep even when running in managed code. Steve Main sums it up pretty well:</p>
<blockquote>
<p>The main issue is the “lapsed listener” problem. This occurs when objects subscribe to events and subsequently get out of scope. The problem is that the event subscriber doesn’t get garbage collected because the event is still holding a reference to it inside of the event’s invocation list. The event subscriber is still considered reachable from the GC’s point of view. As such, it doesn’t get collected until the <em>event</em> goes out of scope (which is usually at application shutdown) which means that the event subscriber is effectively “leaked”.</p>
<p>Moral of the story: when you implement an Observer pattern, it’s important to consider the relative lifetime of events and subscribers. If implemented naively, you’ll end up having objects that live a lot longer than you think they should. Unsubscribe() is your friend.</p></blockquote>
<p>As Fabrice writes, .NET&rsquo;s delegates and events are implementations of the <a
	
		href = "http://www.dofactory.com/Patterns/PatternObserver.aspx"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		Observer Design Pattern
	</span>
</a> . But the current problem is one more reminder that <a
	
		href = "http://weblogs.asp.net/fmarguerie/archive/2004/06/10/152535.aspx"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		Design Patterns should not be applied blindly
	</span>
</a>.</p>
<p>If you write the following code, you&rsquo;ll see that the object instance gets correctly released and collected:</p>
<div class="highlight"><div style="color:#cad3f5;background-color:#24273a;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#cad3f5;background-color:#24273a;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="1"><a style="outline:none;text-decoration:none;color:inherit" href="#1">1</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="2"><a style="outline:none;text-decoration:none;color:inherit" href="#2">2</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="3"><a style="outline:none;text-decoration:none;color:inherit" href="#3">3</a>
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#cad3f5;background-color:#24273a;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-csharp" data-lang="csharp"><span style="display:flex;"><span>StoopidObject <span style="color:#ed8796">object</span> = <span style="color:#c6a0f6">new</span> StoopidObject();  
</span></span><span style="display:flex;"><span>GC.Collect();  
</span></span><span style="display:flex;"><span>GC.WaitForPendingFinalizers();</span></span></code></pre></td></tr></table>
</div>
</div>
<p>If you write the following code instead, although there is no apparent reference kept to the Observer, the Observer instance will not be released:</p>
<div class="highlight"><div style="color:#cad3f5;background-color:#24273a;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#cad3f5;background-color:#24273a;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="1"><a style="outline:none;text-decoration:none;color:inherit" href="#1">1</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="2"><a style="outline:none;text-decoration:none;color:inherit" href="#2">2</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="3"><a style="outline:none;text-decoration:none;color:inherit" href="#3">3</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="4"><a style="outline:none;text-decoration:none;color:inherit" href="#4">4</a>
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8087a2" id="5"><a style="outline:none;text-decoration:none;color:inherit" href="#5">5</a>
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#cad3f5;background-color:#24273a;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-csharp" data-lang="csharp"><span style="display:flex;"><span>Observer observer = <span style="color:#c6a0f6">new</span> Observer();  
</span></span><span style="display:flex;"><span>Subject subject = <span style="color:#c6a0f6">new</span> Subject();  
</span></span><span style="display:flex;"><span>subject.SomethingHappened += <span style="color:#c6a0f6">new</span> EventHandler(observer.subject<span style="color:#ed8796">\</span>_SomethingHappened);  
</span></span><span style="display:flex;"><span>GC.Collect();  
</span></span><span style="display:flex;"><span>GC.WaitForPendingFinalizers();</span></span></code></pre></td></tr></table>
</div>
</div>
<p>Guys from around the community came with various solutions. They call them <em>Weak Delegates</em>. Follow the links to learn more:</p>
<ul>
<li><a
	
		href = "http://blogs.msdn.com/greg_schechter/archive/2004/05/27/143605.aspx"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		Greg Schechter
	</span>
</a> (real case study; schema&rsquo;s will help you to understand the problem)</li>
<li><a
	
		href = "http://www.interact-sw.co.uk/iangblog/2004/06/06/weakeventhandler"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		Ian Griffiths
	</span>
</a> and <a
	
		href = "http://www.seedindustries.com/blog/x/2004_06_01_archive.html#108656795427367272"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		Xavier Musy
	</span>
</a> (extensions and improvements)</li>
</ul>
<p><strong>More Information:</strong></p>
<ul>
<li><a
	
		href = "http://tinyurl.com/56vu4"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		http://tinyurl.com/56vu4
	</span>
</a></li>
<li><a
	
		href = "http://tinyurl.com/5ss2d"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		http://tinyurl.com/5ss2d
	</span>
</a></li>
<li><a
	
		href = "http://tinyurl.com/5jo5n"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		http://tinyurl.com/5jo5n
	</span>
</a></li>
</ul>
]]></content:encoded>
    </item>
    <item>
      <title>Exceptional Condition Handling in SQL Server 2005</title>
      <link>/post/2004/08/exceptional-condition-handling-in-sql-server-2005/</link>
      <pubDate>Thu, 05 Aug 2004 00:00:00 +0000</pubDate>
      <guid>/post/2004/08/exceptional-condition-handling-in-sql-server-2005/</guid>
      <description>&lt;p&gt;This is my second part of the SQL Server 2005 posts; you can read the &lt;a
	
		href = &#34;http://desigeek.com/weblog/amit/archive/2004/08/03/377.aspx&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		&lt;strong&gt;first part&lt;/strong&gt;
	&lt;/span&gt;
&lt;/a&gt; on Hosting the .NET runtime in SQL Server.&lt;/p&gt;
&lt;p&gt;In the CLR certain conditions such as out of memory, stack overflow, etc can bring down an app domain (or process), this cannot be allowed in SQL Server 2005 when latter is acting has a host (for the CLR) as it will affect reliability and performance - couple of the key goals for SQL Server. Similarly unconditionally stopping a thread (e.g. via Thread.Abort) can potentially leave some resources in a “hung” state.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>This is my second part of the SQL Server 2005 posts; you can read the <a
	
		href = "http://desigeek.com/weblog/amit/archive/2004/08/03/377.aspx"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		<strong>first part</strong>
	</span>
</a> on Hosting the .NET runtime in SQL Server.</p>
<p>In the CLR certain conditions such as out of memory, stack overflow, etc can bring down an app domain (or process), this cannot be allowed in SQL Server 2005 when latter is acting has a host (for the CLR) as it will affect reliability and performance - couple of the key goals for SQL Server. Similarly unconditionally stopping a thread (e.g. via Thread.Abort) can potentially leave some resources in a “hung” state.</p>
<p><strong>So how do we handle this?</strong> Well other hosts such as ASP.NET recycle the app domain in such situations which is OK because a web application is disconnected and not “long running”. On the other hand SQL Server can have long running batch jobs and rolling all that information back in mot cases is not an option. Our of memory conditions are pretty hard to handle even if you leave a safety buffer for memory. Since SQL Server manages its own memory and tends to use all available memory to maximise throughput this puts it in an even more difficult position. As a result of you increase the “safety net” to handle out of memory conditions you also increase the chances or getting in those situations.</p>
<p>The good news is that .NET 2.0 (which ships with Whidbey) handles these situations better than ver. 1.x and it notifies SQL Server about repercussions of failing each memory request. It would also facilitate running the GC more aggressively, waiting for existing procedural code to finish before starting to execute newer code and also aborting running threads if needed. In addition, at the CLR level there is also a failure escalation policy that would allow SQL Server to deal with those situations. Using this SQL Server among other things can either abort the thread causing the exception of unload the whole app domain.</p>
<p>If any resources fail then the CLR will unwind the whole stack and if there are any locks on them then unload the whole app domain as locks indicate there is some shared state to synchronise and most likely would not be consistent in that state. If the CLR encounters a stack overflow that is not caught by the application then it will unwind the stack and get rid of that thread.</p>
<p>Going back to the main goals, SQL Server will maintain transactional semantics. If an app domain is recycled then the main reason is probably due to reliability (even if at the expense of performance). As a note, all the class libraries part from the BCL that SQL Server will load have been ensured to clean up memory and other resources after a thread is aborted or an app domain is unloaded.</p>
<p>I will post on security and app domains at a later time.</p>
<p><p>

    <img src="http://desigeek.com/weblog/aggbug.aspx?PostID=385" alt=""/>

</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>Hosting the .NET Runtime in SQL Server 2005</title>
      <link>/post/2004/08/hosting-the-net-runtime-in-sql-server-2005/</link>
      <pubDate>Tue, 03 Aug 2004 00:00:00 +0000</pubDate>
      <guid>/post/2004/08/hosting-the-net-runtime-in-sql-server-2005/</guid>
      <description>&lt;p&gt;I finally got around to trying out SQL Server 2005 (a.k.a. Yukon) and &lt;a
	
		href = &#34;http://www.awprofessional.com/title/0321180593&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		&lt;strong&gt;reading&lt;/strong&gt;
	&lt;/span&gt;
&lt;/a&gt; up a little on how it operates under the covers. I had earlier &lt;a
	
		href = &#34;http://desigeek.com/weblog/amit/archive/2004/07/11/329.aspx&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		&lt;strong&gt;discussed&lt;/strong&gt;
	&lt;/span&gt;
&lt;/a&gt; SQL Server Express. This is my first of series of posts where I will be highlighting some of the new things a developer can do in SQL Server 2005 from a .NET perspective, since there are many DBA&amp;rsquo;s who live and breathe SQL Server I will leave all the database and T-SQL specific stuff to them.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>I finally got around to trying out SQL Server 2005 (a.k.a. Yukon) and <a
	
		href = "http://www.awprofessional.com/title/0321180593"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		<strong>reading</strong>
	</span>
</a> up a little on how it operates under the covers. I had earlier <a
	
		href = "http://desigeek.com/weblog/amit/archive/2004/07/11/329.aspx"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		<strong>discussed</strong>
	</span>
</a> SQL Server Express. This is my first of series of posts where I will be highlighting some of the new things a developer can do in SQL Server 2005 from a .NET perspective, since there are many DBA&rsquo;s who live and breathe SQL Server I will leave all the database and T-SQL specific stuff to them.</p>
<p><strong>What is a runtime host?</strong> Basically any process that loads the .NET runtime and runs code in that managed environment is a runtime host. The most common host is the Windows shell - when you double-click on a .net application, the host (i.e. the Win shell in this case), loads the runtime in memory and then loads the requested assembly. The host loads the runtime by calling a shim DLL called mscoree.dll whose only purpose in life is to load the runtime. This exposes two API&rsquo;s called ICorRuntimeHost or CorBindToRuntimeEx. Till Whidbey the only parameters that can be passed to either of the API&rsquo;s are:</p>
<ul>
<li>Server or workstation behaviour</li>
<li>CLR Version</li>
<li>GC Behaviour</li>
<li>Enable sharing of JIT code across AppDomains</li>
</ul>
<p>Till SQL Server 2005 there were two runtime hosts for the .NET namely ASP.NET worker process and IE each with their own priorities of the framework. When adding the CLR, to SQL Server the three main goals in ascending order were:</p>
<ol>
<li>Security</li>
<li>Reliability</li>
<li>Performance</li>
</ol>
<p>Its not surprising to see Security and Reliability a higher priority than performance. You don&rsquo;t want your mission critical application to run in a non-secure environment that can allow for malicious code and allow hackers to get in. Also critical applications such as databases are quite often needed to sustain the five 9&rsquo;s of requirement (99.999 % uptime) especially in the Enterprise environment. Lastly performance is important (hence it is one of the goals) as you don&rsquo;t want to wait forever to get your result back, but that performance gain is not at the cost of a secure of reliable system.</p>
<p>SQL Server is a specialised host and not a “simple bootstrap mechanism”. To ensure the SQL Server goals some changes had to be made to the CLR which are incorporated in ver 2.0 (Whidbey). To allow the “new” hosts such as SQL Server to have hooks into the CLR&rsquo;s resource allocation and management the .NET 2.0 hosts can use ICLRRuntimeHost instead of ICorRuntimeHost. The host then can call the SetHostControl() method which in turn delegates to GetHostManager() for things such as thread management, etc. Here is how it would look like:</p>
<p><a
	
		href = "http://www.desigeek.com/weblog/Images/pics/sqlserver/Hosting%20the%20CLR.png"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		<p>

    <img src="images/Hosting%20the%20CLR.png" alt=""/>

</p>
	</span>
</a><br>
Hosting the CLR</p>
<p><strong>Resource Management</strong> - SQL Server lazy loads the clr, so if you never use it then it is never loaded. Unlike the “regular” CLR hosts where the CLR itself manages the resources, SQL Server manages its own thread scheduling, synchronisation, locking and memory allocation. This is done by layering the clr&rsquo;s mechanisms in top of SQL Server&rsquo;s mechanisms. SQL Server uses its own memory allocation scheme, managing “real memory” rather than virtual memory. This allows it to optimise memory, balancing between data and index buffers, query caches, etc. SQL Server can do a better job if is manages all of the memory in its process.</p>
<p>SQL Server also uses its own thread management putting threads to sleep when not running. The is also called <a
	
		href = "http://builder.com.com/5100-6388_14-5144021.html"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		<strong>user mode scheduler</strong>
	</span>
</a>. SQL Server internally uses cooperative thread scheduling to minimise thread context switches, as opposed to preemptive thread scheduling used by the CLR. This means that in SQL Server a thread has to voluntarily give up control as opposed to the CLR where the processes takes over control after a certain time-slice.</p>
<p>The hosting API&rsquo;s in .NET 2.0 allow a runtime host to either control of “have a say in” resource allocation. The APIs manage units of work (called Tasks), that can be assigned to a thread (or fibre). The SQL scheduler manages blocking points, and hooks PInvoke and interop calls out of the runtime to control switching the scheduling mode. This allows SQL Server to supply a host memory allocator, to be notified of low memory conditions at the OS level and to fail memory allocations if needed. SQL Server can also use the hosting API to control I/O completion ports.</p>
<p>I&rsquo;ll be discussing Exception Management, Code Loading and Security in this new host in later posts. Till then, if you want to learn in more details the either get the book mentioned earlier in this post or keep a lookout here. Also if you plan on installing the newly released Beta 2 then check out <a
	
		href = "http://staff.develop.com/bobb/weblog/PermaLink.aspx?guid=f18435fb-a6e2-4cb8-a86b-7e2c05bb2746"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		<strong>Bob&rsquo;s post</strong>
	</span>
</a> on some observations.</p>
<p><p>

    <img src="http://desigeek.com/weblog/aggbug.aspx?PostID=377" alt=""/>

</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>Exception Management in .NET</title>
      <link>/post/2004/07/exception-management-in-net/</link>
      <pubDate>Wed, 28 Jul 2004 00:00:00 +0000</pubDate>
      <guid>/post/2004/07/exception-management-in-net/</guid>
      <description>&lt;p&gt;Well, this was long overdue. I had &lt;a
	
		href = &#34;http://desigeek.com/weblog/amit/archive/2004/04/29/OSNewsExceptionManagement.aspx&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		&lt;strong&gt;promised&lt;/strong&gt;
	&lt;/span&gt;
&lt;/a&gt; to upload my article that won a contest by osnews.com. I finally found a little time to upload it here, though the formatting is still a bit screwed especially on the code snippets. You can &lt;a
	
		href = &#34;http://desigeek.com/weblog/amit/articles/368.aspx&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		&lt;strong&gt;read the article&lt;/strong&gt;
	&lt;/span&gt;
&lt;/a&gt;. If you would like a pdf version of the same let me know and I can either put it up here or email it to you. Here is my blurb from the article:&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Well, this was long overdue. I had <a
	
		href = "http://desigeek.com/weblog/amit/archive/2004/04/29/OSNewsExceptionManagement.aspx"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		<strong>promised</strong>
	</span>
</a> to upload my article that won a contest by osnews.com. I finally found a little time to upload it here, though the formatting is still a bit screwed especially on the code snippets. You can <a
	
		href = "http://desigeek.com/weblog/amit/articles/368.aspx"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		<strong>read the article</strong>
	</span>
</a>. If you would like a pdf version of the same let me know and I can either put it up here or email it to you. Here is my blurb from the article:</p>
<blockquote>
<p><em>Exceptions are a very powerful concept when used correctly. An important cornerstone in the design of a good application is the strategy you adopt for Exception Management. You must ensure that your design is extensible to be able to handle unforeseen exceptions gracefully, log them appropriately and generate metrics to allow the applications to be monitored externally.</em></p></blockquote>
<p><p>

    <img src="http://desigeek.com/weblog/aggbug.aspx?PostID=369" alt=""/>

</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>Class Designer in Visual Studio 2005 will not support UML</title>
      <link>/post/2004/07/class-designer-in-visual-studio-2005-will-not-support-uml/</link>
      <pubDate>Thu, 22 Jul 2004 00:00:00 +0000</pubDate>
      <guid>/post/2004/07/class-designer-in-visual-studio-2005-will-not-support-uml/</guid>
      <description>&lt;p&gt;As Ramesh writes in an old &lt;a
	
		href = &#34;http://blogs.msdn.com/r.ramesh/archive/2004/03/06/85247.aspx&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		&lt;strong&gt;post&lt;/strong&gt;
	&lt;/span&gt;
&lt;/a&gt;, the Class Designer is not a UML tool but uses the notation. He goes on to say the prime audience for this tool is the Developer then what do the Architects use? Is there a different version? I personally am a bit cheesed off by this. I love UML and have used it extensively and know the value (and pains) it can bring, like with everything else there are pros and cons. Like I said in mu comment, what is Microsoft&amp;rsquo;s issue in supporting UML? Is it more politics since Rational was bought by IBM or is there some other “real” reason?&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>As Ramesh writes in an old <a
	
		href = "http://blogs.msdn.com/r.ramesh/archive/2004/03/06/85247.aspx"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		<strong>post</strong>
	</span>
</a>, the Class Designer is not a UML tool but uses the notation. He goes on to say the prime audience for this tool is the Developer then what do the Architects use? Is there a different version? I personally am a bit cheesed off by this. I love UML and have used it extensively and know the value (and pains) it can bring, like with everything else there are pros and cons. Like I said in mu comment, what is Microsoft&rsquo;s issue in supporting UML? Is it more politics since Rational was bought by IBM or is there some other “real” reason?</p>
<p>I work for a large Systems Integrator and we are also one of the largest global MS partners. A lot of the clients I am involved with have almost every technology/platform running somewhere on their network and a <strong>very small</strong> percentage are only Microsoft. So, if this is something proprietary which I as an Architect cannot &ldquo;integrate&rdquo; with other pieces of a complex enterprise application that maybe running on J2EE then why would I want to use this?</p>
<p>What happened to all the “No Application is an Island” push? Was it only a marketing ploy? The other question is, Rational (or now IBM) will be improving Rose/XDE to counter Microsoft&rsquo;s <em>threat</em> to their dominance in this market, and if that does support UML then why would I not use that?</p>
<p>Thoughts?</p>
<p><p>

    <img src="http://desigeek.com/weblog/aggbug.aspx?PostID=350" alt=""/>

</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>Visual Studio 2005 Team Systems for Architects</title>
      <link>/post/2004/07/visual-studio-2005-team-systems-for-architects/</link>
      <pubDate>Thu, 22 Jul 2004 00:00:00 +0000</pubDate>
      <guid>/post/2004/07/visual-studio-2005-team-systems-for-architects/</guid>
      <description>&lt;p&gt;Microsoft has a site &lt;a
	
		href = &#34;http://msdn.microsoft.com/vstudio/teamsystem/architect/default.aspx&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		&lt;strong&gt;dedicated&lt;/strong&gt;
	&lt;/span&gt;
&lt;/a&gt; towards Architects geared towards VSTS where if you are an Architect (or an aspiring one) then you can learn more on this and also provide feedback back to Microsoft. Of interest on the same lines would be the following blogs too:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a
	
		href = &#34;http://blogs.msdn.com/keith_short&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		&lt;strong&gt;Keith Short&lt;/strong&gt;
	&lt;/span&gt;
&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
	
		href = &#34;http://blogs.msdn.com/r.ramesh/&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		&lt;strong&gt;R Ramesh&lt;/strong&gt;
	&lt;/span&gt;
&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
	
		href = &#34;http://blogs.msdn.com/stuart_kent/&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		&lt;strong&gt;Stuart Kent&lt;/strong&gt;
	&lt;/span&gt;
&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;Here is an excerpt from the site:&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Microsoft has a site <a
	
		href = "http://msdn.microsoft.com/vstudio/teamsystem/architect/default.aspx"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		<strong>dedicated</strong>
	</span>
</a> towards Architects geared towards VSTS where if you are an Architect (or an aspiring one) then you can learn more on this and also provide feedback back to Microsoft. Of interest on the same lines would be the following blogs too:</p>
<ul>
<li><a
	
		href = "http://blogs.msdn.com/keith_short"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		<strong>Keith Short</strong>
	</span>
</a></li>
<li><a
	
		href = "http://blogs.msdn.com/r.ramesh/"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		<strong>R Ramesh</strong>
	</span>
</a></li>
<li><a
	
		href = "http://blogs.msdn.com/stuart_kent/"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		<strong>Stuart Kent</strong>
	</span>
</a></li>
</ul>
<blockquote>
<p>Here is an excerpt from the site:</p>
<p><em>Building complex service-oriented solutions requires several architectural considerations including services and contract design, communications security, operations manageability and provisioning, and so on. Add to this, the time-honored issues architectural teams are mired with—architecting upfront with deployment in mind, ensuring design changes are propagated to code and vice versa, establishing seamless communication between design and development teams and design and operations teams.</em></p>
<p><em>Visual Studio 2005 Team Architect Edition addresses exactly these problems at the core with a set of Distributed System Designers that help reduce the complexity of developing and deploying service-oriented applications. A core deliverable of the Dynamic Systems Initiative (DS), these designers, leveraging the System Definition Model (SDM), allow senior developers and architects to define service-oriented applications that will be configured into systems for deployment. While application architects can visualize their service-oriented applications, developers can work with the generated code while keeping the code-changes synchronized with the visual design. In addition, the Distributed System Designers can be used to create diagrams or interconnected hosts that represent the logical structure of a data center for the purpose of communicating important information to the developer about the target deployment environment. The Distributed System Designers can also bind applications to these logical servers and validate them against the constraints of the application/data center prior to actual deployment.</em></p></blockquote>
<p><p>

    <img src="http://desigeek.com/weblog/aggbug.aspx?PostID=349" alt=""/>

</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>What is System Definition Model?</title>
      <link>/post/2004/07/what-is-system-definition-model/</link>
      <pubDate>Fri, 16 Jul 2004 00:00:00 +0000</pubDate>
      <guid>/post/2004/07/what-is-system-definition-model/</guid>
      <description>&lt;p&gt;The System Definition Model (SDM) provides the basis for the underlying metamodel used by &lt;a
	
		href = &#34;http://desigeek.com/weblog/amit/archive/2004/07/15.aspx&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		&lt;strong&gt;DSD&lt;/strong&gt;
	&lt;/span&gt;
&lt;/a&gt;. The SDM describes distributed systems as four layers:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Applications&lt;/li&gt;
&lt;li&gt;Application hosts&lt;/li&gt;
&lt;li&gt;Network Topology&lt;/li&gt;
&lt;li&gt;OS and physical hardware or devices.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For &lt;em&gt;each&lt;/em&gt; layer, the model describes the connections between systems and their configurations. By adopting a common model for all these layers, the model makes it possible for you to define and express requirements and policies across these layers. For example, an application can require a certain authentication mode or that other resources need to exist on the logical server that hosts the application. A logical server can also require that the application it hosts must support a certain authentication mode and that it disable specific features that present a security risk.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>The System Definition Model (SDM) provides the basis for the underlying metamodel used by <a
	
		href = "http://desigeek.com/weblog/amit/archive/2004/07/15.aspx"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		<strong>DSD</strong>
	</span>
</a>. The SDM describes distributed systems as four layers:</p>
<ul>
<li>Applications</li>
<li>Application hosts</li>
<li>Network Topology</li>
<li>OS and physical hardware or devices.</li>
</ul>
<p>For <em>each</em> layer, the model describes the connections between systems and their configurations. By adopting a common model for all these layers, the model makes it possible for you to define and express requirements and policies across these layers. For example, an application can require a certain authentication mode or that other resources need to exist on the logical server that hosts the application. A logical server can also require that the application it hosts must support a certain authentication mode and that it disable specific features that present a security risk.</p>
<p>The SDM offers the following benefits:</p>
<ul>
<li>Provides a common language to describe the design and configuration of all aspects of a distributed system.</li>
<li>Provides familiar abstractions that make it possible for developers and operations groups to communicate on common ground.</li>
<li>Makes it possible for developers to communicate application requirements of the run-time environment.</li>
<li>Makes it possible for operations groups to communicate application run-time, security, and connectivity requirements that result from the policies defined in the target deployment environment.</li>
</ul>
<p>The SDM is intrinsically extensible and makes it possible for the addition of new abstract definitions at each layer.</p>
<p><p>

    <img src="http://desigeek.com/weblog/aggbug.aspx?PostID=338" alt=""/>

</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>White-Box testing (a.k.a Glass Box or Clear Box or Open Box testing)</title>
      <link>/post/2004/06/white-box-testing-a-k-a-glass-box-or-clear-box-or-open-box-testing/</link>
      <pubDate>Thu, 24 Jun 2004 00:00:00 +0000</pubDate>
      <guid>/post/2004/06/white-box-testing-a-k-a-glass-box-or-clear-box-or-open-box-testing/</guid>
      <description>&lt;p&gt;This is part 3 of the testing-series of posts where I cover White-Box testing (inspired by Microsoft&amp;rsquo;s upcoming Testing Series of good advise from PAG). You can check out the earlier post &lt;a
	
		href = &#34;http://desigeek.com/weblog/amit/archive/2004/06/22/300.aspx&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		&lt;strong&gt;here&lt;/strong&gt;
	&lt;/span&gt;
&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;White-Box testing (Glass Box/Clear Box/Open Box testing)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;White box testing assumes that the tester can take a look at the code for the application and create test cases which look for any potential failure scenarios. You need to determine the suitable input data for testing of various APIs and the special code paths that need testeing by analyzing the source code for the application. One needs to ensure that the test plans need to be updated before starting with White–Box testing.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>This is part 3 of the testing-series of posts where I cover White-Box testing (inspired by Microsoft&rsquo;s upcoming Testing Series of good advise from PAG). You can check out the earlier post <a
	
		href = "http://desigeek.com/weblog/amit/archive/2004/06/22/300.aspx"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		<strong>here</strong>
	</span>
</a>.</p>
<p><strong>White-Box testing (Glass Box/Clear Box/Open Box testing)</strong></p>
<p>White box testing assumes that the tester can take a look at the code for the application and create test cases which look for any potential failure scenarios. You need to determine the suitable input data for testing of various APIs and the special code paths that need testeing by analyzing the source code for the application. One needs to ensure that the test plans need to be updated before starting with White–Box testing.</p>
<p>A failure of a white box test may result in a change which requires all the <a
	
		href = "http://desigeek.com/weblog/amit/archive/2004/06/22/300.aspx"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		<strong>black box testing</strong>
	</span>
</a> to be repeated and re-determination of white-box paths.</p>
<ul>
<li><strong>Profile The Application Code Blocks.</strong> Profiling is the activity which allows you to monitor the behavior of a particular code path in run time when the code is actually in execution. Typically you would profile your code for one or more of the following:
<ul>
<li>
<p><strong>Code Coverage</strong>. Profiling for code coverage with the help of a tool ensures that there is no redundant or dead code which never gets called for any execution path.</p>
</li>
<li>
<p><strong>Memory allocation pattern</strong>. This helps you in studying direct and indirect memory allocations while executing a code path, detect and analyze memory leaks (for unmanaged code), etc. For example you can analyze in which GC generations (Gen 0, Gen 1, Gen2) the maximum objects reside or are there any side affect allocations taking place in a loop which are increasing the memory utilization significantly. This can help you optimize the memory utilization of the code block. You can use various tools such as CLR profiler, Intel Vtune, etc. for this purpose.</p>
</li>
<li>
<p><strong>Contention and deadlock issues</strong>. You can analyze the code for deadlocks using tools like WinDbg which are a part of the Windows debugging toolkit.</p>
</li>
<li>
<p><strong>Time taken for executing a code path</strong>. You can profile the time taken by the scenarios for which performance is <em>critical</em>. This may require custom instrumentation of the code path which may be distributed across physically different machines. There are also various third party tools available which help you measure the time taken for execution of a particular scenario.</p>
<p>If the code needs to be integrated with web application one should also check out the Request Execution Time (<strong>ASP.NET\Request Execution Time</strong>) perf. counter. You can create a test harnesses such that the overhead of the harness is minimal and most of the processing time is spend within the code.</p>
</li>
</ul>
</li>
</ul>
<blockquote>
<p><em>If during profiling you find that a particular condition needs to be tested under load such as potential deadlock issues or inefficient memory cleanup which is visible only under scenarios you can provide inputs on the type of metrics which should be chosen while load testing the code and what are the things you should be looking for when stress testing the code.</em></p></blockquote>
<ul>
<li><strong>Testing internal subroutines.</strong> You need to test the various internal functions to ensure that they are processing the right data without any loss or inconsistency and returning the expected output.</li>
<li><strong>Test various loops and conditional statements</strong>. You should test various types of loops such as simple, concatenated, nested loops etc and the accuracy of conditional statements in the code components such as relational expressions, simple conditions, compound conditions, Boolean expressions, etc.</li>
<li><strong>Testing various scenarios identified.</strong> Various potential scenarios <em>should</em> have been identified in earlier in the process of reviewing the implementation. You must test these scenarios by first analyzing the code and then submitting the inputs which tend to exploit the weakness in the code (if any).</li>
<li><strong>Security Testing.</strong> During the process of source code review if you identify that a particular code access security is not able to restrict undesirable access in the targeted deployment environment you should test this scenario by first analyzing the code and then simulating the deployment environment to identify any scenarios where the code block may expose sensitive information to hackers.</li>
</ul>
<p>More Information - check out <strong><a
	
		href = "http://tinyurl.com/32ye3"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		http://tinyurl.com/32ye3
	</span>
</a></strong></p>
<p><p>

    <img src="http://desigeek.com/weblog/aggbug.aspx?PostID=302" alt=""/>

</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>White Box Testing and Black Box Testing</title>
      <link>/post/2004/06/white-box-testing-and-black-box-testing/</link>
      <pubDate>Tue, 22 Jun 2004 00:00:00 +0000</pubDate>
      <guid>/post/2004/06/white-box-testing-and-black-box-testing/</guid>
      <description>&lt;p&gt;This is really part II of my testing series (as I have become to call it) - I had an earlier post on &lt;a
	
		href = &#34;http://desigeek.com/weblog/amit/archive/2004/06/20/298.aspx&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		&lt;strong&gt;Unit Testing&lt;/strong&gt;
	&lt;/span&gt;
&lt;/a&gt;. I recently had the opportunity to review some of the new stuff coming out of the &lt;a
	
		href = &#34;http://www.microsoft.com/resources/practices/&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		&lt;strong&gt;Prescriptive Architecture Group&lt;/strong&gt;
	&lt;/span&gt;
&lt;/a&gt; at Microsoft and here is some of the interesting things proposed by them.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>This is really part II of my testing series (as I have become to call it) - I had an earlier post on <a
	
		href = "http://desigeek.com/weblog/amit/archive/2004/06/20/298.aspx"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		<strong>Unit Testing</strong>
	</span>
</a>. I recently had the opportunity to review some of the new stuff coming out of the <a
	
		href = "http://www.microsoft.com/resources/practices/"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		<strong>Prescriptive Architecture Group</strong>
	</span>
</a> at Microsoft and here is some of the interesting things proposed by them.</p>
<p>When you are doing Functional Testing of your application or code, it can be of two kinds - Black Box and White Box. I am going to highlight some of the suggestions of MS on Black-Box here and have another followup post on the Whitebox testing.</p>
<p><strong>Black-Box testing</strong></p>
<p>The black box testing assumes no knowledge of code and is intended to simulate the <em>end user experience</em>. One can use sample applications to integrate and test the various components of an application for black box testing. This approach allows for testing of all the possible combinations of the end user actions. Some of the testing techniques which are covered in this are:</p>
<ul>
<li><strong>Testing all the external interfaces for all possible usage scenarios.</strong> All the external interfaces that can be integrated by the end users with their applications.
<ul>
<li><strong>Ensure the interfaces meet the requirements and functional specs</strong>. This type of testing ensures that the components in an application implement the interfaces required per the functional specifications. This also allows you to develop a test harnesses. You need to test for all the possible ways in which the APIs can be called by the clients of the code block. The usage scenarios include both the expected process flows and random inputs.</li>
<li><strong>Testing for various types of inputs.</strong> The second step is to ensure that the interfaces are returning the expected output and are robust enough to handle invalid data and exceptional conditions <em>gracefully</em>. The input data can be randomly generated within a specified range expected by the application, outside the specified range or at the boundary of the range. Testing with data outside the specified range ensures that the application is robust and can handle invalid data and the error messages generated are meaningful for the end user. Boundary testing ensures that the highest and lowest permitted inputs produce expected output.</li>
</ul>
</li>
<li><strong>Performance Testing.</strong> You execute performance related test cases from the test plan in a simulated environment which is close to the real world deployment. Performance testing is done to verify that the application is able to perform under expected and peak load conditions, and that it can scale sufficiently to handle increased capacity. There are two main aspects of performance testing with different end goals. You must plan and execute test cases for both these aspects as mentioned below:
<ul>
<li><strong>Load Testing:</strong> Use load testing to verify the code behavior under normal and peak load conditions. This allows you to verify that the application can meet the desired performance objectives and does not overshoot the allocated budget for resource utilization such as memory, processor, network I/O etc. This also allows you to measure the measure response times and throughput rates for the application. Load Testing also helps you identify the overhead (if any) of using the application to achieve a desired functionality by testing applications with and without the code block for achieving the same end result.</li>
<li><strong>Stress Testing:</strong> Use stress testing to evaluate the code&rsquo;s behavior when it is pushed beyond the normal or peak load conditions. The goal of stress testing is to unearth bugs that surface only under high load conditions such things as synchronization issues, race conditions, and memory leaks.</li>
</ul>
</li>
</ul>
<blockquote>
<p>The analysis from performance tests may serve as input to White Box Testing. You may need to do a code review of the suspected module to weed out any possible causes of issues such as a coarse –grained lock which is causing increased wait times for threads etc. The data analysis from performance tests provides useful inputs to the type of problems which surface under load conditions. These inputs help you focus on profiling a particular code path during white box testing.</p></blockquote>
<ul>
<li><strong>Security Testing.</strong> Security Testing is done by simulating the target deployment environments and tested for potential security attacks.</li>
<li><strong>Globalization testing</strong>. The design and implementation has already been reviewed for adherence to best practices for globalization. Here one should check for Globalization related test cases to ensure that the code block can handle international support and is ready to be used from various locales around the world. The goal of globalization testing is to detect potential problems in application design that could cause problems. It makes sure that the code can handle all international support and supports any of the culture/local settings without breaking functionality that would cause either data loss or display problems. To perform globalization testing, you must install multiple language groups and ensure that the culture/locale is not your local culture/locale. <em>For example, executing test cases in both Japanese and German environments, and a combination of both, can cover most globalization issues.</em></li>
</ul>
<p>For more information on performance testing check out:</p>
<ul>
<li><strong><a
	
		href = "http://tinyurl.com/3eqmm"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		http://tinyurl.com/3eqmm
	</span>
</a></strong></li>
<li><strong><a
	
		href = "http://tinyurl.com/35mpw"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		http://tinyurl.com/35mpw
	</span>
</a></strong></li>
</ul>
<p><p>

    <img src="http://desigeek.com/weblog/aggbug.aspx?PostID=300" alt=""/>

</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>What makes good code good?</title>
      <link>/post/2004/06/what-makes-good-code-good/</link>
      <pubDate>Fri, 11 Jun 2004 00:00:00 +0000</pubDate>
      <guid>/post/2004/06/what-makes-good-code-good/</guid>
      <description>&lt;p&gt;As Paul Dilascia discusses in his article in MSDN Magazine (most of which I am gonna mooch-off here), What is good code? Does good code mean that the program works as it is meant to without bugs? Well if that is your only criteria, then I don&amp;rsquo;t think so, that is something that is expected. One also needs to look at it internally - as they say beauty is beneath the skin (or something like that anyways). As Paul asks what internal qualities produce perfection (for the application/code)? It does not matter what language or platform you program in - one needs to remember the things that were taught in school when you took your first programming class - simplicity, readability, modularity, layering, design, efficiency elegance and clarity.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>As Paul Dilascia discusses in his article in MSDN Magazine (most of which I am gonna mooch-off here), What is good code? Does good code mean that the program works as it is meant to without bugs? Well if that is your only criteria, then I don&rsquo;t think so, that is something that is expected. One also needs to look at it internally - as they say beauty is beneath the skin (or something like that anyways). As Paul asks what internal qualities produce perfection (for the application/code)? It does not matter what language or platform you program in - one needs to remember the things that were taught in school when you took your first programming class - simplicity, readability, modularity, layering, design, efficiency elegance and clarity.</p>
<ul>
<li>Simplicity - It does not mean NOT writing 10 lines of code for something that can be done in 5 - but rather to make the extra effort to be concise but not to the point of obfuscation. It also means that your functions should not be spanning pages. Simplicity makes the code easier to manage and debug making it more reliable and hence bug free.</li>
<li>Readability - This means that the others can read your code. It means you take the effort to write comments and explanations (for very complex things) in the code. It also means to follow your coding guidelines and choose variable and function names carefully</li>
<li>Modularity - I like how Paul put this. This means your application is built like the universe. The world is made of molecules, which are made of atoms, electrons, nucleus, quarks and strings! Similarly, good programs build large systems from smaller ones which in turn are build on smaller building blocks. Just as atoms combine in novel ways, software components should be reusable.</li>
<li>Layering - This means that internally your application resembles a layer cake (slurp, smack, drool). The app sits on the framework which sits on the OS and within the application you follow a similar paradigm. The higher layers should call the lower ones which in turn raise events back up. Lower layers should never know that the higher ones are upto.</li>
<li>Design - This means read Dilbert! Invest the time to plan and design your application before you build it - much much cheaper in the long run.</li>
<li>Efficiency - Means the application should be acceptably fast and economical i.e. it does not hog any resources. It loads and departs without a fuss. At a high level you need to be aware of your performance requirements.</li>
<li>Elegance - This is like beauty - hard to describe but easy to recognise. Elegance combines simplicity, efficiency, brilliance and above all <strong>pride</strong>.</li>
<li>Clarity - This is the “granddaddy” of good programming. The fundamental challenge of programming is managing complexity! All the other points mentioned above are ways to achieve clarity - clarity of code, clarity of design, clarity of purpose. You must understand and really understand what you are doing at every level. Bad programs less often a failure of coding skills than of having a clear goal which is why design is the key. If you cannot write it down, you cannot explain to others, you don&rsquo;t really know whats happening!</li>
</ul>
<p>I am a big believer of the principle of KISS (Keep It Simple and Stupid)! All the above points to that. In the real world there are very rate instances where someone has not tried to make this more complex than it needs to be (with yours truly being guilty of the same). But everyone learns (and so did I). The key is to remember KISS and that your design needs to be good. If the architect on the project is not making that clear (or doing it correctly), then he/she/them need to be told!</p>
<p>What do you think makes good code?</p>
<p><p>

    <img src="http://desigeek.com/weblog/aggbug.aspx?PostID=273" alt=""/>

</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>Improving .NET Application Performance and Scalability</title>
      <link>/post/2004/05/improving-net-application-performance-and-scalability/</link>
      <pubDate>Tue, 18 May 2004 00:00:00 +0000</pubDate>
      <guid>/post/2004/05/improving-net-application-performance-and-scalability/</guid>
      <description>&lt;p&gt;PAG group just released the new &lt;a
	
		href = &#34;http://msdn.microsoft.com/netframework/default.aspx?pull=/library/en-us/dnpag/html/scalenet.asp&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		&lt;strong&gt;library&lt;/strong&gt;
	&lt;/span&gt;
&lt;/a&gt;. If you have been playing with the beta of this, you know there is lots of good stuff. A excellent reference to keep near you! Now that this is “public” I will be posting some of the things I find here - watch this space, and till then, read up and enjoy!&lt;p&gt;

    &lt;img src=&#34;http://desigeek.com/weblog/aggbug.aspx?PostID=247&#34; alt=&#34;&#34;/&gt;

&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>PAG group just released the new <a
	
		href = "http://msdn.microsoft.com/netframework/default.aspx?pull=/library/en-us/dnpag/html/scalenet.asp"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		<strong>library</strong>
	</span>
</a>. If you have been playing with the beta of this, you know there is lots of good stuff. A excellent reference to keep near you! Now that this is “public” I will be posting some of the things I find here - watch this space, and till then, read up and enjoy!<p>

    <img src="http://desigeek.com/weblog/aggbug.aspx?PostID=247" alt=""/>

</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>Becoming an Architect</title>
      <link>/post/2004/05/becoming-an-architect/</link>
      <pubDate>Wed, 12 May 2004 00:00:00 +0000</pubDate>
      <guid>/post/2004/05/becoming-an-architect/</guid>
      <description>&lt;p&gt;There has been a very interesting (imho) multi-part &lt;a
	
		href = &#34;http://www.artima.com/intv/architecture.html&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		&lt;strong&gt;interview&lt;/strong&gt;
	&lt;/span&gt;
&lt;/a&gt; with the author of &lt;a
	
		href = &#34;http://www.amazon.com/exec/obidos/tg/detail/-/0201775948/102-3888797-3197739?v=glance&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		&lt;strong&gt;Beyond Software Architecture&lt;/strong&gt;
	&lt;/span&gt;
&lt;/a&gt; where he discussing various aspects like the relationship between Architecture, Culture and Goodness. Also goes on to discuss the social role of an architect, conceptual integrity and the importance of domain knowledge. I particularly like the quote &amp;hellip; “ &lt;em&gt;An architecture is like a dirt road. The first time a car drives over it, the road looks about the same. By the time the 10,000th car drives over it, though, there will be grooves in the road. As an architecture mature, it gets grooves.&lt;/em&gt;”. Some other interesting responses that I personally have learned from over the years and I can relate to are below.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>There has been a very interesting (imho) multi-part <a
	
		href = "http://www.artima.com/intv/architecture.html"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		<strong>interview</strong>
	</span>
</a> with the author of <a
	
		href = "http://www.amazon.com/exec/obidos/tg/detail/-/0201775948/102-3888797-3197739?v=glance"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		<strong>Beyond Software Architecture</strong>
	</span>
</a> where he discussing various aspects like the relationship between Architecture, Culture and Goodness. Also goes on to discuss the social role of an architect, conceptual integrity and the importance of domain knowledge. I particularly like the quote &hellip; “ <em>An architecture is like a dirt road. The first time a car drives over it, the road looks about the same. By the time the 10,000th car drives over it, though, there will be grooves in the road. As an architecture mature, it gets grooves.</em>”. Some other interesting responses that I personally have learned from over the years and I can relate to are below.</p>
<p><strong>How do you measure a good Architect?</strong> - How well the architecture responds and adapts, and how well it goes through that construction process, is a measure of whether that architecture is any good.</p>
<p><strong>What is the difference between maturity and completeness? -</strong> In its first version, an architecture should be like a baby. It is whole and complete. It has ten fingers and ten toes. It has all its systems, but it is immature. You wouldn&rsquo;t expect it to do certain things that you might expect a mature system to do. Of course, the definition of what is complete and incomplete, mature and immature, is subjective. But it is really important to distinguish between incompleteness and immaturity. I see the people make the mistake made all the time of building an incomplete system. It&rsquo;s actually not a mistake that&rsquo;s correlated to a development process, near as I can tell. You can have iterative, agile projects that produce incomplete results, and you can have waterfall or traditional kinds of projects that produce incomplete results.</p>
<p>“&hellip; explore alternative architectures to see what works best&hellip;” This is sensible advice. It is also virtually useless.</p>
<p>“&hellip; An architecture is like a carefully designed garden, and needs care and feeding&hellip;.”</p>
<p><strong>What is Entropy Reduction?</strong> - Entropy reduction means I am going to make whatever compromise I need to make to get the release done, and then I&rsquo;m going to give the team the opportunity to go back and respond or recover from the compromises they made. It is a very different concept than refactoring. I think of refactoring as non-architectural, but rather very much in the context of normal work.</p>
<p>This is so true of one of my previous projects we were implementing in the New York office of the company I work for. Some of my colleagues who are reading this (and proving they don&rsquo;t have anything better to do) are probably grinning ear-to-ear from this:<br>
<em>Another aspect of matching architecture to human needs is matching roles and responsibilities of the people building a system to the appropriate parts of the architecture. Some pundits say that everyone likes to do everything, but that&rsquo;s not true. I suspect that a lot of people who write about architecture, although they are very smart, have never managed large teams. I&rsquo;ve managed a 60-person team, and I personally know UI guys who would never get near a database, because they think databases are &ldquo;stupid&rdquo;. And I know many database developers who would never go near a UI. The last thing these database people want to do is the full architectural stack. They&rsquo;ve spent their life becoming an expert at Oracle. And you know what? They are an expert at Oracle. They aren&rsquo;t going to be an expert at UI design, and given what they would normally design for a UI, you wouldn&rsquo;t want them to be touching the UI anyway. When you look at the stack in your architecture, and then you look at this mass of people on your team, the architecture and the people have to match. Otherwise you&rsquo;ll have problems.</em></p>
<p><strong>Determining the Appropriate Granularity of the Design?</strong> - When people talk about architecture, there&rsquo;s rarely a corresponding discussion of the granularity of the architectural metaphors, components, or descriptions that are being employed. The appropriate granularity is a function of the number of people working on the software and the complexity of the software itself. If only two or three people are working on the project, then they can get pretty granular. As the software and team gets bigger in size, the granularity must become more abstract.</p>
<p>Overall, like I opened this post with, this more or less reflects my experiences and pretty much on the dime with the issues, suggestions and analogies discussed. What are your experiences? Do you disagree with something?</p>
<p><p>

    <img src="http://desigeek.com/weblog/aggbug.aspx?PostID=239" alt=""/>

</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>What is a Loosely Coupled System?</title>
      <link>/post/2004/05/what-is-a-loosely-coupled-system/</link>
      <pubDate>Wed, 05 May 2004 00:00:00 +0000</pubDate>
      <guid>/post/2004/05/what-is-a-loosely-coupled-system/</guid>
      <description>&lt;p&gt;In a loosely coupled system (e.g. Service Oriented Architecture i.e. SOA), the dependencies can be either a Real Dependency or an Artificial Dependency.&lt;/p&gt;
&lt;p&gt;Real dependencies are the services that you need to fulfil your need, this is something that cannot be eliminated or reduced.&lt;/p&gt;
&lt;p&gt;Artificial dependency on the other hand are the features you need to adhere to in order to consume the services you need. Typically these fall in the categories of platform dependencies, API dependencies, language, etc. Although artificial dependencies cannot be eliminated it can be reduced.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>In a loosely coupled system (e.g. Service Oriented Architecture i.e. SOA), the dependencies can be either a Real Dependency or an Artificial Dependency.</p>
<p>Real dependencies are the services that you need to fulfil your need, this is something that cannot be eliminated or reduced.</p>
<p>Artificial dependency on the other hand are the features you need to adhere to in order to consume the services you need. Typically these fall in the categories of platform dependencies, API dependencies, language, etc. Although artificial dependencies cannot be eliminated it can be reduced.</p>
<p>A loosely coupled application is on that minimise its Artificial Dependency.</p>
<p><p>

    <img src="http://desigeek.com/weblog/aggbug.aspx?PostID=221" alt=""/>

</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>Zachman Framework</title>
      <link>/post/2004/04/zachman-framework/</link>
      <pubDate>Wed, 28 Apr 2004 00:00:00 +0000</pubDate>
      <guid>/post/2004/04/zachman-framework/</guid>
      <description>&lt;p&gt;I posted an &lt;a
	
		href = &#34;http://desigeek.com/weblog/amit/articles/203.aspx&#34;
	

	

	
		target = &#34;_blank&#34;
		rel = &#34;nofollow noopener noreferrer&#34;
		&gt;
	
	&lt;span&gt;
		article
	&lt;/span&gt;
&lt;/a&gt; (click here or on the title) on what the Zachman Framework is all about. I find it so surprising that in today&amp;rsquo;s world, I came across a whole bunch of people who call themselves as “Architects” who have no idea or clue as to what the Zachman Framework is. I am not trying to be critical towards those people, they are probably very smart and know their stuff, but I figured maybe its a time for a crash course.&lt;p&gt;

    &lt;img src=&#34;http://desigeek.com/weblog/aggbug.aspx?PostID=204&#34; alt=&#34;&#34;/&gt;

&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>I posted an <a
	
		href = "http://desigeek.com/weblog/amit/articles/203.aspx"
	

	

	
		target = "_blank"
		rel = "nofollow noopener noreferrer"
		>
	
	<span>
		article
	</span>
</a> (click here or on the title) on what the Zachman Framework is all about. I find it so surprising that in today&rsquo;s world, I came across a whole bunch of people who call themselves as “Architects” who have no idea or clue as to what the Zachman Framework is. I am not trying to be critical towards those people, they are probably very smart and know their stuff, but I figured maybe its a time for a crash course.<p>

    <img src="http://desigeek.com/weblog/aggbug.aspx?PostID=204" alt=""/>

</p></p>
]]></content:encoded>
    </item>
  </channel>
</rss>
