<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Steven Calise</title>
	<atom:link href="http://stevencalise.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://stevencalise.wordpress.com</link>
	<description></description>
	<lastBuildDate>Sat, 05 Nov 2011 12:45:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='stevencalise.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Steven Calise</title>
		<link>http://stevencalise.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://stevencalise.wordpress.com/osd.xml" title="Steven Calise" />
	<atom:link rel='hub' href='http://stevencalise.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Caching in a Service Oriented Architecture (SOA) &#8211; Part 1</title>
		<link>http://stevencalise.wordpress.com/2011/03/03/caching-in-a-service-oriented-architecture-soa-part-1/</link>
		<comments>http://stevencalise.wordpress.com/2011/03/03/caching-in-a-service-oriented-architecture-soa-part-1/#comments</comments>
		<pubDate>Wed, 02 Mar 2011 18:59:50 +0000</pubDate>
		<dc:creator>stevencalise</dc:creator>
				<category><![CDATA[SOA]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[Caching]]></category>

		<guid isPermaLink="false">http://stevencalise.wordpress.com/?p=83</guid>
		<description><![CDATA[This will be a two part post on some of my thoughts on designing a caching system for a service oriented architecture, and some of the results from a series of prototypes done to flesh out the design. Part 1 – Overview, use and potential approaches Part 2 – Prototype designs, results and lessons learned [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stevencalise.wordpress.com&amp;blog=9324228&amp;post=83&amp;subd=stevencalise&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This will be a two part post on some of my thoughts on designing a caching system for a service oriented architecture, and some of the results from a series of prototypes done to flesh out the design.</p>
<p><strong>Part 1 – Overview, use and potential approaches </strong></p>
<p><strong>Part 2 – Prototype designs, results and lessons learned</strong></p>
<p>When designing a service oriented architecture (SOA) that is expected to see high volumes of traffic one of the potential architectural components you may be looking at is a caching system. In a high traffic system a cache can be essential in increasing performance and enabling the scalability of the overall system.</p>
<h2>Why use a Caching system?</h2>
<p>Caching systems inarguably add another layer of complexity as well as another potential point of failure to a systems architecture, so it’s use should be carefully weighed in relation to the expected benefits you anticipate from its use.</p>
<p>There are usually two main reasons for employing a caching system</p>
<ol>
<li>Offload Database work</li>
<li>Drive down response times</li>
</ol>
<p><strong>Offloading database work </strong>is essentially a way of enabling a pseudo-scaling of the database tier, especially in cases where the database platform doesn’t inherently allow a scaling out. By performing more of the work of retrieving data without involving the database, we are effectively scaling out the capacity of the tier.</p>
<p>The requirement to <strong>Drive down response times</strong> or keep response times stable as the system grows is another common reason to employ a caching system. Retrieving data from a cache held in memory is magnitudes faster than retrieving it from the database tier in most circumstances and especially so if the database system itself does not employ some internal caching to keep the needed data in memory. If the database system determines it needs to read the data from disk, the cache fetch will seem like a Maserati compared to a ‘Model T’.</p>
<h2>Where should you use caching?</h2>
<p>Caching should likely be considered at all levels of the system &#8211; client tier, web tier and services tier. At each tier of your architecture the needs of the application and the type of data in use will dictate what gets cached and the strategy employed.</p>
<p>The goal of caching within a SOA system that is expected to scale means keeping the cached information at the layer that makes the most sense from a use and manageability standpoint.</p>
<h3>Client Tier</h3>
<p>At the client tier data should be cached to avoid round trips back to the server when possible. This is likely one of the most expensive calls in a system that can be made, as the network traversed in this call is likely a good distance from the web application or services tier. The best approach to performance here is to not incur the overhead of the call at all if possible.</p>
<p>Thick clients have long used local caching strategies to hold onto data as long as possible. After a database call a thick client would keep the set of data retrieved in memory between user actions and screen changes.</p>
<p>Browser based clients have had a more difficult time caching data due to the stateless nature of the web. Some approaches here have been to store data in the page itself. This can lead to page size bloat and slower response times in a typical scenario such as ASP.NET where the “stored data” is round-tripped with the page. With the rising popularity of AJAX style programming and partial page refreshing, the browser is becoming a more intelligent presentation layer compared to the typical post-back or complete page refresh model.</p>
<h3>Web Application Tier</h3>
<p>The web application tier has a role to participate in the caching strategy as well. Since in a proper N-tier system,  the web application tier is responsible for serving of resources (pages, images, etc), it should employ its caching strategy around these object types primarily. Employing a cache strategy around how long a page can be served from cache versus being regenerated should be one of the primary focuses of caching at this tier.</p>
<p>While tempting to cache data at the web application tier, this should be avoided as there are several problems that could arise from this in a scaled and load balanced environment, such as data only being available to certain web servers, or the distributed maintenance of a cache from multiple web servers.</p>
<h3>Services Tier</h3>
<p>Caching at the services tier should target &#8220;data&#8221; since this is the single point of access to data within a SOA based system. As such it makes sense to control the population, refreshing and invalidation of a data cache from this tier. The services tier lends itself particularly well to the caching of data as its primary purpose it to act as the facade that serves all requests to retrieve or update data.</p>
<p>Where it retrieves this data from is of no concern to the caller other than from the standpoint that the data is correct and accurate. Since employing a cache at this tier is transparent to the caller, offloads work from the database and is more manageable from the standpoint of trapping changes that require updating the cache, it makes the most sense to cache data at this tier.</p>
<h2>What types of data should you cache?</h2>
<p>The type of data that you determine should be cached should ultimately provide an increase in performance to the system without dramatically increasing the complexity of the system. There are certain types or classes of data that make more sense to cache than others, in order of priority.</p>
<ul>
<li>Data that changes infrequently</li>
<li>Expensive queries</li>
<li>Data that is accessed frequently</li>
</ul>
<p>Some thought should also be given to the dependencies between cached object types. I cover this more in the considerations section, but a high number of dependencies between objects may be a factor in determining whether you cache these object types.</p>
<h3>Data that changes infrequently</h3>
<p>Data items that are fairly static in nature make ideal candidates for caching. The benefit here is that there is a low overhead to managing this type of data in a cache as updates to the data are infrequent requiring less of a need to clear items from the cache and/or refresh them.</p>
<p>An example of data that changes infrequently could be policy data that drives certain actions within the application.</p>
<h3>Expensive Queries</h3>
<p>Queries that are expensive in either time or resource usage to run are another ideal candidate for caching. Caching this type of data will provide the aforementioned “scaling” increase at the data tier since the underlying database is freed from running the majority of these queries, allowing it to run other queries which in effect provides the same benefit as scaling the database system.</p>
<p>Examples of an expensive query might be a query that aggregates several pieces of data together or performs some level of trending, along the lines of something you may see in a dashboard style view.</p>
<h3>Data that is accessed frequently</h3>
<p>Data that is accessed frequently also makes a nice candidate for caching since this type of data – even if cheap to execute and return – provides a constant load on the underlying system. Being able to effectively take this constant load off of the database and move it to the cache can yield significant performance improvements.</p>
<p>So in general there are a couple of factors that drive the cost/benefit analysis as to what should be cached: cost of data and frequency of change:</p>
<div>
<table border="1" cellspacing="0" cellpadding="2" width="400" align="center">
<tbody>
<tr>
<td width="134" valign="top"><strong>Cost of Data</strong></td>
<td width="144" valign="top"><strong>Frequency of Change</strong></td>
<td width="120" valign="top"><strong>Benefit of Caching</strong></td>
</tr>
<tr>
<td width="133" valign="top">High</td>
<td width="143" valign="top">High</td>
<td width="121" valign="top"><span style="color:#ff0000;"><strong>Low*</strong></span></td>
</tr>
<tr>
<td width="133" valign="top">High</td>
<td width="143" valign="top">Low</td>
<td width="122" valign="top"><span style="color:#008000;"><strong>High</strong></span></td>
</tr>
<tr>
<td width="133" valign="top">Low</td>
<td width="143" valign="top">High</td>
<td width="123" valign="top"><strong>Best not to cache</strong></td>
</tr>
<tr>
<td width="132" valign="top">Low</td>
<td width="143" valign="top">Low</td>
<td width="124" valign="top"><strong>Moderate</strong></td>
</tr>
</tbody>
</table>
</div>
<p>* While the cost of the data is very high to execute and retrieve, the benefits of caching are reduced by the frequency of change since the frequent changes will lead to high cache turnover, frequent refreshing/re-querying of data and an overall higher level of data management for this item in the cache.</p>
<h2>Strategies</h2>
<p>Two approaches we designed and tested in a prototype were the &#8220;Write Through&#8221; and &#8220;Data Event Driven&#8221; approaches. Both approaches have advantages and disadvantages associated with them and should be carefully considered in the context of how the system is used and the way in which data is interacted with.</p>
<h3>Write Through</h3>
<p>The write through cache is a a cache implementation where the cache is updated during the operation that is updating a piece of data, followed by a subsequent updating of the data in the underlying data store. In essence this is a cache first and data store second type of model.</p>
<p>This type of model is most effective in a system where there is a well defined set of interfaces for interacting with the data and all areas of the system use (ie. single source for all data interactions). A single source of updates allows for a more manageable point to maintain the data in the cache from, whereby a single component or code path is responsible for the update or refresh of the cache for a given operation.</p>
<p>Another considerations in utilizing this type of design is to think about how concurrency of updates occur in the system. There exists the possibility that there can be two distinct operations that are updating a piece of data, both of which are attempting to first change the data in the cache and then in the data store. Most typical data stores provide a mechanism for handling concurrent updates, usually through a locking mechanism. This may or may not be the case in your cache provider.</p>
<p>Since the first update occurring in the system will be to the cache (not the data store) it is essential that there be some mechanism to effectively handle the ability for concurrent attempts to update data. As mentioned some cache implementations provide the ability to lock a cache item while it is being updated effectively reproducing the same behavior as the data store.</p>
<blockquote>
<h5>Advantages</h5>
</blockquote>
<ul>
<li> 
<ul>
<li>Easy to implement given a single point of interaction to data within the system</li>
</ul>
</li>
</ul>
<blockquote>
<h5>Disadvantages</h5>
</blockquote>
<ul>
<li> 
<ul>
<li>May need to implement concurrency handling for updates to the cache</li>
<li>Calls that directly modify the database or do not use the “single point of interaction for data” can lead to stale cache data items</li>
</ul>
</li>
</ul>
<h3>Data Event Driven</h3>
<p>The data driven model is a cache implementation where the signal for a change to the cache comes from a change to the underlying data in the data store. Basically the data “signals” that it has changes and the cache is updated based on this.</p>
<p>There are two ways to handle a data driven design – the push or pull method.</p>
<p>In the pull method, there would exist a way to actively monitor the underlying data to detect changes and then react to those changes by updating the cache. An example of this would be using something like the SqlDependency feature in Microsoft ADO.NET. Typically you setup a query to watch some set of data and when the results of that query changes you are signaled and can react to the change. In my opinion and through testing this does scale well to larger systems since the number of items that need to be setup and then polled – utilizing system resources – can grow to a large number. For simpler systems or those that do not have a requirement to cache a large number of different data types, this may be appropriate.</p>
<p>In the push method, the data store itself would have a mechanism to watch a set of data for changes and signal that the data has changed to an interested party. Our prototype used a combination of triggers and SQL CLR code to detect when changes to a set of data we were interested in occurred and then raise a signal to the cache implementation to refresh the associated data. The benefit of this method was that there was a low overhead associated with tracking the changes to the data versus polling. One of the disadvantages to this approach is the maintenance of the triggers in the system. As the need to track more and more data items grows the number and complexity of the triggers to detect and deal with changes also increased.</p>
<p>A common disadvantage to both flavors of the Data Event Driven design is that the rollup from data in a normalized database to something that is typically stored in a cache – such as an aggregated type of data object – was exceptionally difficult. Translating what data should be watched for a given object such as a Customer, which might span three normalized tables in the data store was a chore. In our prototype it meant a minimum of three triggers – one for each table – to watch a portion of the data for a Customer, and then the ability to translate a change detected by any of those three triggers into a ‘Customer’ object that was held by the cache.</p>
<p>The obvious advantage and appeal of this type of system is that any and all changes to the data can be caught and propagated to the cache layer for updates as needed. There would be no stale data in the cache if someone wrote directly to the database or skirted a centralized update control point.</p>
<blockquote>
<h5>Advantages</h5>
<ul>
<li>All changes are accounted for the in the data</li>
<li>Reactive – low to no resource usage for monitoring changes</li>
</ul>
</blockquote>
<blockquote>
<h5>Disadvantages</h5>
<ul>
<li>Hard to implement.</li>
<li>Translation from physical to logical can be tricky</li>
</ul>
</blockquote>
<h2>Considerations</h2>
<h5>Dependencies between cache objects</h5>
<p>One of the more challenging aspects of a cache system implementation is how your define and manage any dependencies between data items within the cache. This should be considered in the overall design of the system as to how data is stored with especial attention given to how granular or coarse the items you are putting into the cache are. You should shy away from an implementation where you are storing very discrete data items that cannot stand on their own as having business value. Data items that are only useful when aggregated together may not make the best candidates for being cache. After all joining items together to return data with business value is the purview of the database and not necessarily that of the cache.</p>
<h5>Cache Refresh Strategy</h5>
<p>There are two approaches to consider when removing a piece of data held in cache is invalid or stale – actively refresh the data by fetching and replacing it, or remove the data from cache and let the next request fetch and cache the data.</p>
<p>In considering these approaches one factor that might drive the decision of one over another is the overall expected volume of traffic. If the expectation of the system volume is very high, it could be that “removing the cache item and letting the next requestor fetch the data” strategy could result in severe spikes in utilization at the data tier as ‘N’ number of requestors all looking for the same piece of data removed from the cache, go and request it from the database. This could possibly be mitigated if the cache supports the concept of locking on a cache item key that isn’t in cache while the data is being fetched.</p>
<h5>Single Server Cache vs. Distributed Cache</h5>
<p>Some thought should be given to whether a single cache server and the resources available to it would be sufficient for your implementation. If high availability of the cache is a requirement, you may need to consider a distributed cache implementation, which provides for storing multiple copies of your data within the cache for failover and high availability purposes.</p>
<p>I’d be interested in hearing any feedback on the ideas in this article or learning’s you many have from implementing a similar large scale caching implementations in support of a SOA based system.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stevencalise.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stevencalise.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stevencalise.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stevencalise.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stevencalise.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stevencalise.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stevencalise.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stevencalise.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stevencalise.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stevencalise.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stevencalise.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stevencalise.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stevencalise.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stevencalise.wordpress.com/83/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stevencalise.wordpress.com&amp;blog=9324228&amp;post=83&amp;subd=stevencalise&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stevencalise.wordpress.com/2011/03/03/caching-in-a-service-oriented-architecture-soa-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9619c570a5710c70dcf8aa8fb3ecc00e?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">stevencalise</media:title>
		</media:content>
	</item>
		<item>
		<title>Error returning a DataTable from a WCF service call</title>
		<link>http://stevencalise.wordpress.com/2011/01/29/error-returning-a-datatable-from-a-wcf-service-call/</link>
		<comments>http://stevencalise.wordpress.com/2011/01/29/error-returning-a-datatable-from-a-wcf-service-call/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 19:58:09 +0000</pubDate>
		<dc:creator>stevencalise</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">https://stevencalise.wordpress.com/2011/01/29/error-returning-a-datatable-from-a-wcf-service-call/</guid>
		<description><![CDATA[Not debating the merits of whether its appropriate or sensible to return a DataTable as a response from a web service, but if you receive an error like I did make sure to check the following: 1. The DataTable needs to be named.     Before (causes an error): public DataTable ExecuteDataTable() {     return new [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stevencalise.wordpress.com&amp;blog=9324228&amp;post=80&amp;subd=stevencalise&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Not debating the merits of whether its appropriate or sensible to return a <strong>DataTable</strong> as a response from a web service, but if you receive an error like I did make sure to check the following:</p>
<p>1. The <strong>DataTable</strong> needs to be named.</p>
<p>    <span style="text-decoration:underline;">Before (causes an error):</span></p>
<blockquote><p>public DataTable ExecuteDataTable()<br />
{<br />
    return new DataTable();<br />
}</p></blockquote>
<p>    <span style="text-decoration:underline;">After (no error):</span></p>
<blockquote><p>public DataTable ExecuteDataTable()<br />
{<br />
    return new DataTable(“Test”);<br />
}</p></blockquote>
<p><span style="text-decoration:underline;"> </span></p>
<p>2. Ensure that the packet sizes configured for WCF are large enough to accommodate a serialized <strong>DataTable</strong> with the data content you have in it. Serializing a <strong>DataTable</strong> to XML results in some fairly large XML documents and can easily surpass the packet limits in the default WCF configuration.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stevencalise.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stevencalise.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stevencalise.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stevencalise.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stevencalise.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stevencalise.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stevencalise.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stevencalise.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stevencalise.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stevencalise.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stevencalise.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stevencalise.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stevencalise.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stevencalise.wordpress.com/80/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stevencalise.wordpress.com&amp;blog=9324228&amp;post=80&amp;subd=stevencalise&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stevencalise.wordpress.com/2011/01/29/error-returning-a-datatable-from-a-wcf-service-call/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9619c570a5710c70dcf8aa8fb3ecc00e?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">stevencalise</media:title>
		</media:content>
	</item>
		<item>
		<title>Nuggets from Interviewing &#8211; Tips for Developers</title>
		<link>http://stevencalise.wordpress.com/2010/09/01/nuggets-from-interviewing-tips-for-developers-and-just-about-everyone/</link>
		<comments>http://stevencalise.wordpress.com/2010/09/01/nuggets-from-interviewing-tips-for-developers-and-just-about-everyone/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 23:07:53 +0000</pubDate>
		<dc:creator>stevencalise</dc:creator>
				<category><![CDATA[Interviewing]]></category>
		<category><![CDATA[interviewing]]></category>

		<guid isPermaLink="false">https://stevencalise.wordpress.com/2010/09/01/nuggets-from-interviewing-tips-for-developers-and-just-about-everyone/</guid>
		<description><![CDATA[Having participated in numerous interviews for various companies filling positions, I’ve seen some really great candidates come through, and some not so great. There have also been those candidates that appeared to be great, but made some classic mistakes. With a good sampling of interviews under my belt I thought it would be helpful to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stevencalise.wordpress.com&amp;blog=9324228&amp;post=69&amp;subd=stevencalise&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Having participated in numerous interviews for various companies filling positions, I’ve seen some really great candidates come through, and some not so great. There have also been those candidates that appeared to be great, but made some classic mistakes.</p>
<p>With a good sampling of interviews under my belt I thought it would be helpful to list a few observations in the form of tips – mostly not to do – for interviewing. I hesitated to write this as a lot of what I’m listing feels like it should be obvious to most people, but from what I’ve seen, that’s not always the case.</p>
<h3>Observations</h3>
<ol>
<li>Know what’s on your resume</li>
</ol>
<blockquote><p>A big red flag goes up when a candidate cannot speak about technologies or projects they’ve listed on their resumes. If you list it, make sure you can talk about it. Better yet, list your role on the project. What? You don’t want to list that you had the merest of any participation or a limited role on the project. Probably a good indication it doesn’t belong on your resume.</p>
<p>Interviewers aren’t impressed or looking for buzzwords for every technology out there. We want to see projects you had a <strong><em>significant role or involvement in</em></strong> and we want to know <strong><em>in-depth what you did</em></strong>. If you didn’t have a hand in something other than having been on a team that performed some work in that area, or you didn’t actually <span style="text-decoration:underline;">do</span> any of the work – don’t list it!</p>
<p>I’ve had interviews where I’ve paraphrased a question based on a statement on a candidates resume, asking them if they’ve done this before and the answer was “no”. Seriously? If you list it, make sure you have done it.</p></blockquote>
<p>2. Read the job description and ensure you meet the basic qualifications</p>
<blockquote><p>Not knowing exactly what technologies are being asked for in a position – both required and preferred/desired – leads us to believe you are mass emailing out resumes and applying to anything you can find. Normally a Human Resources or Recruiting department will screen candidates out if they don’t meet the job qualifications, but they shouldn’t have to – don’t apply for positions you don’t meet required qualifications for.</p>
<p>It’s disheartening when we hear someone say, <em>“I didn’t know you were looking for that skill”</em>, or <em>“I’m not as strong in X”</em> when the job positing clearly lists it in the context of “Proficient in X”. If you don’t know what “proficient” or “demonstrated ability” means, look it up.</p></blockquote>
<blockquote><p><strong>Make sure you meet all of the basic requirements of the position before applying.</strong></p></blockquote>
<p>3. Don’t pretend to have experience in an area</p>
<blockquote><p>This ties in with #1 above &#8211; if you list it or say you know something, make sure you know it.</p>
<p>We’ve had candidates list newer technologies like WPF or WCF on their resume which were requirements for some of the positions we’ve had and when asked to tell us what they’ve done with either technology the response is along the lines of “I’ve downloaded some of the samples and played around with them”. This is fine if the position only asked for familiarty, but isn&#8217;t normally going to suffice if it&#8217;s listed as &#8220;Demonstrable experience&#8221; or &#8220;Proficient in&#8221;.</p>
<p>It’s perfectly acceptable to talk about the fact that in your current position you haven’t yet used a technology and that you are immersing yourself in it on your own. This is great and shows that you can learn on your own and attempt to keep abreast of new technologies, but if the technology is a requirement of the position sample work will more than likely not be enough.</p>
<p>More egregious is the candidate who says they’ve spent some number of years working with a technology or had a substantial project they’ve worked on using a technology and then can’t answer basic questions about it.</p>
<p>Think about it this way – my job is to determine what your skill level is in any of the technologies that we might be using for our position. Given that objective, any attempt to pretend to know a technology will be exposed during the interview. It’s designed that way.</p>
<p><strong>Just don’t do it.</strong> It’s embarrassing for you and us.</p></blockquote>
<p>4. Know your skill level in different technologies</p>
<blockquote><p>This is one of those self-reflection type of items. In preparation for the interviewing process you should have taken some time to assess your skill level in different areas. We all have stronger and weaker areas. Know what yours are – it helps.</p>
<p>In the interview process I will usually ask a candidate to rate themselves in a few of the skills we are focusing on in the interview. Scale of 1 to 10, 10 being an expert.</p>
<p>The answer to this question gives me some insight into <strong>(a)</strong> is how you rated yourself consistent with what I see on your resume, <strong>(b)</strong> is it aligned with the requirements of the position and <strong>(c) </strong>gives me a sense of what level of questions I should ask you.</p>
<p><strong>(A)</strong> Rating yourself inconsistently with what’s on your resume leads me to ask you more<br />
about your past experiences.</p>
<p>If you rated yourself lower than your presented experience we may need to explore past project work. What was the role on the project? Did you use the skill on that project? To what level of depth?</p>
<p>If the rating is much higher than on the resume I want to know why. Was the role you had more substantial than you presented? Some resumes have so many projects listed that they all explanations are brief. This may indicate that your resume isn’t presenting yourself as well as it could for the position.</p>
<p><strong>(B)</strong> If the position requirement lists “Proficient in writing SQL queries” and you rate yourself a 2 in SQL, we have a problem. In either case – rating yourself higher or lower than required for the position – means we need to explore further.</p>
<p><strong>(C)</strong> Knowing where you think you’re at experience-wise with a technology gives me a good sense of where to start asking questions. Someone rating themselves a 5 or below will get more basic questions to <strong>start with</strong>, whereas someone rating themselves higher will start with more difficult questions. We will still circle back to some basics to ensure a good foundation but expect to be asked more detailed questions as to why/how things work.</p>
<p>We aren’t necessarily looking for syntax in these questions as opposed to knowledge of concepts and how things work, tradeoffs, etc. As a developer myself there are a ton of times I can’t remember the syntax for something and need to look it up or use Intellisense to help.</p>
<p><strong>Reflect on your skills and “where you’re at”.</strong></p></blockquote>
<p>5. Don’t be afraid to say you don’t know</p>
<blockquote><p>One common mistake during interviews is the failure to say “I don’t know”. It is perfectly valid to tell an interviewer that you aren’t familiar with a concept or technology. Constant change is a fact in our industry. There’s the possibility that given the breadth of technologies we employ and the depth of each, that there will likely be corners of a technology that you’ve used that you are unfamiliar with or even a full technology stack for that matter.</p>
<p>If the case occurs that the interview leads down one of these less traveled paths, it’s always preferable to an interviewer to hear “I don’t know”, rather than have a candidate try to guess, make things up or tell the interviewer what you think they want to hear. The former leaves the impression of honesty, while the latter leads to a perception of lack of knowledge or worse – of deception.</p>
<p>Most interviewers that attempt to be fair and find good candidates won’t immediately count an “I don’t know” against a candidate unless its in a core area that is going to be required of the position. Even then I try to weigh whether the item not understood is a conceptual issue or something that as a practitioner that you might use reference material (ie. Google, Books, etc) to normally accomplish.</p>
<p><strong>When you don’t know, be honest. Don’t make things up, guess or try to give the interviewer what they want to hear.</strong></p></blockquote>
<p>6. Don’t talk badly about past people or positions</p>
<blockquote><p>An obviously bad idea is to trash talk about people you’ve worked with or companies that have employed you. This immediately leaves an interviewer to believe that you are the type of person to tear people down rather than help lift the entire group.</p>
<p>I honestly believe most people know they shouldn’t talk badly about past employers and coworkers in an interview, but for some reason there is a subset of people that once they get in front of you can’t help but tear people down. I’m not sure if its due to nervousness, the question asked (e.g. tell me about a challenge…), or if they just really had a terrible experience with an employer.</p>
<p>But think about it from this perspective. You are interviewing for a position with a new company.  If for some reason that company makes you an offer and further down the road things don’t work out, the interviewer is likely getting a good sense of how you are going to describe them or their company on your next interview. I can guarantee that the thought going through the interviewer’s mind is – <strong>PASS</strong>.</p>
<p><strong>Keep it positive. Talk about challenges, not how much you can’t stand a company or coworker.</strong></p></blockquote>
<p>7. Don’t make assumptions</p>
<blockquote><p>This is a very broad statement, but its applicable from the standpoint of, as soon as you start making assumptions there exists the possibility of error. Making assumptions can take many forms. Perhaps you think that for a certain line of questioning by the interviewer that they are looking for a certain answer. This might apply more often for a behavioral style of interview question, where you <strong><em>assume</em></strong> that the interviewer is trying to probe for whether a certain set of traits or behaviors from you. These type of assumptions can quickly lead you astray if you make the wrong assumption.</p>
<p>If in doubt it’s always better to ask for clarification. The interviewer won’t mind paraphrasing or explaining something a bit more clearly, and as a bonus you will appear more engaged than someone who makes an assumption.</p>
<p>Another assumption I’ve seen made is one of a candidate believing they are a perfect fit for the position and therefore not doing any “selling” of themselves. A candidate that feels that based on the experiences listed on their resume or previous positions held that they assume you that the interviewer will “obviously see” that they are a perfect fit, is <strong><em>assuming</em></strong> a few things.</p>
<p>The first thing that they assume is that the interviewer is valuing something on their resume or in their background the same way that they do. Maybe – maybe not.</p>
<p>Another assumption being made is that because of the “obviousness” of the assumption being made, that there is no need to sell themselves or their skills to the interviewer. Remember that the candidates main objective is to show the interviewer that they are qualified for the position and how they can add value to the organization. I can’t imagine someone failing worse than someone who is qualified and assumes that the interviewer see this and therefore doesn’t close the deal by explaining how they see themselves fitting into the position. Not to mention it gives a perception of overconfidence on the candidates part.</p>
<p><strong>Assume nothing.</strong></p></blockquote>
<p>8. Be prepared to demonstrate your knowledge</p>
<blockquote><p>There are several interviewing techniques that are employed, but when interviewing I usually insist on having the candidate demonstrate their ability in one way or another.</p>
<p>This can mean reading and discussing some code. Or it can be a whiteboard design problem that you are asked to work through. It can even be writing some code to demonstrate your ability to design something or solve a specific problem.</p>
<p>Now, unless you’ve really done your homework on a company and their hiring practices it may be difficult to determine what to be prepared for. The point is that if you are interviewing for a development position you should be able to demonstrate that you can develop something.</p>
<p>Many times the reason behind the exercise is not to determine if you read or write some code correctly or designed a system to a given requirement. Rather it’s usually tied to how you get to the result, and not the correctness of the result. It’s more helpful for me to see how you think – do you ask questions, do you make assumptions, what tradeoffs are being considered, etc &#8211; than whether you know how to solve a single specific problem.</p>
<p><strong>Rather than tell me, show me.</strong></p></blockquote>
<p>9. Do share your non-work activities that are directly related to the position</p>
<blockquote><p>Many candidates tend to try and avoid talking about non-work activities. In most cases I would agree. As an interviewer I don’t particularly care that you enjoy playing sports or sailing.</p>
<p>BUT, if the activity is related to the position you are applying for or technologies being used by all means let the interviewer know. In fact, its one of those “key indicators” that can be looked for to show some additional level of motivation or passion from the candidate. For a developer this might range from the Exchange server you run at home to learn with, or the game you wrote, or the books/clubs/organizations/usergroups you read and/or are a part of.</p>
<p><strong>So if it relates to the job or technology bring it up. If it doesn’t don’t.</strong></p></blockquote>
<p>Good luck and I hope these tips help.</p>
<p>Related: <a href="https://stevencalise.wordpress.com/2010/08/28/nuggets-from-interviewing-interviewer-techniques/">Nuggets from Interviewing – Interviewer Techniques</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stevencalise.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stevencalise.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stevencalise.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stevencalise.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stevencalise.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stevencalise.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stevencalise.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stevencalise.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stevencalise.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stevencalise.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stevencalise.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stevencalise.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stevencalise.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stevencalise.wordpress.com/69/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stevencalise.wordpress.com&amp;blog=9324228&amp;post=69&amp;subd=stevencalise&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stevencalise.wordpress.com/2010/09/01/nuggets-from-interviewing-tips-for-developers-and-just-about-everyone/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9619c570a5710c70dcf8aa8fb3ecc00e?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">stevencalise</media:title>
		</media:content>
	</item>
		<item>
		<title>Binding DataGrid columns to DataContext items</title>
		<link>http://stevencalise.wordpress.com/2010/08/28/binding-datagrid-columns-to-datacontext-items/</link>
		<comments>http://stevencalise.wordpress.com/2010/08/28/binding-datagrid-columns-to-datacontext-items/#comments</comments>
		<pubDate>Sat, 28 Aug 2010 11:58:04 +0000</pubDate>
		<dc:creator>stevencalise</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">https://stevencalise.wordpress.com/2010/08/28/binding-datagrid-columns-to-datacontext-items/</guid>
		<description><![CDATA[The WPF DataGrid is a fantastic component. It’s flexible and can serve in a lot of different scenarios. Recently I was using the DataGrid in a project and had the need to dynamically hide certain columns via a users selection in a configuration section. The idea is the user would check a box to hide [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stevencalise.wordpress.com&amp;blog=9324228&amp;post=67&amp;subd=stevencalise&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The WPF DataGrid is a fantastic component. It’s flexible and can serve in a lot of different scenarios. Recently I was using the DataGrid in a project and had the need to dynamically hide certain columns via a users selection in a configuration section.</p>
<p>The idea is the user would check a box to hide a corresponding column represented in the DataGrid and the column would not appear.</p>
<p> <a href="http://stevencalise.files.wordpress.com/2010/08/image.png"><img style="display:inline;border:0;" title="image" src="http://stevencalise.files.wordpress.com/2010/08/image_thumb.png?w=244&#038;h=178" border="0" alt="image" width="244" height="178" /></a> <a href="http://stevencalise.files.wordpress.com/2010/08/image1.png"><img style="display:inline;border:0;" title="image" src="http://stevencalise.files.wordpress.com/2010/08/image_thumb1.png?w=244&#038;h=178" border="0" alt="image" width="244" height="178" /></a></p>
<p>I implemented the XAML as below, binding the columns visibility flag to the checkboxes IsChecked value with the appropriate converter. I was surprised to find that this didn’t work at all. Toggling the checkbox did nothing.</p>
<p><a href="http://stevencalise.files.wordpress.com/2010/08/image2.png"><img style="display:inline;border:0;" title="image" src="http://stevencalise.files.wordpress.com/2010/08/image_thumb2.png?w=609&#038;h=385" border="0" alt="image" width="609" height="385" /></a></p>
<p>Looking in the IDE’s Output window I noticed the following binding error message:</p>
<p><strong>System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=IsChecked; DataItem=null; target element is &#8216;DataGridTextColumn&#8217; (HashCode=19699911); target property is &#8216;Visibility&#8217; (type &#8216;Visibility&#8217;)</strong></p>
<p>After some digging around, I found that the DataGrid columns aren’t actually in the Visual Tree of the window as you can see from the screenshot below.</p>
<p><a href="http://stevencalise.files.wordpress.com/2010/08/image3.png"><img style="display:inline;margin-left:0;margin-right:0;border:0;" title="image" src="http://stevencalise.files.wordpress.com/2010/08/image_thumb3.png?w=293&#038;h=371" border="0" alt="image" width="293" height="371" align="left" /></a></p>
<p>This is the source of our error, as the DataGridTextColumn we are trying to bind to things isn’t participating in the Visual Tree.  To work around this we can implement the DataGrid’s DataContextChanged event and “forward’ the DataContext to the individual columns.</p>
<p>This would allow the individual columns to be able to be bound to items within the DataContext. Below is a quick and dirty implementation of how to perform this forwarding.</p>
<p>A more elegant way to do this would be to override the DataContextChanged property on all Datarid’s using  a metadata override.</p>
<p>Here’s the code behind to handle the DataContextChanged event and forward the context to the columns. Notice that I’ve also implemented a property with change notification to be used by the checkbox to store it’s “IsChecked” value so that it can be retrieved via the DataContext.</p>
<p><a href="http://stevencalise.files.wordpress.com/2010/08/image4.png"><img style="display:inline;border:0;" title="image" src="http://stevencalise.files.wordpress.com/2010/08/image_thumb4.png?w=593&#038;h=264" border="0" alt="image" width="593" height="264" /></a></p>
<p>And here’s the modified XAML showing the Checkbox now bound to the new property and the DataGrid’s first column bound to the same value using the DataContext.</p>
<p><a href="http://stevencalise.files.wordpress.com/2010/08/image5.png"><img style="display:inline;border:0;" title="image" src="http://stevencalise.files.wordpress.com/2010/08/image_thumb5.png?w=599&#038;h=279" border="0" alt="image" width="599" height="279" /></a></p>
<p>Because the DataGridTextColumn is not part of the visual tree I don’t believe there is any way to perform direct element bindings.</p>
<p>If someone figures this out, drop me a note.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stevencalise.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stevencalise.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stevencalise.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stevencalise.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stevencalise.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stevencalise.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stevencalise.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stevencalise.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stevencalise.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stevencalise.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stevencalise.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stevencalise.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stevencalise.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stevencalise.wordpress.com/67/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stevencalise.wordpress.com&amp;blog=9324228&amp;post=67&amp;subd=stevencalise&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stevencalise.wordpress.com/2010/08/28/binding-datagrid-columns-to-datacontext-items/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9619c570a5710c70dcf8aa8fb3ecc00e?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">stevencalise</media:title>
		</media:content>

		<media:content url="http://stevencalise.files.wordpress.com/2010/08/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://stevencalise.files.wordpress.com/2010/08/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://stevencalise.files.wordpress.com/2010/08/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://stevencalise.files.wordpress.com/2010/08/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://stevencalise.files.wordpress.com/2010/08/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://stevencalise.files.wordpress.com/2010/08/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Nuggets from Interviewing &#8211; Interviewer Techniques</title>
		<link>http://stevencalise.wordpress.com/2010/08/28/nuggets-from-interviewing-interviewer-techniques/</link>
		<comments>http://stevencalise.wordpress.com/2010/08/28/nuggets-from-interviewing-interviewer-techniques/#comments</comments>
		<pubDate>Sat, 28 Aug 2010 10:34:00 +0000</pubDate>
		<dc:creator>stevencalise</dc:creator>
				<category><![CDATA[Interviewing]]></category>
		<category><![CDATA[interviewing]]></category>

		<guid isPermaLink="false">https://stevencalise.wordpress.com/2010/08/28/nuggets-from-interviewing-interviewer-techniques/</guid>
		<description><![CDATA[Interviewing candidates for an open job position is hard. Period. No matter what process or methodology you use, in the end it comes down to trying to summarize a persons skills, personality, work ethic and team fit within a relatively small allotted time. Not an easy task. As an interviewee I’ve participated in many different [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stevencalise.wordpress.com&amp;blog=9324228&amp;post=53&amp;subd=stevencalise&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Interviewing candidates for an open job position is hard. Period. </p>
<p>No matter what process or methodology you use, in the end it comes down to trying to summarize a persons skills, personality, work ethic and team fit within a relatively small allotted time. Not an easy task.</p>
<p>As an interviewee I’ve participated in many different interview styles that companies had ranging from a brief single discussion with the hiring manager to the grueling eight hour interview with standardized testing, five one on one&#160; interviews and a case study.</p>
<p>What I’ve found is that, along with most things in life, a style somewhere in between both extremes works best. Keeping in mind the damage hiring the “wrong” person can cause – lower productivity, morale problems, inter-team social issues, etc – we can immediately see that any extra effort needed upfront to setup a process that works will yield greater results in finding the “right people” and pay us back in the long run.</p>
<h3>The Interview Process</h3>
<p>There are many ingredients you can choose from when thinking about what to include in your interview process. The list below contains some of the techniques I use in interviews I participate in as well as some that others might be familiar with. </p>
<ul>
<li>One on one interview </li>
</ul>
<blockquote><p>A individual discussion between the candidate and a key team member. To be most effective this should be someone at least technical enough to distinguish between someone who knows the technology or area being discussed and someone who is good at talking around an area.</p>
<p>My opinion is that the interview must be with at least one individual that would be considered a “peer” or have a close working relationship with whoever is hired into the position.</p>
<p><strong>Pros:</strong></p>
<p>&#160; &#8211; Lower stress than a group interview</p>
<p>&#160; &#8211; Can get multiple reads on the same areas from a candidate</p>
<p><strong>Cons:</strong></p>
</blockquote>
<blockquote><p>&#160; &#8211; Time can be a factor if there are several individuals on the team you want the candidate&#160; <br />&#160;&#160;&#160; to speak with</p>
<p>&#160; &#8211; Need to reconcile each interviewers perception of the candidate. More difficult when      <br />&#160;&#160;&#160; there are discrepancies in perceptions of the candidate.</p>
</blockquote>
<ul>
<li>Group interview </li>
</ul>
<blockquote><p>The group interview is one of those techniques that if done correctly works well and if not done correctly is a complete disaster. The idea is to have several key team members in the interview at once all taking turns interacting with and asking the candidate questions.</p>
<p><strong>Pros:</strong></p>
<p>&#160; &#8211; Allows multiple team members to evaluate the same answers given by the candidate</p>
<p>&#160; &#8211; Can leverage the experience and specialties of many individuals</p>
<p>&#160; &#8211; Allows those not currently interacting with the candidate to focus more on the responses      <br />&#160;&#160;&#160; from the candidate</p>
<p>&#160; &#8211; Less chance of difficult reconciliations since all interviewers hear the same response to      <br />&#160;&#160;&#160; questions</p>
<p><strong>Cons:</strong></p>
<p>&#160; &#8211; Higher stress environment for the candidate</p>
<p>&#160; &#8211; Can feel like a “firing squad” or inquisition if not done right</p>
</blockquote>
<ul>
<li>Standardized testing </li>
</ul>
<blockquote><p>Standardized testing usually takes the form of a non-technical assessment of a candidate usually focusing in on behavioral, reasoning and logic questions.</p>
<p><strong>Pros:</strong></p>
<p>&#160; &#8211; Easy to compare results across candidates</p>
<p>&#160; &#8211; Useful if your team believes there is a direct correlation between the success in the job      <br />&#160;&#160;&#160; position and the generalized knowledge being tested</p>
<p><strong>Cons:</strong></p>
<p>&#160; &#8211; Some people aren’t good at taking tests, especially under pressure. May result in loss of      <br />&#160;&#160;&#160; qualified candidates</p>
</blockquote>
<ul>
<li>Written or Verbal technical assessments </li>
</ul>
<blockquote><p>Written or verbal quizzes on the applicable technology areas your team uses. Can cover a range of topics and skills levels from basic knowledge to advanced concepts. </p>
<p>This should not devolve into a syntax assessment, as most programmers rely heavily on documentation, Intellisense and reference material for syntax, although the more familiar with the syntax a candidate is, the likelier they are to have been using the technology more recently and frequently.</p>
<p><strong>Pros:</strong></p>
<p>&#160; &#8211; Easy to determine whether the candidate has used the technology and has a firm      <br />&#160;&#160;&#160; understanding of the underpinnings</p>
<p><strong>Cons:</strong></p>
<p>&#160; &#8211; None</p>
</blockquote>
<ul>
<li>Reviewing of code </li>
</ul>
<blockquote><p>The intent of having the candidate read code is to determine a few things: </p>
<p>&#160;&#160;&#160;&#160;&#160; &#8211; Do they understand the programming language being used. </p>
<p>&#160;&#160;&#160;&#160;&#160; &#8211; Can they understand someone else&#8217;s code. A good portion of your product is      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; likely written already. If the candidate can’t read and understand this existing code       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; that may be a problem. Most companies can ill-afford the employee who needs to       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; rewrite / refactor every area they work in so that they can properly understand it. </p>
<p>&#160;&#160;&#160;&#160;&#160; &#8211; Can they intelligently talk about a piece of code and what some of the characteristics      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; of it are &#8211; Usage patterns, good things, things to be improved, etc. </p>
</blockquote>
<blockquote><p><strong>Pros:</strong></p>
<p>&#160; &#8211; Good read on the candidates ability to understand code. Something not obtained      <br />&#160;&#160;&#160; through verbal/written technical assessments.</p>
</blockquote>
<blockquote><p><strong>Cons:</strong></p>
<p>&#160; &#8211; Stressful for the candidate as they will feel pressured and “on-stage”</p>
</blockquote>
<ul>
<li>Spot the bug / Troubleshooting Exercises </li>
</ul>
<blockquote><p>This technique usually involves having the candidate review a piece of code or application that has a bug in it. This exercise can be tailored to be very light or more complex.</p>
<p>A light version of this would be to have the candidate review a set of short code blocks with issues or bugs in them. These could be highlight core mistakes in the understanding of a concept to a more esoteric ones. These also should not include syntax problems that would be easily picked up by a compiler as most developers tend to rely on this.</p>
<p>For a more complex exercise, the candidate could review the companies actual product where bugs have been introduced into the code. Since the code would need to run to be worked on by the candidate these bugs would not be syntax related.</p>
<p><strong>Pros:</strong></p>
<p><strong>&#160; &#8211; </strong>You get the candidate doing exactly what you are hiring them for- working with code.</p>
<p>&#160; &#8211; Provides a good insight into a candidates ability to troubleshoot, identify and correct      <br />&#160;&#160;&#160; code. What a concept!</p>
<p><strong>Cons:</strong></p>
<p>&#160; &#8211; Candidates might feel stressed having to work with code in the interview. This can      <br />&#160;&#160;&#160; be alleviated by leaving the room, or by interacting with the candidate as they work –.       <br />&#160;&#160;&#160; answering questions and guiding them (although not directly to the answer!).</p>
<p>&#160; &#8211; Depending on the bug introduced and the subtleties / complexities of the scenario the      <br />&#160;&#160;&#160; candidate might not be able to identify this. Make sure the bug is relatively apparent, or       <br />&#160;&#160;&#160; better yet have multiple bugs ranging from easy to more complex.</p>
</blockquote>
<ul>
<li>Design Problems </li>
</ul>
<blockquote><p>The technique referred to here are programming design problems, not esoteric ones. Usually involves describing a hypothetical system or problem that needs to be designed by the candidate giving them just enough details to start – barely.</p>
<p>The exercise usually involves the candidate coding the problem on a provided computer.</p>
<p>The premise behind this technique is that you want to be able to gauge how well a candidate can take a set of instructions and break them down into a well designed program. The main takeaway from this technique is the thought process and decisions that the candidate makes along the way and not the final outcome.</p>
<p>In fact we usually don’t have the candidate finish whatever problem was chosen. Observe things like: </p>
<p>&#160;&#160;&#160;&#160; &#8211; Did the candidate ask clarifying questions on the requirements/premise of the problem </p>
<p>&#160;&#160;&#160;&#160; &#8211; How did the candidate approach the problem – dive right in coding, draw it out, ask      <br />&#160;&#160;&#160;&#160;&#160;&#160; questions </p>
<p>&#160;&#160;&#160;&#160; &#8211; Did the candidate consider the appropriate tradeoffs in design – speed, performance,      <br />&#160;&#160;&#160;&#160;&#160;&#160; usability </p>
</blockquote>
<blockquote><p>Remember that the focus is not on the end result but on <strong><u>how</u> </strong>the candidate approaches the problem and works through it. </p>
</blockquote>
<blockquote><p><strong>Pros:</strong></p>
<p>&#160; &#8211; Provides insight into how a candidate thinks about problems and design considerations</p>
<p>&#160; &#8211; Can be used as a gauge of experience, familiarity with tools, language/project choices, etc</p>
<p><strong>Cons:</strong></p>
<p>&#160; &#8211; Pick an area that is unfamiliar to the candidate. Make sure the problem is a fairly well know      <br />&#160;&#160;&#160; concept so it doesn’t require and explanation aside from the intended requirements.</p>
<p>&#160; &#8211; More stressful than direct interview discussions since the candidate will feel like they are      <br />&#160;&#160;&#160; “on-stage”. Be sure to explain the intent of the exercise is to see their approach to the       <br />&#160;&#160;&#160; problem.</p>
</blockquote>
<ul>
<li>“Try before you buy” </li>
</ul>
<blockquote><p>Pairing the candidate up with a team member for a time period on a current project and let them code together. This appears to be more applicable when the team is following an Agile methodology.</p>
<p><strong>Pros:</strong></p>
<p>&#160; &#8211; Useful to see the candidate in action. Coding style, thought processes, etc.</p>
<p>&#160; &#8211; Able to get a rough gauge on team fit, personality.</p>
<p><strong>Cons:</strong></p>
<p>&#160; &#8211; Time. This requires a long time commitment by the candidate</p>
<p>&#160; &#8211; May not work well with a candidate that is not familiar with the Agile methodology. Most      <br />&#160;&#160;&#160; non Agile shops don’t have programmers pairing together.</p>
<p>&#160; &#8211; May be difficult for candidate to participate and demonstrate anything useful due to lack      <br />&#160;&#160;&#160; of knowledge of the feature, code, etc.</p>
<p>&#160;</p>
</blockquote>
<p>In the end what you choose to be a part of your process must be based on what works for your team and business culture and the amount of time you can invest in each interview. </p>
<p>Some of the techniques I find the most useful in interviews I participate in are the “hands-on” techniques. If I am hiring for a developer, then I want someone who can read and write code. If I’m in the interview, you will need to convince me you can code.</p>
<p>Let me hear from you if there are techniques you find work better than others for your team, or if you have any ones I haven’t listed here.</p>
<p>Related: <a href="https://stevencalise.wordpress.com/2010/09/01/nuggets-from-interviewing-tips-for-developers-and-just-about-everyone/">Nuggets from Interviewing &#8211; Tips for Developers and just about everyone</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stevencalise.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stevencalise.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stevencalise.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stevencalise.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stevencalise.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stevencalise.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stevencalise.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stevencalise.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stevencalise.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stevencalise.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stevencalise.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stevencalise.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stevencalise.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stevencalise.wordpress.com/53/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stevencalise.wordpress.com&amp;blog=9324228&amp;post=53&amp;subd=stevencalise&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stevencalise.wordpress.com/2010/08/28/nuggets-from-interviewing-interviewer-techniques/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9619c570a5710c70dcf8aa8fb3ecc00e?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">stevencalise</media:title>
		</media:content>
	</item>
		<item>
		<title>WPF &#8211; Overlapped Image Control</title>
		<link>http://stevencalise.wordpress.com/2010/03/15/wpf-overlapped-image-control/</link>
		<comments>http://stevencalise.wordpress.com/2010/03/15/wpf-overlapped-image-control/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 13:59:55 +0000</pubDate>
		<dc:creator>stevencalise</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Controls]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://stevencalise.wordpress.com/2010/03/15/wpf-overlapped-image-control/</guid>
		<description><![CDATA[I was recently trying to find a way to display some data that gave the user a relatively easy way to gauge the number of items in a dataset as well as still being functional enough to interact with those data items. An example of this need might be a user administration module for an [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stevencalise.wordpress.com&amp;blog=9324228&amp;post=47&amp;subd=stevencalise&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was recently trying to find a way to display some data that gave the user a relatively easy way to gauge the number of items in a dataset as well as still being functional enough to interact with those data items.</p>
<p>An example of this need might be a user administration module for an application where a user can have several states:</p>
<ul>
<li>Suspended Logins </li>
<li>Awaiting approval </li>
<li>Requiring password resets </li>
</ul>
<p>So I thought an interesting and appealing way to display this information would be a in a graph format where each category was a point on the axis and the data points (users) would be represented graphically in a overlapped manner (think similar to a stack of dimes).</p>
<p>My requirements were simply to allow items to overlap by a certain percentage of their width or height.</p>
<p>Here’s is what I ended up with.</p>
<p><a href="http://stevencalise.files.wordpress.com/2010/03/image.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://stevencalise.files.wordpress.com/2010/03/image_thumb.png?w=244&#038;h=109" width="244" height="109" /></a>&#160;</p>
<p>My first attempt at creating the overlapped effect was to use a translation render transform. This didn’t work because the translation needed to be performed by more than a fixed amount per item.</p>
<p>So I decided to create my own custom panel to handle the placement of items.</p>
<p>I chose the StackPanel as a basis for my custom panel. Breaking it down there were 3 steps involved in creating the custom panel:</p>
<ul>
<li>Add a dependency property to allow setting the percentage of overlap </li>
<li>Define the MeasureOverride() logic needed </li>
<li>Define the ArrangeOverride() logic needed </li>
</ul>
<p>&#160;</p>
<h3>Add the Dependency Property</h3>
<p>I started by creating the dependency property to allow the percentage of overlap to be specified by a caller.</p>
<blockquote><pre class="csharpcode"><span class="rem">/// &lt;summary&gt;</span>
<span class="rem">/// Percentage of overlap</span>
<span class="rem">/// &lt;/summary&gt;</span>
<span class="kwrd">public</span> <span class="kwrd">int</span> OverlapPercentage
{
   get { <span class="kwrd">return</span> (<span class="kwrd">int</span>)GetValue(OverlapPercentageProperty); }
   set { SetValue(OverlapPercentageProperty, <span class="kwrd">value</span>); }
}

<span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">readonly</span> DependencyProperty OverlapPercentageProperty =
   DependencyProperty.Register(<span class="str">&quot;OverlapPercentage&quot;</span>, <span class="kwrd">typeof</span>(<span class="kwrd">int</span>), <span class="kwrd">typeof</span>(OverlapImageStackPanel),
   <span class="kwrd">new</span> FrameworkPropertyMetadata(0, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsArrange));</pre>
</blockquote>
<pre class="csharpcode">&#160;</pre>
<h3>Define MeasureOverride Logic </h3>
<p>The last step is to implement our overrides for the MeasureOverride() and ArrangeOverride().&#160; For the measurement pass we sum up the widths or heights (depending on the orientation) taking into account the percentage of overlap requested.</p>
<blockquote>
<pre class="csharpcode"><span class="kwrd">protected</span> <span class="kwrd">override</span> Size MeasureOverride(Size availableSize)
{
    Size infinietSize = <span class="kwrd">new</span> Size(<span class="kwrd">double</span>.PositiveInfinity, <span class="kwrd">double</span>.PositiveInfinity);
    <span class="kwrd">double</span> overlapPercentageDouble = (<span class="kwrd">double</span>)OverlapPercentage / 100.0;
    <span class="kwrd">double</span> unoverlapPercentageDouble = 1.0 - ((<span class="kwrd">double</span>)OverlapPercentage / 100.0);

    <span class="kwrd">double</span> totalWidths = 0;
    <span class="kwrd">double</span> totalHeights = 0;

    <span class="rem">// get total widths of each child                       </span>
    <span class="kwrd">foreach</span> (UIElement child <span class="kwrd">in</span> Children)
    {
        child.Measure(availableSize);
        <span class="kwrd">if</span> (child.Visibility != Visibility.Collapsed)
        {
            <span class="kwrd">if</span> (Orientation == Orientation.Horizontal)
            {
                totalWidths += child.DesiredSize.Width * overlapPercentageDouble;
                totalHeights = (child.DesiredSize.Height &gt; totalHeights) ? child.DesiredSize.Height : totalHeights;
            }
            <span class="kwrd">else</span>
            {
                totalHeights += child.DesiredSize.Height * overlapPercentageDouble;
                totalWidths = (child.DesiredSize.Width &gt; totalWidths) ? child.DesiredSize.Width : totalWidths;
            }
        }
    }

    <span class="kwrd">if</span> (Orientation == Orientation.Horizontal)
        totalWidths += unoverlapPercentageDouble;
    <span class="kwrd">else</span>
        totalHeights += unoverlapPercentageDouble;

    Size resultSize = <span class="kwrd">new</span> Size();
    resultSize.Width = <span class="kwrd">double</span>.IsPositiveInfinity(availableSize.Width) ? totalWidths : availableSize.Width;
    resultSize.Height = <span class="kwrd">double</span>.IsPositiveInfinity(availableSize.Height) ? totalHeights : availableSize.Height;

    <span class="kwrd">return</span> resultSize;
}</pre>
</blockquote>
<h3><font color="#000000">Define ArrangeOverride Logic</font>&#160;</h3>
<p>For the Arrange layout pass we layout the children taking into account the percentage of overlap for each child item as set on the control.</p>
<blockquote>
<pre class="csharpcode"><span class="kwrd">protected</span> <span class="kwrd">override</span> Size ArrangeOverride(Size finalSize)
{
    <span class="kwrd">if</span> (Children.Count == 0)
        <span class="kwrd">return</span> finalSize;

    <span class="kwrd">double</span> availableWidth = finalSize.Width;
    <span class="kwrd">double</span> availableHeight = finalSize.Height;
    <span class="kwrd">double</span> totalWidths = 0;
    <span class="kwrd">double</span> totalHeights = 0;

    <span class="kwrd">double</span> overlapPercentageDouble = (<span class="kwrd">double</span>)OverlapPercentage / 100.0;
    <span class="kwrd">double</span> unoverlapPercentageDouble = 1.0 - overlapPercentageDouble;

    <span class="rem">// get total widths of each child                        </span>
    <span class="kwrd">foreach</span> (UIElement child <span class="kwrd">in</span> Children)
    {
        <span class="kwrd">if</span> (child.Visibility != Visibility.Collapsed)
        {
            <span class="kwrd">if</span> (Orientation == Orientation.Horizontal)
            {
                totalWidths += child.DesiredSize.Width * overlapPercentageDouble;
                totalHeights = finalSize.Height;
            }
            <span class="kwrd">else</span>
            {
                totalHeights += child.DesiredSize.Height * overlapPercentageDouble;
                totalWidths = finalSize.Width;
            }
        }
    }

    <span class="kwrd">if</span> ((Orientation == Orientation.Horizontal &amp;&amp; (availableWidth &lt; 0 || totalWidths &lt;= 0)) ||
        (Orientation == Orientation.Vertical &amp;&amp; (availableHeight &lt; 0 || totalHeights &lt;= 0)))
    {
        <span class="kwrd">return</span> finalSize;
    }

    <span class="kwrd">if</span> (Orientation == Orientation.Horizontal)
        totalWidths += unoverlapPercentageDouble;
    <span class="kwrd">else</span>
        totalHeights += unoverlapPercentageDouble;

    <span class="kwrd">double</span> left = 0;
    <span class="kwrd">double</span> top = 0;
    <span class="kwrd">foreach</span> (UIElement child <span class="kwrd">in</span> Children)
    {
        child.Arrange(<span class="kwrd">new</span> Rect(<span class="kwrd">new</span> Point(left, top), <span class="kwrd">new</span> Size(child.DesiredSize.Width, child.DesiredSize.Height)));
        <span class="kwrd">if</span> (Orientation == Orientation.Horizontal)
        {
            left += child.DesiredSize.Width * unoverlapPercentageDouble;
        }
        <span class="kwrd">else</span>
        {
            top += child.DesiredSize.Height * unoverlapPercentageDouble;
        }
    }

    <span class="kwrd">return</span> <span class="kwrd">new</span> Size(totalWidths, totalHeights);<span class="rem">//finalSize;</span>
}</pre>
</blockquote>
<pre class="csharpcode">That sums up what’s needed to implement a fairly handy overlapped StackPanel. Similar logic can be used for a WrapPanel as well.</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stevencalise.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stevencalise.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stevencalise.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stevencalise.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stevencalise.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stevencalise.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stevencalise.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stevencalise.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stevencalise.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stevencalise.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stevencalise.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stevencalise.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stevencalise.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stevencalise.wordpress.com/47/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stevencalise.wordpress.com&amp;blog=9324228&amp;post=47&amp;subd=stevencalise&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stevencalise.wordpress.com/2010/03/15/wpf-overlapped-image-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9619c570a5710c70dcf8aa8fb3ecc00e?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">stevencalise</media:title>
		</media:content>

		<media:content url="http://stevencalise.files.wordpress.com/2010/03/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Constructing a DAL in C#</title>
		<link>http://stevencalise.wordpress.com/2009/10/16/constructing-a-dal-in-c/</link>
		<comments>http://stevencalise.wordpress.com/2009/10/16/constructing-a-dal-in-c/#comments</comments>
		<pubDate>Fri, 16 Oct 2009 12:44:46 +0000</pubDate>
		<dc:creator>stevencalise</dc:creator>
				<category><![CDATA[ADO.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[DAL]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://stevencalise.wordpress.com/?p=37</guid>
		<description><![CDATA[I’ve been asked many times why someone might write their own DAL given that there exist so many frameworks that can provide this functionality already. And the truth is – you may or may not need to. There are a lot of available DAL’s and frameworks out there that can provide many of the common [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stevencalise.wordpress.com&amp;blog=9324228&amp;post=37&amp;subd=stevencalise&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I’ve been asked many times why someone might write their own DAL given that there exist so many frameworks that can provide this functionality already.</p>
<p>And the truth is – you may or may not need to.</p>
<p>There are a lot of available DAL’s and frameworks out there that can provide many of the common features of database platform and type abstraction, but you (as I did) may have certain needs that aren’t fulfilled by these frameworks.</p>
<p>Examples of some custom tasks that aren’t readily covered by some frameworks might be:</p>
<ul>
<li>Parsing and insertion of custom data in SQL statements </li>
<li>Syntax abstraction in SQL statements </li>
<li>Auto-population of application specific data (e.g. DAL knowledge of some schema or application mechanisms) </li>
</ul>
<ul>While any of the above, or other, tasks can likely be accomplished with most frameworks through some level of effort, the number one reason in my mind to write your own DAL at some point is to<strong><span style="text-decoration:underline;"><em> gain a deeper understanding</em></span></strong> of what is happening beneath the covers when using a DAL – either through a framework or perhaps an existing for a project you are working on.</ul>
<ul>Gaining a thorough understanding of the tasks required to be abstracted and performed by the DAL on your behalf help developers to know how to effectively use a DAL, as well as increase their own knowledge in this area.</ul>
<p>And that is what this post is about – the creation of a simple DAL as a learning tool. I’ll talk about some of the work we’ve put into a DAL for a project I’ve worked on and some of the useful features that you may want consider to make your life a bit easier should you choose to write your own DAL.</p>
<p>I thought that giving some sample code of connecting to a SQL and Oracle database from the same client would serve as a nice reference point to start out discussion.</p>
<p>Here are the current hoops we have to jump through to read some simple data and get a DataTable back.</p>
<pre>string sqlConnectionString = &quot;Data Source=localhost;Initial Catalog=DALDatabase;Integrated Security=SSPI&quot;;
string oraConnectionString = &quot;Data Source=localhost;User Id=DALDatabase;Password=password;Integrated Security=no;&quot;;

string sqlCommandText =
    &quot;SELECT Department.Name &quot; +
    &quot;FROM Employee &quot; +
    &quot; INNER JOIN EmployeeToDepartment ON Employee.ID = EmployeeToDepartment.EmployeeID &quot; +
    &quot; INNER JOIN Department ON EmployeeToDepartment.DepartmentID = Department.ID &quot; +
    &quot;WHERE &quot; +
    &quot;Employee.LastName = @LastName&quot;;

string oraCommandText =
    &quot;SELECT * &quot; +
    &quot;FROM Employee &quot; +
    &quot; INNER JOIN EmployeeToDepartment ON Employee.ID = EmployeeToDepartment.EmployeeID &quot; +
    &quot; INNER JOIN Department ON EmployeeToDepartment.DepartmentID = Department.ID &quot; +
    &quot;WHERE &quot; +
    &quot;Employee.LastName = :LastName&quot;;

//SQL
DataSet ds = new DataSet();
SqlConnection sqlConn = new SqlConnection(sqlConnectionString);
SqlCommand sqlCmd = new SqlCommand(sqlCommandText, sqlConn);
SqlParameter param = new SqlParameter(&quot;LastName&quot;, SqlDbType.NVarChar, 32);
param.Value = &quot;Adams&quot;;
sqlCmd.Parameters.Add(param);
SqlDataAdapter sqlDA = new SqlDataAdapter(sqlCmd);
sqlDA.Fill(ds);
DataTable dt = ds.Tables[0];

//Oracle

...</pre>
<ul></ul>
<ul>One of the first steps to tackle is to design a way to abstractly create the different types of objects we will need such as a Connection, Command, etc.</ul>
<h6>So let’s get started…</h6>
<p>&#160;</p>
<p>For our purposes we will create a set of database specific providers to mange the creation of objects specific to that database. We will also abstract the creation of these database specific providers through the use a factory pattern to create the concrete implementations of our database specific providers.</p>
<h4>&#160;</h4>
<h4>Abstracting the Database Specific Providers</h4>
<p>We’ll start by defining an abstract class to represent the set of services that each database provider will need to implement</p>
<pre>internal abstract class BaseDBProvider
{
    // Connections
    internal abstract IDbConnection CreateConnection(
        string connectionString);

    // Commands
    internal abstract IDbCommand CreateCommand(IDbConnection conn);
    internal abstract IDbCommand CreateCommand(IDbConnection conn,
        string commandText);

    // Parameters
    internal abstract IDbDataParameter CreateParameter(
        string name, object value);
    internal abstract IDbDataParameter CreateParameter(
        string name, DALDbType dataType, object value);
    internal abstract IDbDataParameter CreateParameter
        (string name, DALDbType dataType, int size, object value);

    internal abstract IDbDataAdapter CreateDataAdapter();
    internal abstract IDbDataAdapter CreateDataAdapter(IDbCommand cmd);

    ...
}</pre>
<p>&#160;</p>
<p>Our base class is fairly simple at this point defining a way to create a connection which accepts a provider specific connection string to connect to the database with and returns a <strong><em><a href="http://msdn.microsoft.com/en-us/library/system.data.idbconnection.aspx" target="_blank">IDbConnection</a></em></strong> interface. The <strong><em><a href="http://msdn.microsoft.com/en-us/library/system.data.idbconnection.aspx" target="_blank">IDbConnection</a></em></strong> interface is defined within the ADO.NET framework and all ADO.NET based database connection objects must implement it.</p>
<p>By returning the interface we can separate the implementation details from the set of common services that each connection object provides.</p>
<p>Similarly, we have a set of methods that allow the construction of command objects, which accept an <strong><em><a href="http://msdn.microsoft.com/en-us/library/system.data.idbconnection.aspx" target="_blank">IDbConnection</a></em></strong> and optionally the SQL command text to execute. Both these methods return an <strong><em><a href="http://msdn.microsoft.com/en-us/library/system.data.idbcommand.aspx" target="_blank">IDbCommand</a></em></strong> interface, again defined by Microsoft, which all database specific ADO.NET commands must implement. This again separates the caller from the provider specific objects.</p>
<p>The next step is to provide concrete implementations of the <strong><em>BaseDBProvider</em></strong> class for each database platform we want to support. Below is an example for SQL Server.</p>
<pre>internal class SQLDbProvider : BaseDBProvider
{
    internal SQLDbProvider() { }

    internal override IDbConnection CreateConnection(string connectionString)
    {
        return new SqlConnection(connectionString);
    }

    internal override IDbCommand CreateCommand(IDbConnection conn,
        string commandText)
    {
        if (!(conn is SqlConnection))
            throw new ArgumentException(&quot;SqlConnection required&quot;, &quot;conn&quot;);

        IDbCommand cmd = conn.CreateCommand();
        cmd.CommandText = commandText;
        return cmd;
    }

    internal override IDbDataAdapter CreateDataAdapter(IDbCommand cmd)
    {
        return new SqlDataAdapter(cmd as SqlCommand);
    }

    internal override IDbDataParameter CreateParameter(string name, DALDbType dataType, int size, object value)
    {
        SqlParameter p = new SqlParameter(name, GetDataTypeFor(dataType), size);
        p.Value = value;
        return p;
    }

    ...

    private SqlDbType GetDataTypeFor(DALDbType dbType)
    {
        SqlDbType ret = SqlDbType.NVarChar;
        switch (dbType)
        {
            case DALDbType.DateTime:
                ret = SqlDbType.DateTime;
                break;
            case DALDbType.Int:
                ret = SqlDbType.Int;
                break;
            case DALDbType.NText:
                ret = SqlDbType.NText;
                break;
            case DALDbType.NVarChar:
                ret = SqlDbType.NVarChar;
                break;
            default:
                throw new NotSupportedException(&quot;Data type not supported&quot;<span style="color:#000000;">);</span>
        }
        return ret;
    }
}</pre>
<p>&#160;</p>
<p>One thing of interest to note is the way the <strong><em><a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.aspx" target="_blank">SqlCommand</a></em></strong> gets created. We use the <strong><em>CreateCommand()</em></strong> method of the <strong><em><a href="http://msdn.microsoft.com/en-us/library/system.data.idbcommand.aspx" target="_blank">IDbCommand</a></em></strong> interface which at this point is implemented on a <strong><em><a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.aspx" target="_blank">SqlConnection</a></em></strong>.</p>
<p>The same would be done for each database platform you intend to support.</p>
<pre>internal class OracleDbProvider : BaseDBProvider
{
    ...
}</pre>
<p>
  <br />We also defined a set of database neutral types that can be used across providers and mapped to whatever database specific types we desire. For instance we can have a DALDbType.Bit map to a SQL Server ‘Bit’ or ‘TinyInt’ or ‘Char’ if we wanted. This opens up additional flexibility in mapping logical types to the physical types for each database platform. </p>
<p></p>
<pre>public enum DALDbType
{
    DateTime,
    Int,
    NVarChar,
    NText,

    ...
}</pre>
<h4>&#160;</h4>
<h4>Implementing the Provider Factory</h4>
<p>At this point we have encapsulated all the database specific code in each provider class, but we haven’t solved how to not specifically instantiate these providers from our client code.</p>
<p>To do this we will use the concept of a class <a title="Class Factory Pattern" href="http://en.wikipedia.org/wiki/Factory_method_pattern" target="_blank">factory</a>. This is a pattern that allows a caller to create concrete implementations of objects by providing some identification of what type of object to create without the need for referencing the type directly.</p>
<p>Here’s the implementation of the class factory that will create and return concrete providers for our specified database.</p>
<pre>public enum SupportedDatabases { SQLServer, Oracle }

internal static class DbProviderFactory
{
    public static BaseDBProvider GetDbProvider(SupportedDatabases databaseType)
    {
        BaseDBProvider provider = null;
        switch (databaseType)
        {
            case SupportedDatabases.SQLServer:
                provider = new SQLDbProvider();
                break;

            case SupportedDatabases.Oracle:
                provider = new OracleDbProvider();
                break;

            default:
                break;
        }
        return provider;
    }
}</pre>
<p>&#160;</p>
<p>We define an enumeration that contains identifiers for the different databases we will support in our DAL and then through the use of the factory, we specify which type of database we would like a provider for and the factory creates the correct database specific provider for us.</p>
<p>The key to the decoupling process is that the factory returns the abstract <strong><em>BaseDBProvider</em></strong> class to the caller. This allows the caller to use the same object and methods regardless of the type of database being used.</p>
<h4>&#160;</h4>
<h4>Simplifying Usage</h4>
<p>One important goal for me when creating a DAL is to have it simplify the way I use and interact with the database. By creating a DAL on top of what ADO.NET provides we can start to simplify patterns of usage that normally occurs.</p>
<p>For instance, instead of setting up command parameters using the typical Create/Set/Add pattern:</p>
<pre>SqlCommand cmd = new SqlCommand(cmdText, conn);
SqlParameter param = new SqlParameter(&quot;LastName&quot;, SqlDbType.NVarChar, 32);
param.Value = &quot;Smith&quot;;
cmd.Parameters.Add(param);</pre>
<p>
  <br />We can simplify this into a single method, cleaning up the caller code as well as (in my opinion) making the code more readable. </p>
<p></p>
<pre>DALCommand cmd = new DALCommand(conn, cmdText);
cmd.AddParameter(&quot;LastName&quot;, DALDbType.NVarChar, 32, &quot;Smith&quot;);</pre>
<p>&#160;</p>
<p>Other simplifications that I would include in a DAL is the use of DataAdapters to retrieve DataTable and DataSet objects. Wouldn’t it be nice to have a command object that supports <strong><em>ExecuteDataTable()</em></strong> or <strong><em>ExecuteDataSet()</em></strong> methods?</p>
<p>Seems like I am very often working with DataTable’s, and using ADO.NET to retrieve these seems a bit more work than it should otherwise be. I would love to be able to just do something like this to simplify my client code:</p>
<pre>DataTable dt = cmd.ExecuteDataTable();</pre>
<h4>&#160;</h4>
<h4>Summary</h4>
<p>To recap what we accomplished:</p>
<ul>
<li>We now have a basic DAL framework to abstract the use of database specific objects to more abstract ones. No more dealing with XXXCommand or XXXXConnection <strong>per</strong> database platform. </li>
<li>We’ve also managed to abstract ourselves from database specific types as well as added the flexibility to represent data in any way we want on the database platform (Ex: Bit ==&gt; TinyInt, etc.) </li>
<li>We’ve simplified usage of the DAL so we can write less code and let it be more readable. </li>
</ul>
<h5>Additional Features</h5>
<p>While we haven’t yet completely abstracted ourselves from the differences in databases completely – most notably the connection string and SQL syntax (parameter syntax differences, etc) &#8211; at this point I will leave the implementation of these to the reader.</p>
<p>On projects I’ve worked on we have successfully abstracted away the connection strings as well as a lot of the SQL syntax of queries across the providers we are using.</p>
<p>If there’s any interest in these techniques, drop me some comments and perhaps I’ll do a follow-up post.</p>
<p>By the way, here’s the relevant portion of the client code from the beginning of the post with the DAL improvements we’ve implemented compared to the original:</p>
<p><strong>ADO.NET:</strong></p>
<pre>DataSet ds = new DataSet();
SqlCommand cmd = new SqlCommand(cmdText, conn);
SqlParameter param = new SqlParameter(&quot;LastName&quot;, SqlDbType.NVarChar, 32);
param.Value = &quot;Smith&quot;;
cmd.Parameters.Add(param);
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
DataTable dt = ds.Tables[0];</pre>
<p>
  <br /><strong>DAL:</strong> </p>
<p></p>
<pre>DALCommand cmd = new DALCommand(conn, cmdText);
cmd.AddParameter(&quot;LastName&quot;, DALDbType.NVarChar, 32, &quot;Smith&quot;);
DataTable dt = cmd.ExecuteDataTable();</pre>
<p>
  <br />Seems like a winner to me!</p>
<div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:a70f278a-de7b-4667-87fa-638c063c3615" style="display:inline;float:none;margin:0;padding:0;">Technorati Tags: <a href="http://technorati.com/tags/DAL" rel="tag">DAL</a>,<a href="http://technorati.com/tags/ADO.NET" rel="tag">ADO.NET</a>,<a href="http://technorati.com/tags/C%23" rel="tag">C#</a>,<a href="http://technorati.com/tags/SQL" rel="tag">SQL</a>,<a href="http://technorati.com/tags/Oracle" rel="tag">Oracle</a></div>
<div class="wlWriterHeaderFooter" style="text-align:right;margin:0;padding:4px 0;"><a href="http://digg.com/submit?url=http%3a%2f%2fstevencalise.wordpress.com%2f2009%2f10%2f16%2fconstructing-a-dal-in-c%2f&amp;title=Constructing+a+DAL+in+C%23"><img src="http://digg.com/img/badges/100x20-digg-button.png" width="100" height="20" alt="Digg This" title="Digg This" border="0" style="border:0;" /></a></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stevencalise.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stevencalise.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stevencalise.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stevencalise.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stevencalise.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stevencalise.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stevencalise.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stevencalise.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stevencalise.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stevencalise.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stevencalise.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stevencalise.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stevencalise.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stevencalise.wordpress.com/37/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stevencalise.wordpress.com&amp;blog=9324228&amp;post=37&amp;subd=stevencalise&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stevencalise.wordpress.com/2009/10/16/constructing-a-dal-in-c/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9619c570a5710c70dcf8aa8fb3ecc00e?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">stevencalise</media:title>
		</media:content>

		<media:content url="http://digg.com/img/badges/100x20-digg-button.png" medium="image">
			<media:title type="html">Digg This</media:title>
		</media:content>
	</item>
		<item>
		<title>WPF Dashboard and Custom Panels</title>
		<link>http://stevencalise.wordpress.com/2009/09/15/wpf-dashboard-and-custom-panels/</link>
		<comments>http://stevencalise.wordpress.com/2009/09/15/wpf-dashboard-and-custom-panels/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 01:25:55 +0000</pubDate>
		<dc:creator>stevencalise</dc:creator>
				<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://stevencalise.wordpress.com/2009/09/15/wpf-dashboard-and-custom-panels/</guid>
		<description><![CDATA[I’ve been toying around with creating a dashboard like display in WPF recently and figured there must be a million examples out there. Some interesting and/or noteworthy ideas I came across: Telerik’s WPF Dashboard Demo (http://demos.telerik.com/wpf/salesdashboard/) TechEd WPF Demo (http://blogs.msdn.com/text/archive/2006/06/14/631136.aspx) The Telerik display was nice, but I wanted something free at the moment as I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stevencalise.wordpress.com&amp;blog=9324228&amp;post=21&amp;subd=stevencalise&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I’ve been toying around with creating a dashboard like display in WPF recently and figured there must be a million examples out there.</p>
<p>Some interesting and/or noteworthy ideas I came across:</p>
<ul>
<li>Telerik’s WPF Dashboard Demo (<a title="http://demos.telerik.com/wpf/salesdashboard/" href="http://demos.telerik.com/wpf/salesdashboard/)">http://demos.telerik.com/wpf/salesdashboard/)</a></li>
<li>TechEd WPF Demo (<a href="http://blogs.msdn.com/text/archive/2006/06/14/631136.aspx">http://blogs.msdn.com/text/archive/2006/06/14/631136.aspx</a>)</li>
</ul>
<p>The Telerik display was nice, but I wanted something free at the moment as I was working on a prototype idea. The TechEd demo was pretty close to what I was looking fro but I wanted a bit more “dynamic” functionality.</p>
<p>Using the work from the aforementioned links as inspiration, I set out to fill the missing gaps and learn a bit more about WPF in the process. Below is a list of the basic features I was shooting for:</p>
<ul>
<li>Generic Management of “Dashboard Parts” that are defined, discovered and created dynamically</li>
<li>Support for single instance or multi-instanced parts</li>
<li>Drag and drop support of dashboard parts to the grid layout, as well as within the grid layout between “cells”</li>
<li>Automatic grid expansion when necessary</li>
<li>Ability to Maximize, Restore and Close parts</li>
</ul>
<ul>The basic idea was to start with the dashboard editing and setup feature, which is what you see below. So here’s what I came up with:</ul>
<p><a href="http://stevencalise.files.wordpress.com/2009/09/image.png"> <img style="display:inline;border-width:0;" title="image" src="http://stevencalise.files.wordpress.com/2009/09/image_thumb.png?w=598&#038;h=353" border="0" alt="image" width="598" height="353" /></a></p>
<p>To see the auto expansion of the grid and drag and drop functionality in action, here’s a video:</p>
<div id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:b2996147-eb5d-477d-bcc6-7564754297a7" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">
<div><span style="text-align:center; display: block;"><a href="http://stevencalise.wordpress.com/2009/09/15/wpf-dashboard-and-custom-panels/"><img src="http://img.youtube.com/vi/CVtXPWT2724/2.jpg" alt="" /></a></span></div>
</div>
<ul>With my specific needs in mind I set about my work. My first attempt to was to try and subclass the Grid in WPF, but I quickly ran into the problem of sub-classing a component with existing public properties – these properties were available to be called instead of my specific functionality. Instead I wanted to make the management of the grid more prominent and explicit.</ul>
<p>One option would have been to create a panel from the ground up that mimicked the behavior of a Grid only exposing the functionality I wanted. Instead I chose a simpler, albeit less elegant approach – the creation of a side component called <strong><em>GridManager</em></strong>.</p>
<p>The <strong><em>GridManager</em></strong> component takes care of all the “heavy” lifting &#8211; processing drag and drop messages, managing the grid layout and managing part lifetime and event handling.</p>
<h3>Dashboard Parts</h3>
<p> </p>
<h4>Part Interface</h4>
<p>The parts for the dashboard are designed to operate in a plug-in style, where each one can be contained in one or more assemblies external to the main project. Each part needs to implement the following interface to be able to be loaded and recognized by the dashboard application.</p>
<p><code></code></p>
<p>    public interface DashboardPart<br />
    {<br />
        event EventHandler PartControlReadyForDisplay;</p>
<p>        System.Windows.Controls.UserControl PartControl { get; }<br />
        string UniqueIdentifier { get; }               <br />
        MyDBConnection DbConnection { get; set; }</p>
<p>        void Initialize();<br />
        void Destroy();</p>
<p>        ObservableCollection&lt;PartProperty&gt; Properties { get; set; }<br />
    }</p>
<ol>
<li> 
<ol><span style="font-family:Verdana;"> </span></ol>
</li>
<p><span style="font-family:Verdana;">The <em>PartControlReadyForDisplay</em> event allows parts to signal when they are ready to be displayed in the dashboard. This allows for a part to take as much time as needed to get ready for displaying. In the meantime, a “Loading…” placeholder is used with the parts place.</span></p>
<p><span style="font-family:Verdana;">Each part is required to have a unique identification – <em>UniqueIdentifier</em>, and can support being passed a database connection (if a data bound part). Additionally, the <em>Properties</em> collection allows any custom defined properties to be integrated into the part editing and setup via the “Properties Grid”.</span></p>
<p><span style="font-family:Verdana;">The parts lifetime is managed by the application itself and the expected chain of calls to a part are:</span></p>
<li><span style="font-family:Verdana;">Dashboard app creates an instance of the DashboardPart interface implementation defined in the parts catalog</span></li>
<li><span style="font-family:Verdana;">Dashboard app sets the DBConnection property (if needed and in use)</span></li>
<li><span style="font-family:Verdana;">Dashboard app calls Initialize() on the part</span></li>
<li><span style="font-family:Verdana;">Part finishes initialization and raises the PartControlReadyForDisplay event</span></li>
<li><span style="font-family:Verdana;">Dashboard app retrieves the PartControl property to get the parts visual instance and adds it to the grid</span></li>
<li><span style="font-family:Verdana;">When the part is no longer needed, Dashboard app calls Destroy() on the part</span></li>
</ol>
<p> </p>
<h4>Part Definition</h4>
<p>Currently the definition of parts is accomplished via a “parts catalog”. I decided on this approach because I wanted the definition of parts to be flexible as well as explicit.</p>
<p>An alternative mechanism would be to scan a “plugins” directory and load the appropriate plug-in dynamically if the proper interface was present. This can be fairly easily implemented.</p>
<p>&lt;Parts&gt;<br />
  &lt;Part&gt;<br />
    &lt;Name&gt;Project Status&lt;/Name&gt;<br />
    &lt;Width&gt;100&lt;/Width&gt;<br />
    &lt;Height&gt;100&lt;/Height&gt;<br />
    &lt;Construction Assembly =&#8221;TestPart&#8221; Type=&#8221;TestPart.TestPart1&#8243;/&gt;   <br />
  &lt;/Part&gt;<br />
  &lt;Part&gt;<br />
    &lt;Name&gt;Procedure Progress&lt;/Name&gt;<br />
    &lt;Width&gt;100&lt;/Width&gt;<br />
    &lt;Height&gt;100&lt;/Height&gt;<br />
    &lt;Construction Assembly =&#8221;TestPart&#8221; Type=&#8221;TestPart.TestPart2&#8243;/&gt;<br />
    &lt;Properties&gt;<br />
      &lt;Property&gt;<br />
        &lt;Name&gt;Test Property&lt;/Name&gt;<br />
        &lt;Value&gt;This is my test property&lt;/Value&gt;<br />
      &lt;/Property&gt;<br />
    &lt;/Properties&gt;<br />
  &lt;/Part&gt;<br />
&lt;/Parts&gt;</p>
<h3>Conclusion</h3>
<p> </p>
<p>It’s amazing how easy and fast it can be to create visually pleasing and functional user interfaces in WPF with a minimum amount of effort. With a bit  more work, a dashboard of the caliber of the one shown in the Telerik demo application can be easily achieved.</p>
<p>There are a few more features left that I want to implement in the editing and setup portion of the dashboard, such as a more accurate visual of the parts when dragging / dropping and the ability to have a part span cells/rows. Both features should be pretty trivial to implement.</p>
<p><em><strong><span style="text-decoration:underline;">Note:</span></strong> Use of the Canvas was also tried although I deemed that it’s fairly static nature (fixed with and height) didn’t make it ideal for supporting an arbitrary number of parts.</em></p>
<p>As an aside, the styling was very easily accomplished with the WPF Themes <a href="http://www.codeplex.com/">CodePlex</a> project.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stevencalise.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stevencalise.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stevencalise.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stevencalise.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stevencalise.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stevencalise.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stevencalise.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stevencalise.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stevencalise.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stevencalise.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stevencalise.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stevencalise.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stevencalise.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stevencalise.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stevencalise.wordpress.com&amp;blog=9324228&amp;post=21&amp;subd=stevencalise&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stevencalise.wordpress.com/2009/09/15/wpf-dashboard-and-custom-panels/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9619c570a5710c70dcf8aa8fb3ecc00e?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">stevencalise</media:title>
		</media:content>

		<media:content url="http://stevencalise.files.wordpress.com/2009/09/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Data Visualization in WPF using Graph#</title>
		<link>http://stevencalise.wordpress.com/2009/09/10/data-visualization-in-wpf-using-graph/</link>
		<comments>http://stevencalise.wordpress.com/2009/09/10/data-visualization-in-wpf-using-graph/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 20:24:00 +0000</pubDate>
		<dc:creator>stevencalise</dc:creator>
				<category><![CDATA[Data Visualization]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Graph]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://stevencalise.wordpress.com/2009/09/10/data-visualization-in-wpf-using-graph/</guid>
		<description><![CDATA[I’m currently working on a prototype for my current project to visualize a set of data in a way that can give a user a quick overview of the relationships between objects within a “project”. In the product I work on there is a lot of inter-related data that users are exposed, but it is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stevencalise.wordpress.com&amp;blog=9324228&amp;post=11&amp;subd=stevencalise&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I’m currently working on a prototype for my current project to visualize a set of data in a way that can give a user a quick overview of the relationships between objects within a “project”.</p>
<div class="wlWriterSmartContent" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:5cadc9db-ef30-4bb2-91f2-804750345cf3" style="display:inline;float:none;margin:0;padding:0;">
<div><span style="text-align:center; display: block;"><a href="http://stevencalise.wordpress.com/2009/09/10/data-visualization-in-wpf-using-graph/"><img src="http://img.youtube.com/vi/agDPDzqB4o0/2.jpg" alt="" /></a></span></div>
</div>
<p>In the product I work on there is a lot of inter-related data that users are exposed, but it is still fairly difficult for users to get the “big picture” rather quickly. Instead they currently rely on a set of reports and data dumps to help them visualize the data.</p>
<p>I thought I would generalize this a bit (names removed to protect the innocent) and showcase a use of a great open source library – <a href="http://graphsharp.codeplex.com/">Graph#</a> &#8211; for visualizing data. Nothing fancy, but I believe showing the data in an additional view, will enable someone to better understand the relationships between the items at a glance.</p>
<p>First some background is in order. For the purposes of my project I have a pseudo-hierarchical set of items that can be linked to one another. So our model can have both hierarchical relationships as well as associative relationships.</p>
<p>&#160;</p>
<h2>Demo Background</h2>
<p>To make this a bit more concrete I will use an example right out of software development. We will have a software “project” we are working on with the following item types:</p>
<ul>
<li><strong><em><span style="text-decoration:underline;">Project</span></em></strong> – deliverable that “contains“ features. </li>
<li><em><strong><span style="text-decoration:underline;">Feature</span></strong></em> – a feature “contains” tasks. A feature may also have a document associated with it. </li>
<li><em><span style="text-decoration:underline;"><strong>Task</strong></span></em> – a task is the low level unit of work being done. A task may also have issues “associated” with it. </li>
<li><strong><em><span style="text-decoration:underline;">Issue</span></em> </strong>– a problem or defect found in a task. A single issue can pertain to multiple tasks. </li>
<li><em><span style="text-decoration:underline;"><strong>Document</strong></span></em> – a textual description of something. Can be associated to a task. </li>
</ul>
<ul></ul>
<h2>Design</h2>
<p>The design is fairly straight forward in that I’ve defined a few abstract classes that represent a “Model” and “ProjectItem”. Deriving from these I’ve created classes for each of the above item types we will support.</p>
<p>The <strong><em>GraphViewFactory</em></strong> component is the bridge between the”Model” implementation and the objects the graph needs. It will walk the model and flatten it, producing a set of vertices and links to add to the graph.</p>
<p>From there the graph control is used to layout and render the graph. The demo application has a few tweakable items available in the UI, such as the Layout algorithm. Additionally you can drill down into a node to get a rendering of that node, it’s sub-tree and it’s immediate parent (to go back up the tree).</p>
<p>Incidentally, the data is loaded from an XML file – <em>SampleData.xml</em>. This was my first attempt at using LINQ to XML.</p>
<p>&#160;</p>
<h2>The Finished Product</h2>
<p><strong><span style="font-size:medium;">&#160;</span></strong></p>
<p>While not awe inspiring perhaps, it does showcase the ease with which normal data can be visualized in a different way. The project I am working on actually has spiffy icons, tooltips and details panels for each item with the graph.</p>
<p>Some of the interesting ways we are considering using visualization</p>
<ul>
<li>Give users the ability to see “covered” items.
<ul>
<li>For instance, in our demo we could visualize the number of issues being generated and easily see which items were getting a lot of defects, or see which items do/don’t have enough “Documentation” </li>
</ul>
</li>
<li>The ability to see transitive links. Currently systems are fairly good at showing you a relationship between an item and other items in a many to many relationship. With visualization we can take them to the next level by seeing the connections of the connections of… </li>
</ul>
<p><span style="text-decoration:underline;">Screenshot #1</span></p>
<p><a href="http://stevencalise.files.wordpress.com/2009/09/screenshot_1.png"><img title="Screenshot_1" style="display:inline;border-width:0;" height="334" alt="Screenshot_1" src="http://stevencalise.files.wordpress.com/2009/09/screenshot_1_thumb.png?w=418&#038;h=334" width="418" border="0" /></a></p>
<p><span style="text-decoration:underline;">Screenshot #2</span></p>
<p><a href="http://stevencalise.files.wordpress.com/2009/09/screenshot_2.png"><img title="Screenshot_2" style="display:inline;border-width:0;" height="334" alt="Screenshot_2" src="http://stevencalise.files.wordpress.com/2009/09/screenshot_2_thumb.png?w=419&#038;h=334" width="419" border="0" /></a></p>
<p>Download the source for the demo <span style="text-decoration:underline;"><a title="here" href="https://frostupload.com/files/get/fV0m_Hq9kn/datavizdemo.zip">here</a></span></p>
<div class="wlWriterHeaderFooter" style="text-align:right;margin:0;padding:4px 0;"><a href="http://digg.com/submit?url=http%3a%2f%2fstevencalise.wordpress.com%2f2009%2f09%2f10%2fdata-visualization-in-wpf-using-graph%2f&amp;title=Data+Visualization+in+WPF+using+Graph%23"><img src="http://digg.com/img/badges/100x20-digg-button.png" width="100" height="20" alt="Digg This" title="Digg This" border="0" style="border:0;" /></a></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stevencalise.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stevencalise.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stevencalise.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stevencalise.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stevencalise.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stevencalise.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stevencalise.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stevencalise.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stevencalise.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stevencalise.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stevencalise.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stevencalise.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stevencalise.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stevencalise.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stevencalise.wordpress.com&amp;blog=9324228&amp;post=11&amp;subd=stevencalise&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stevencalise.wordpress.com/2009/09/10/data-visualization-in-wpf-using-graph/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9619c570a5710c70dcf8aa8fb3ecc00e?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">stevencalise</media:title>
		</media:content>

		<media:content url="http://stevencalise.files.wordpress.com/2009/09/screenshot_1_thumb.png" medium="image">
			<media:title type="html">Screenshot_1</media:title>
		</media:content>

		<media:content url="http://stevencalise.files.wordpress.com/2009/09/screenshot_2_thumb.png" medium="image">
			<media:title type="html">Screenshot_2</media:title>
		</media:content>

		<media:content url="http://digg.com/img/badges/100x20-digg-button.png" medium="image">
			<media:title type="html">Digg This</media:title>
		</media:content>
	</item>
	</channel>
</rss>
