<?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>Code Cramp: The joy and pain of coding</title>
	<atom:link href="http://codecramp.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://codecramp.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Mon, 26 Jan 2009 18:48:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='codecramp.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Code Cramp: The joy and pain of coding</title>
		<link>http://codecramp.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://codecramp.wordpress.com/osd.xml" title="Code Cramp: The joy and pain of coding" />
	<atom:link rel='hub' href='http://codecramp.wordpress.com/?pushpress=hub'/>
		<item>
		<title>We&#8217;ve Moved!</title>
		<link>http://codecramp.wordpress.com/2009/01/26/weve-moved/</link>
		<comments>http://codecramp.wordpress.com/2009/01/26/weve-moved/#comments</comments>
		<pubDate>Mon, 26 Jan 2009 18:48:43 +0000</pubDate>
		<dc:creator>codemonkey23</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://codecramp.wordpress.com/?p=12</guid>
		<description><![CDATA[Visit our new site CodeCramp.com<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codecramp.wordpress.com&amp;blog=6298940&amp;post=12&amp;subd=codecramp&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Visit our new site <a href="http://www.codecramp.com">CodeCramp.com</a> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codecramp.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codecramp.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codecramp.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codecramp.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codecramp.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codecramp.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codecramp.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codecramp.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codecramp.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codecramp.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codecramp.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codecramp.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codecramp.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codecramp.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codecramp.wordpress.com&amp;blog=6298940&amp;post=12&amp;subd=codecramp&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codecramp.wordpress.com/2009/01/26/weve-moved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3c156dbd33e1dd978fd683e38e2d86a1?s=96&#38;d=identicon" medium="image">
			<media:title type="html">codemonkey23</media:title>
		</media:content>
	</item>
		<item>
		<title>Layers: No Tiers Shed</title>
		<link>http://codecramp.wordpress.com/2009/01/24/layers-no-tiers-shed/</link>
		<comments>http://codecramp.wordpress.com/2009/01/24/layers-no-tiers-shed/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 07:14:44 +0000</pubDate>
		<dc:creator>codemonkey23</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://codecramp.wordpress.com/?p=9</guid>
		<description><![CDATA[Not all of us have the luxury of going beyond a 2-Tier system for web development (web server + database server). In this world, there can be a tendancy to forget best practices &#8211; so let me drop a little advice: Code like you&#8217;re going at least 3-Tier and respect the layers. I run across [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codecramp.wordpress.com&amp;blog=6298940&amp;post=9&amp;subd=codecramp&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Not all of us have the luxury of going beyond a 2-Tier system for web development (web server + database server). In this world, there can be a tendancy to forget best practices &#8211; so let me drop a little advice: Code like you&#8217;re going at least 3-Tier and respect the layers.</p>
<p>I run across this all the time. A junior developer will create a web page (.aspx) and just start coding in the code-behind page (.aspx.cs or .aspx.vb). It starts of all good and nice: they&#8217;re setting up the look and feel, turning on and off panels, handling callbacks and postbacks, etc. But then I run across some piece of code that is obviously business logic which makes a call to some code that is without a doubt for data access.</p>
<p>Now, you can go ahead an create some extra folders in your project and call them &#8220;DataAccessLayer&#8221; and &#8220;BusinessLogicLayer&#8221; (or whatever your orginazation wants to name them). You can hope that everything you are doing is respecting the boundaries&#8230; or you can step-it-up a level and actually create new projects.</p>
<p>So here are the 5 projects I always have for any solution: Web (UI), Services (WCF, SOAP, etc.), Business (Entities for some),  DataAccess (SQL) and Core (Internal, Shared).</p>
<p><strong>Web / UI</strong><br />
This is just for your web pages, flash files, javascript, images, etc. Anything that falls outside of the user experience shouldn&#8217;t be placed here. The best way to know is this: pretend that you are building 2 apps that have to do the same thing &#8211; one uses a website as a front-end and the other is a windows app making service calls.</p>
<p><strong>Services / WCF</strong><br />
A lot of people avoid creating this layer when they are starting off and they go straight for the web site. This is going to cause you way more headaches in the long run. When you come back to refactor, you may realize that you were passing dataviews or datasets across. I love datasets, but we live in a world where expectations are such that clients expect to do more with their server based apps. Of course, I work on enterprise applications, so my view may be skewed.  </p>
<p>Try to plumb (and test) your services layer so it can work across both HTTP(S) and named pipes or another local service. (Why take the overhead of HTTP if you don&#8217;t need it?) The service layer should have minimal logic in it, but should also try and handle enough items in a single call so that the traffic going back and forth is minimal.</p>
<p><strong>Business / Entities</strong><br />
Entities may be the wrong way to phrase it, but for some companies, that&#8217;s the right terminology. I work in a total TDD OOP shop, so this layer should be made up of mostly objects and factories. Remember that the Services, Business, and Data Access layers are all on the same Tier, so feel free to take advantage of Interfaces  (ISomeInterface) to leverage logic in your business layer when you might be in your data access layer (a common item might be IUser.GetGroups()). Also keep in mind that SQL Commands should not be executed on this layer. In fact, you could try and make it a goal that System.Data is not referenced at all by this layer.</p>
<p><strong>Data Access</strong><br />
Please, please, please do not return DataReaders, DataViews, DataSets, or SqlCommands from this layer. If you need help trying to understand the seperation you are trying to achieve, look into Inversion of Control (IoC) concepts and Mocking (with a framework like RhinoMocks during testing) so you can begin to get a feel of what you should try and return. Stick to Data Transfer Objects, Interfaces, and scalars (bool, string, int, etc) for your return types and you should be a lot better off when you decide to support SQL, MySql and Oracle all on the same code base.</p>
<p><strong>Core / Shared / Internal</strong><br />
I tend to split Internal from Shared. Shared is what ships with my API, while Internal sticks on the  server. IUser might make it into Shared, but the enumeration DatabaseType might stay in internal. I always err on the side of caution and stick everything in Internal and only transfer items over to Shared on an as-needed basis.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codecramp.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codecramp.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codecramp.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codecramp.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codecramp.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codecramp.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codecramp.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codecramp.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codecramp.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codecramp.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codecramp.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codecramp.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codecramp.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codecramp.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codecramp.wordpress.com&amp;blog=6298940&amp;post=9&amp;subd=codecramp&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codecramp.wordpress.com/2009/01/24/layers-no-tiers-shed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3c156dbd33e1dd978fd683e38e2d86a1?s=96&#38;d=identicon" medium="image">
			<media:title type="html">codemonkey23</media:title>
		</media:content>
	</item>
		<item>
		<title>&#8220;Success&#8221; is not a valid return</title>
		<link>http://codecramp.wordpress.com/2009/01/24/success-is-not-a-valid-return/</link>
		<comments>http://codecramp.wordpress.com/2009/01/24/success-is-not-a-valid-return/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 06:38:51 +0000</pubDate>
		<dc:creator>codemonkey23</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://codecramp.wordpress.com/2009/01/24/success-is-not-a-valid-return/</guid>
		<description><![CDATA[To anyone who thinks the following is a good idea- it&#8217;s not. public string DataAccessMethod() { //perform a database action return &#8220;Success&#8221;; } Just stick to a bool signature and we&#8217;ll all love you just a little bit more.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codecramp.wordpress.com&amp;blog=6298940&amp;post=8&amp;subd=codecramp&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>To anyone who thinks the following is a good idea- it&#8217;s not.</p>
<p>public string DataAccessMethod()<br />
{<br />
    //perform a database action<br />
    return &#8220;Success&#8221;;<br />
}</p>
<p>Just stick to a bool signature and we&#8217;ll all love you just a little bit more.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codecramp.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codecramp.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codecramp.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codecramp.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codecramp.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codecramp.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codecramp.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codecramp.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codecramp.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codecramp.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codecramp.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codecramp.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codecramp.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codecramp.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codecramp.wordpress.com&amp;blog=6298940&amp;post=8&amp;subd=codecramp&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codecramp.wordpress.com/2009/01/24/success-is-not-a-valid-return/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3c156dbd33e1dd978fd683e38e2d86a1?s=96&#38;d=identicon" medium="image">
			<media:title type="html">codemonkey23</media:title>
		</media:content>
	</item>
		<item>
		<title>Enumerations: They&#8217;re for the future you (and me)</title>
		<link>http://codecramp.wordpress.com/2009/01/24/enumerations-theyre-for-the-future-you-and-me/</link>
		<comments>http://codecramp.wordpress.com/2009/01/24/enumerations-theyre-for-the-future-you-and-me/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 06:33:30 +0000</pubDate>
		<dc:creator>codemonkey23</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://codecramp.wordpress.com/?p=3</guid>
		<description><![CDATA[Enumerations aren&#8217;t optional.  I can&#8217;t think of any other way to put it, so there you have it. After spending several days refactoring a large code base, I can tell you this: Enumerations are your friend. We have some devs on our team who, in the past,  were guilty of propagating the mistake of using [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codecramp.wordpress.com&amp;blog=6298940&amp;post=3&amp;subd=codecramp&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Enumerations aren&#8217;t optional.</p>
<p> I can&#8217;t think of any other way to put it, so there you have it. After spending several days refactoring a large code base, I can tell you this: Enumerations are your friend. We have some devs on our team who, in the past,  were guilty of propagating the mistake of using integers and strings where enumerations belong. </p>
<p>Example:</p>
<p style="padding-left:30px;">public bool CreateUser(Guid userId, string userType, int authenticationType)<br />
{<br />
     if (userType.ToLower() == &#8220;admin&#8221;) {&#8230;}</p>
<p>     if (authenticationType == 3) {&#8230;}</p>
<p style="padding-left:30px;">}</p>
<p>I don&#8217;t know about you, but in about 1 week, I would have to poke around for what &#8220;3&#8243; represents and in about a year, I&#8217;ll have to do some serious digging. Just do all of us (yourself included) a favor and just take the 2 minutes to declare an enumeration and use it. </p>
<p>You&#8217;ll also thank yourself in the future when you go back to refactor code and you drop out a value from the enumeration and it breaks your code. It&#8217;s going to be a lot easier to let VisualStudio tell you what you need to fix, instead of depending on searches for the code.  </p>
<p>Don&#8217;t forget, you will also save a lot of headaches when it comes to creating overloaded methods. A signature like Method1(string, int) won&#8217;t give you as much wiggle room as Method1(string, EnumType1)  and Method1(string, EnumType2).</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codecramp.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codecramp.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codecramp.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codecramp.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codecramp.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codecramp.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codecramp.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codecramp.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codecramp.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codecramp.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codecramp.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codecramp.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codecramp.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codecramp.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codecramp.wordpress.com&amp;blog=6298940&amp;post=3&amp;subd=codecramp&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codecramp.wordpress.com/2009/01/24/enumerations-theyre-for-the-future-you-and-me/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3c156dbd33e1dd978fd683e38e2d86a1?s=96&#38;d=identicon" medium="image">
			<media:title type="html">codemonkey23</media:title>
		</media:content>
	</item>
	</channel>
</rss>
