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

<channel>
	<title>Devirtuoso &#187; Development Best Practices</title>
	<atom:link href="http://www.devirtuoso.com/category/development-best-practices/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.devirtuoso.com</link>
	<description>Web Development Wickedness</description>
	<lastBuildDate>Sat, 20 Mar 2010 16:35:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Tips to Build a Better Newsletter</title>
		<link>http://www.devirtuoso.com/2009/09/tips-to-build-a-better-newsletter/</link>
		<comments>http://www.devirtuoso.com/2009/09/tips-to-build-a-better-newsletter/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 01:57:44 +0000</pubDate>
		<dc:creator>Shawn</dc:creator>
				<category><![CDATA[Development Best Practices]]></category>
		<category><![CDATA[Front End Development]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[newsletter]]></category>

		<guid isPermaLink="false">http://www.devirtuoso.com/?p=1104</guid>
		<description><![CDATA[Newsletters unfortunately are a necessary evil.&#160; Developers hate them and marketers love them.&#160; Here is a couple tips to help you through your next newsletter.
 
&#160;
Newsletter Width
Probably the most common question regarding newsletter is what dimensions should they be.&#160; The problem is each mail client is completely different.&#160; Some are tall and skinny, others short [...]]]></description>
			<content:encoded><![CDATA[<p>Newsletters unfortunately are a necessary evil.&#160; Developers hate them and marketers love them.&#160; Here is a couple tips to help you through your next newsletter.</p>
<p> <span id="more-1104"></span>
<p>&#160;</p>
<h2>Newsletter Width</h2>
<p>Probably the most common question regarding newsletter is what dimensions should they be.&#160; The problem is each mail client is completely different.&#160; Some are tall and skinny, others short and fat.&#160; It’s kind of like the left over bin at a bargain basement sale, you don’t know what you’re going to get.&#160; According to <a title="Campaign Monitor" href="http://www.campaignmontior.com" target="_blank">campaignmontior.com</a>, they suggest not to go any wider than 550-600 pixels.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="newsletter width" border="0" alt="newsletter width" src="http://www.devirtuoso.com/wp-content/uploads/2009/09/image25.png" width="445" height="199" /> </p>
<p>&#160;</p>
<h2>Tables for Structure</h2>
<p>You’ve spent all this time using divs and CSS in your websites to layout everything.&#160; Well with email you can forget all that. Back to the 1990’s we go.&#160; Best practice for laying out columns or any other structural areas is to use the good ol’ table.&#160; A lot mail clients don’t support the CSS that make using divs a viable solutions.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="table structure" border="0" alt="table structure" src="http://www.devirtuoso.com/wp-content/uploads/2009/09/image26.png" width="445" height="445" /> </p>
<p>&#160;</p>
<h2>Inline Styles</h2>
<p>It’s generally good practice to keep all your styles inline.&#160; Some mail clients take pleasure in adding their own CSS to the equation which throws yours out the window. Inline styles insure the mail client uses your styles and not theirs.&#160; If you do wish to put your styles at the top of your document, just be sure to do it within the body tag.&#160; I know what your thinking…but that won’t validate?&#160; You’re absolute right, but some mail clients totally discard the head tag, so anything in there will be thrown out like 2 month old milk.</p>
<p><a href="http://www.devirtuoso.com/wp-content/uploads/2009/09/image27.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="inline styles" border="0" alt="inline styles" src="http://www.devirtuoso.com/wp-content/uploads/2009/09/image_thumb.png" width="445" height="163" /></a> </p>
<p>&#160;</p>
<h2>Padding or Width, Not Both</h2>
<p>In CSS it’s generally good practice to keep padding and width separate.&#160; The same goes for emails.&#160; Width and padding don’t get along. Think of them like the contenders in the next UFC fight night.&#160; Since the mail clients are still stuck in prehistoric web days, padding can sometimes add to the width, even if the width is specified.&#160; If you need to have both then you’ll have to put a table within a table.&#160; The outside table cell specifying the width, and the inside one specifying the padding.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="padding or width, not both" border="0" alt="padding or width, not both" src="http://www.devirtuoso.com/wp-content/uploads/2009/09/image28.png" width="445" height="445" /> </p>
<p>&#160;</p>
<h2>Backgrounds</h2>
<p>Unfortunately Outlook 2007 screwed this up for everyone.&#160; It doesn’t support background images.&#160; So consider this when designing your next newsletter.&#160; Also the body tag gets stripped of any styles, so if you put a background color on it, it won’t show up in some mail clients.&#160; You’re best bet is to wrap you’re entire newsletter in a table, and apply the background color to the cell.&#160; It’s also good practice to use the old bgcolor attribute in place of the CSS.&#160; It ensures that all mail clients will display your background color.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="backgrounds" border="0" alt="backgrounds" src="http://www.devirtuoso.com/wp-content/uploads/2009/09/image29.png" width="445" height="280" /> </p>
<p>&#160;</p>
<h2>JavaScript / Flash</h2>
<p>Plain and simple, JavaScript and Flash aren’t supported, some cases they are, but most aren’t..&#160; They’re like the embarrassing friend of yours that nobody wants to hang out with.&#160; Sorry.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="don&#39;t use flash or javascript" border="0" alt="don&#39;t use flash or javascript" src="http://www.devirtuoso.com/wp-content/uploads/2009/09/image30.png" width="445" height="263" /> </p>
<p>&#160;</p>
<h2>Images</h2>
<p>Consider it good practice to always specify the width, height, and alt tags of all your images.&#160; A lot of email clients have images shut off automatically.&#160; With the width and height specified it will keep the structure of your layout, and the alt tag will give a description of the image.&#160; </p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="width height alt tags" border="0" alt="width height alt tags" src="http://www.devirtuoso.com/wp-content/uploads/2009/09/image31.png" width="445" height="117" /> </p>
<p>One extra little tip for images, sometimes you’ll notice an extra space underneath your images that you can’t get rid of.&#160; This can be a couple of things.</p>
<ol>
<li>You set your doctype of your document.&#160; Get rid of the doctype, or set it to HTML 4 transitional to fix this problem. </li>
<li>An old HTML bug where the image should be right up against the closing &lt;/td&gt; or else it throws in an extra space. </li>
</ol>
<h2>Conclusion</h2>
<p>In general try and think like you’re back in the old days of internet.&#160; For those younger people out there that haven’t developed in the olden days, now you see what we had to put up with, nothing works the way it should…wow I sound like my father. <img src='http://www.devirtuoso.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.devirtuoso.com/2009/09/tips-to-build-a-better-newsletter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speeding Up Page Loading for JavaScript Heavy Sites</title>
		<link>http://www.devirtuoso.com/2009/08/speeding-up-page-loading-for-javascript-heavy-sites/</link>
		<comments>http://www.devirtuoso.com/2009/08/speeding-up-page-loading-for-javascript-heavy-sites/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 18:37:51 +0000</pubDate>
		<dc:creator>Shawn</dc:creator>
				<category><![CDATA[Development Best Practices]]></category>
		<category><![CDATA[Front End Development]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[speed]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.devirtuoso.com/?p=972</guid>
		<description><![CDATA[JavaScript libraries help enhance our websites.&#160; Unfortunately they also slow down the page loading process. Here is a little tip to help speed up your page loads, while keeping those fantastic libraries you love so much.

Positioning
 
The problem with loading JavaScript files is when they’re being downloaded the browser doesn&#8217;t download anything else.&#160; So JavaScript [...]]]></description>
			<content:encoded><![CDATA[<p>JavaScript libraries help enhance our websites.&#160; Unfortunately they also slow down the page loading process. Here is a little tip to help speed up your page loads, while keeping those fantastic libraries you love so much.</p>
<p><span id="more-972"></span></p>
<h2>Positioning</h2>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="images can&#39;t load until javascript is done" border="0" alt="images can&#39;t load until javascript is done" src="http://www.devirtuoso.com/wp-content/uploads/2009/08/image35.png" width="420" height="217" /> </p>
<p>The problem with loading JavaScript files is when they’re being downloaded the browser doesn&#8217;t download anything else.&#160; So JavaScript affectively blocks your browsers from downloading other assets like CSS, or images. Giving the illusion that your page takes longer to load simply because the users notice the CSS and images not being loaded.&#160; A simple trick is to place all of your JavaScript just before the end body tag.&#160; This way it insures everything else has already started loading before it hits your JavaScript.&#160; Really you’re not speeding up anything, just re-arranging how things load.</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="load javascript later" border="0" alt="load javascript later" src="http://www.devirtuoso.com/wp-content/uploads/2009/08/image36.png" width="420" height="215" /> </p>
<p>&#160;</p>
<h2>Load it When You Need it</h2>
<p>JavaScript should only be used as an enhancement. Your website should work perfectly fine when JavaScript is shut off.&#160; If it doesn’t you should consider looking into <a title="Progressive Enhancement" href="http://www.devirtuoso.com/2009/05/front-end-development-the-easier-way/" target="_blank">Progressive Enhancement</a>. It’s a method that make sure your HTML is laid out first, then you add the bells and whistles.&#160; That aside, because JavaScript shouldn’t be completely necessary, you should be able to load the script as you need them…not on page load.&#160; This will speed up your initial page load, and get people into your site quicker.&#160; </p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="loading javascript as needed" border="0" alt="loading javascript as needed" src="http://www.devirtuoso.com/wp-content/uploads/2009/08/image37.png" width="420" height="207" /></p>
<p>So how do you do this you ask?&#160; With JavaScript of course.&#160; Here is some code:</p>
<div class="codecolorer-container javascript " style="overflow:auto;white-space:nowrap;width:580px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="javascript codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="kw2">function</span> importFile<span class="br0">&#40;</span>src<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw2">var</span> scriptElement <span class="sy0">=</span> document.<span class="me1">createElement</span><span class="br0">&#40;</span><span class="st0">'script'</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; scriptElement.<span class="me1">setAttribute</span><span class="br0">&#40;</span><span class="st0">'src'</span><span class="sy0">,</span>src<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; scriptElement.<span class="me1">setAttribute</span><span class="br0">&#40;</span><span class="st0">'type'</span><span class="sy0">,</span><span class="st0">'text/javascript'</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; document.<span class="me1">getElementsByTagName</span><span class="br0">&#40;</span><span class="st0">'head'</span><span class="br0">&#41;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span>.<span class="me1">appendChild</span><span class="br0">&#40;</span>scriptElement<span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div></td></tr></tbody></table></div>
<p>&#160;</p>
<p>The function importFile() will add an element to the head of your document, just like you would normally.</p>
<p>To use these function you might do something like this:</p>
<div class="codecolorer-container javascript " style="overflow:auto;white-space:nowrap;width:580px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="javascript codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="kw1">if</span> <span class="br0">&#40;</span>FunctionInFile<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="co1">// javascript is loaded</span><br />
<span class="br0">&#125;</span><br />
<span class="kw1">else</span><span class="br0">&#123;</span> <span class="co1">// not loaded yet</span><br />
&nbsp; &nbsp; importFile<span class="br0">&#40;</span><span class="st0">'javascriptFile.js'</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div></td></tr></tbody></table></div>
<p>&#160;</p>
<p>It checks to see if a function you have in your JavaScript file exists, if it doesn’t then load the JavaScript file.</p>
<p>&#160;</p>
<h2>Delaying</h2>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="delay loading javascript" border="0" alt="delay loading javascript" src="http://www.devirtuoso.com/wp-content/uploads/2009/08/image38.png" width="420" height="225" /> </p>
<p>The problem with loading your JavaScript on demand is there can be a pause while the script loads.&#160; To prevent this we can just put a delay on loading the JavaScript.&#160; This way it won’t load on page load, and it will be ready for whenever you need it.&#160; This might look something like this:</p>
<div class="codecolorer-container javascript " style="overflow:auto;white-space:nowrap;width:580px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br /></div></td><td><div class="javascript codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co1">//Called on page load</span><br />
setTimeout<span class="br0">&#40;</span><span class="st0">&quot;loadFiles();&quot;</span><span class="sy0">,</span> <span class="nu0">5000</span><span class="br0">&#41;</span><span class="sy0">;</span></div></td></tr></tbody></table></div>
<p>&#160;</p>
<h2>Other Methods</h2>
<p>Besides that you should consider combining all your JavaScript into one file, this way there are less requests for your browser to make. </p>
<p> Also consider caching you’re JavaScript files.&#160; If the browser already has the file on hand it won’t download it, saving precious load time.</p>
<p> Lastly consider compressing your files, the smaller the files, the less the user has to download.</p>
<p>&#160;</p>
<h2>Conclusion</h2>
<p>Hopefully these methods will help speed up your load times a bit.&#160; You’re users will thank you for it…or rather they won’t complain as much…which is sort of like a thank you <img src='http://www.devirtuoso.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>&#160;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devirtuoso.com/2009/08/speeding-up-page-loading-for-javascript-heavy-sites/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Is Your PHP Code Secure?</title>
		<link>http://www.devirtuoso.com/2009/08/is-your-php-code-secure/</link>
		<comments>http://www.devirtuoso.com/2009/08/is-your-php-code-secure/#comments</comments>
		<pubDate>Sun, 16 Aug 2009 19:02:58 +0000</pubDate>
		<dc:creator>Shawn</dc:creator>
				<category><![CDATA[Back End]]></category>
		<category><![CDATA[Development Best Practices]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.devirtuoso.com/?p=898</guid>
		<description><![CDATA[There are quite a few malicious users out there.&#160; If you haven’t considered your backend security, your website could be in a world of trouble from attacks.&#160; This is a beginners guide to what the bare minimums are when it comes to security.

Trust No One
 
The biggest issue in terms of security is trusting your [...]]]></description>
			<content:encoded><![CDATA[<p>There are quite a few malicious users out there.&#160; If you haven’t considered your backend security, your website could be in a world of trouble from attacks.&#160; This is a beginners guide to what the bare minimums are when it comes to security.</p>
<p><span id="more-898"></span></p>
<h2>Trust No One</h2>
<p><img style="border-bottom: 0px; border-left: 0px; margin: 15px 25px 0px 0px; display: inline; border-top: 0px; border-right: 0px" title="trust no one" border="0" alt="trust no one" align="left" src="http://www.devirtuoso.com/wp-content/uploads/2009/08/image21.png" width="205" height="267" /> </p>
<p>The biggest issue in terms of security is trusting your users.&#160; If you have a form and you automatically assume that the user is going to put their name in the name field, you’re less likely to write code that will validate what users are typing in.&#160; From a security perspective you have to think of your users as the shifty looking guy on the corner.&#160; Don’t trust them. Consider all input data tainted like the moldy piece of cheese in the back of your fridge.&#160; In PHP, a general rule of thumb is that all data in PHP’s superglobals ($_POST, $_GET..etc) should be considered tainted.&#160; Even the $_SERVER array is not fully safe because it contains some data provided by the client.&#160; The only exception to this rule is the $_SESSION array, which is kept on the server and never over the internet.&#160;</p>
<p>&#160;</p>
<h2>Are You Filtering?</h2>
<p><img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 0px 40px; display: inline; border-top: 0px; border-right: 0px" title="filtering" border="0" alt="filtering" align="right" src="http://www.devirtuoso.com/wp-content/uploads/2009/08/image22.png" width="160" height="160" /></p>
<p>Filtering is simply the process of making sure that only good input data is processed.&#160; There are two common ways of handing this, Black listing and White listing.</p>
<p>&#160;</p>
<p>&#160;</p>
<h4>Black Listing</h4>
<p>Black listing is the less restrictive form of the two.&#160; It assumes that the programmer knows everything that isn’t allowed to pass through.&#160; An example of this might be to check for profanity.&#160; The programmer would create a list of swear words, and for every input the code would cross reference this list to see if it matches the list.&#160; If it does, then the program handles it accordingly.</p>
<p>Example:</p>
<div class="codecolorer-container php " style="overflow:auto;white-space:nowrap;width:580px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br /></div></td><td><div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="kw2">&lt;?php</span><br />
<br />
<span class="co1">//List of bad words.</span><br />
<span class="re0">$blacklist</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="st0">&quot;bad&quot;</span><span class="sy0">,</span><span class="st0">&quot;word&quot;</span><span class="sy0">,</span><span class="st0">&quot;bleck&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<br />
<span class="co1">//Good input, no words are in blacklist.</span><br />
<span class="re0">$goodInput</span> <span class="sy0">=</span> <span class="st0">&quot;This is good input&quot;</span><span class="sy0">;</span><br />
<br />
<span class="co1">//Has words in blacklist.</span><br />
<span class="re0">$badInput</span> <span class="sy0">=</span> <span class="st0">&quot;This input is bad ... bleck&quot;</span><span class="sy0">;</span><br />
<br />
<span class="kw2">function</span> inputClean <span class="br0">&#40;</span><span class="re0">$input</span><span class="sy0">,</span> <span class="re0">$blacklist</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
<br />
&nbsp; &nbsp; <span class="kw1">foreach</span> <span class="br0">&#40;</span><span class="re0">$blacklist</span> <span class="kw1">as</span> <span class="re0">$word</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$pattern</span> <span class="sy0">=</span> <span class="st_h">'/'</span><span class="sy0">.</span><span class="re0">$word</span><span class="sy0">.</span><span class="st_h">'/'</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/preg_match"><span class="kw3">preg_match</span></a><span class="br0">&#40;</span><span class="re0">$pattern</span><span class="sy0">,</span> <span class="re0">$input</span><span class="sy0">,</span> <span class="re0">$matches</span><span class="sy0">,</span> PREG_OFFSET_CAPTURE<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><a href="http://www.php.net/count"><span class="kw3">count</span></a><span class="br0">&#40;</span><span class="re0">$matches</span><span class="br0">&#41;</span> <span class="sy0">&gt;</span> <span class="nu0">0</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&quot;You kiss your mother with that mouth?&quot;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="kw2">false</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="kw1">else</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&quot;All Clean&quot;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="kw2">true</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <br />
<span class="br0">&#125;</span><br />
<br />
<span class="co1">//Outputs &quot;All Clean&quot;</span><br />
inputClean<span class="br0">&#40;</span><span class="re0">$goodInput</span><span class="sy0">,</span> <span class="re0">$blacklist</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<br />
<span class="co1">//Outputs &quot;You kiss your mother with that mouth?&quot;</span><br />
inputClean<span class="br0">&#40;</span><span class="re0">$badInput</span><span class="sy0">,</span> <span class="re0">$blacklist</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<br />
<span class="sy1">?&gt;</span></div></td></tr></tbody></table></div>
<p>&#160;</p>
<h4>White Listing</h4>
<p>White listing is probably the more common method for security.&#160; It automatically assumes that all data is bad.&#160; Instead of identifying which information isn’t acceptable, you select which information IS acceptable. Kind of like going through a bag of jelly beans and only eating the red ones….mmmm.&#160; Since you control the data that comes in, attackers malicious code won’t be accepted if it doesn’t match the criteria. For this reason white listing is a much stronger protection against attacks then black listing.</p>
<p>Example:</p>
<div class="codecolorer-container php " style="overflow:auto;white-space:nowrap;width:580px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br /></div></td><td><div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="kw2">&lt;?php</span><br />
<br />
<span class="re0">$clean</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<br />
<span class="co1">//Only adds username to clean array if it uses only letters.</span><br />
<span class="kw1">if</span> <span class="br0">&#40;</span><a href="http://www.php.net/ctype_alpha"><span class="kw3">ctype_alpha</span></a><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'username'</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="re0">$clean</span><span class="br0">&#91;</span><span class="st_h">'username'</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'username'</span><span class="br0">&#93;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span><br />
<br />
<span class="co1">//only adds password if it uses letters and numbers.</span><br />
<span class="kw1">if</span> <span class="br0">&#40;</span><a href="http://www.php.net/ctype_alnum"><span class="kw3">ctype_alnum</span></a><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'password'</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="re0">$clean</span><span class="br0">&#91;</span><span class="st_h">'password'</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'password'</span><span class="br0">&#93;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span><br />
<br />
<span class="co1">//output</span><br />
<a href="http://www.php.net/print_r"><span class="kw3">print_r</span></a><span class="br0">&#40;</span><span class="re0">$clean</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<br />
<span class="sy1">?&gt;</span></div></td></tr></tbody></table></div>
<p>&#160;</p>
<h2>Do You Escape Your Output?</h2>
<p><img style="border-bottom: 0px; border-left: 0px; margin: 0px 25px 5px 0px; display: inline; border-top: 0px; border-right: 0px" title="escaping output" border="0" alt="escaping output" align="left" src="http://www.devirtuoso.com/wp-content/uploads/2009/08/image23.png" width="266" height="184" /> </p>
<p>Output is any information leaving your application.&#160; This can mean text going to a web browser, or to your database. Escaping the output ensures that there are no harmful commands within the output.&#160; So for example, in a blog you might have a comments section where users can input any info the might like.&#160; What if that info is JavaScript?&#160; When you output the comments and they’re not escaped, the JavaScript will display too.&#160; This can mean stealing of your users cookies, passwords, etc. Escaping is super important for protecting the recipient of your output, whether it is your database or your users.&#160; Fortunately PHP makes escaping very simple.&#160; If you’re escaping content for the web browser you can use the method htmlentities().&#160; This basically turns any special characters into a non harmful version. So the browser will display &lt;script&gt; instead of acting upon it.</p>
<p>Here is an example:</p>
<div class="codecolorer-container php " style="overflow:auto;white-space:nowrap;width:580px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="kw2">&lt;?php</span><br />
<br />
<span class="re0">$badOutput</span> <span class="sy0">=</span> <span class="st0">&quot;&lt;script type='text/javascript'&gt;alert('Malicious')&lt;/script&gt;'&quot;</span><span class="sy0">;</span><br />
<br />
<span class="co1">//Display javascript alert box.</span><br />
<a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="re0">$badOutput</span><span class="sy0">;</span><br />
<br />
<span class="co1">//Displays &quot;&lt;script type='text/javascript'&gt;alert('Malicious')&lt;/script&gt;'&quot;</span><br />
<a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <a href="http://www.php.net/htmlentities"><span class="kw3">htmlentities</span></a><span class="br0">&#40;</span><span class="re0">$badOutput</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<br />
<span class="sy1">?&gt;</span></div></td></tr></tbody></table></div>
<p>&#160;</p>
<p>For databases you’ll have to use a different method. For mysql you can use mysql_escape_string(), and if you have it installed mysql_real_escape_string(). The later offers a more extensive job then the first method.&#160; Also if you’re using PHP 5 you can use prepared statements.&#160; Prepared statements are SQL statements that have place holders. (SELECT * FROM table WHERE `username` = :placeholder)&#160; The place holder is then populated afterwards.&#160; How can this help you?&#160; To use these place holders you have to use the PHP Data Object (PDO).&#160; Fortunately PDO does all the hard work of escaping your output for you…isn’t that nice of them.</p>
<p>Here is an example of PDO in action:</p>
<div class="codecolorer-container php " style="overflow:auto;white-space:nowrap;width:580px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br /></div></td><td><div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="kw2">&lt;?php</span><br />
<br />
<span class="re0">$clean</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<br />
<span class="co1">//Filter input</span><br />
<span class="kw1">if</span> <span class="br0">&#40;</span><a href="http://www.php.net/ctype_alpha"><span class="kw3">ctype_alpha</span></a><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'username'</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="re0">$clean</span><span class="br0">&#91;</span><span class="st_h">'username'</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'username'</span><span class="br0">&#93;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span><br />
<br />
<span class="co1">//Set the placeholder in the sql</span><br />
<span class="re0">$sql</span> <span class="sy0">=</span> <span class="st_h">'SELECT * FROM users WHERE username = :username'</span><span class="sy0">;</span><br />
<br />
<span class="co1">//assume we setup the database handler already setup.</span><br />
<span class="co1">//prepare the statement</span><br />
<span class="re0">$statement</span> <span class="sy0">=</span> <span class="re0">$databaseHandler</span><span class="sy0">-&gt;</span><span class="me1">prepare</span><span class="br0">&#40;</span><span class="re0">$sql</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<br />
<span class="co1">//Give the place holder a value.</span><br />
<span class="co1">//PDO object escapes this value</span><br />
<span class="re0">$statement</span><span class="sy0">-&gt;</span><span class="me1">bindParam</span><span class="br0">&#40;</span><span class="st_h">':username'</span><span class="sy0">,</span> <span class="re0">$clean</span><span class="br0">&#91;</span><span class="st_h">'username'</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<br />
<span class="co1">//execute and fetch results.</span><br />
<span class="re0">$statement</span><span class="sy0">-&gt;</span><span class="me1">execute</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="re0">$results</span> <span class="sy0">=</span> <span class="re0">$statement</span><span class="sy0">-&gt;</span><span class="me1">fetchAll</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<br />
<span class="sy1">?&gt;</span></div></td></tr></tbody></table></div>
<p>&#160;</p>
<h2>Conclusion</h2>
<p>If you took anything away from the post I hope it is to filter inputs and escape outputs.&#160; There is quite a few other things that can be done to help with security. What we discussed here should be at least the bear minimum that you use on a regular basis.</p>
<p>&#160;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devirtuoso.com/2009/08/is-your-php-code-secure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Create a Useful 404 Page</title>
		<link>http://www.devirtuoso.com/2009/06/how-to-create-a-useful-404-page/</link>
		<comments>http://www.devirtuoso.com/2009/06/how-to-create-a-useful-404-page/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 00:06:59 +0000</pubDate>
		<dc:creator>Shawn</dc:creator>
				<category><![CDATA[Development Best Practices]]></category>
		<category><![CDATA[Front End Development]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[design principles]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.devirtuoso.com/?p=584</guid>
		<description><![CDATA[404 pages are going to happen whether you like it or not. This article will show how to create a 404 page that is useful for users.

Why Customize your 404 Page?
All browsers give some sort of page letting you know that the page wasn&#8217;t found. Why would you create your own of the browser handles [...]]]></description>
			<content:encoded><![CDATA[<p><strong>404 pages</strong> are going to happen whether you like it or not. This article will show how to create a <strong>404 page</strong> that is useful for users.</p>
<p><span id="more-584"></span></p>
<h3>Why Customize your 404 Page?</h3>
<p>All browsers give some sort of page letting you know that the page wasn&#8217;t found. Why would you create your own of the browser handles this for you?  Simply because browser error pages aren&#8217;t user friendly and are often confusing for non-computer savvy users.  Ideally you would want to create a page that is helpful to the user.  Some how they navigated to a page that doesn&#8217;t exist, so help them get back on track.</p>
<p><img src="http://www.devirtuoso.com/wp-content/uploads/2009/06/pageCannotBeFound.gif" alt="page cannot be found" title="page cannot be found" /></p>
<h3>What You Should Have on Your 404 Page</h3>
<p>The name of the game is to make users less frustrated.  They&#8217;re lost and they need some help.  First thing you should offer them is a link to your sitemap and your homepage.  These will offer a quick way to get back in the game.  Alternatively you can put a search bar in your 404 page.  This gives a familiar way for your users to find what they are looking for.  There are mixed feelings about putting a contact form on your 404 page. The idea is that users can tell you that your page is missing.  Ideally though, you should be actively checking that you aren&#8217;t missing any pages.  <a href="http://www.google.com" target="_blank" >Google webmaster tools</a> can help you with this. Here is an example of a  <a href="http://www.devirtuoso.com/404-page.html" target="_blank">404 page</a>. Granted there are much  <a href="http://fab404.com/" target="_blank">better 404 pages</a> out there, this is just a sample of the basic tools that you should have.</p>
<h3>Create Your 404 Page</h3>
<p>You&#8217;ll need to create a HTML page. Try to keep it very simple for the user.  They&#8217;re lost so you have to create a clear path for them to follow. You&#8217;ll find a lot of <a href="http://fab404.com/" target="_blank" >humourous 404</a> pages to help keep the users entertained. Although this is nice, make sure you have a way for users to get back to your site. Also remember to keep your page above 512 bytes. Earlier IE browsers don&#8217;t handle small 404 pages well. Throw in an image and it should solve this problem.</p>
<p>
Also, it is probably a good idea to put a robots meta tag telling search engines not to crawl your 404 page.  </p>
<p>Example:</p>
<div class="codecolorer-container html4strict " style="overflow:auto;white-space:nowrap;width:580px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="html4strict codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="sc2">&lt;<a href="http://december.com/html/4/element/meta.html"><span class="kw2">meta</span></a> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">&quot;robots&quot;</span> <span class="kw3">CONTENT</span><span class="sy0">=</span><span class="st0">&quot;noindex, nofollow&quot;</span>&gt;</span></div></td></tr></tbody></table></div>
<h3>Put the 404 Page on Your Site</h3>
<p>After you have your HTML page created, dump it onto your server and take note of where it is. You&#8217;ll have to reference it later when setting up the server.</p>
<h3>Setting Up the Server for Your 404 page</h3>
<p>A lot of web hosts and CMSs allow you to setup your custom 404 page right from within the control panel.  This should be the first thing you check as it gives you a nice interface to work with.  The alternative isn&#8217;t complicated, but why trouble yourself if you don&#8217;t have to.</p>
<p>You&#8217;ll need to know what kind of server you are on if you don&#8217;t plan on using the control panel.  If you are on an Apache server you can create a file by the name of .htaccess . </p>
<p>Within this file you just have to put the line:</p>
<div class="codecolorer-container html4strict " style="overflow:auto;white-space:nowrap;width:580px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="html4strict codecolorer" style="font-family:Monaco,Lucida Console,monospace">ErrorDocument 404 /404.html</div></td></tr></tbody></table></div>
<p>Replace 404.html with the path to your 404 page. This will tell the server where to look if it encounters the error 404 (page not found).</p>
<p>If you have an iis server (windows) than it&#8217;s a little more complicated.  You&#8217;ll have to open your internet service manager, select the properties of your web server, then head to the custom errors tab.  You&#8217;ll find all of the error codes there, just select 404 and replace the page with the one that you created.  For a more in depth look at this you can visit this tutorial on <a href="http://ask.enquiro.com/2008/how-to-create-a-custom-404-error-page-in-microsoft-iis/" target="_blank" >how to create a custom 404 page in iis</a>.</p>
<p><img class="alignnone size-full wp-image-586" title="404 iis panel" src="http://www.devirtuoso.com/wp-content/uploads/2009/06/404-iis.gif" alt="404 iis panel" width="459" height="451" /></p>
<p>That&#8217;s it you should have your 404 page up and running.  Type in a bogus address to your domain to test it out. eg. http://www.devirutoso.com/fake-address</p>
<h3>Related Links</h3>
<p><a href="http://www.4guysfromrolla.com/webtech/061499-1.shtml" target="_blank" >Creating a Custom 404 Error Page</a><br />
<a href="http://ask.enquiro.com/2008/how-to-create-a-custom-404-error-page-in-microsoft-iis/" target="_blank" >How to Create a Custom 404 Error Page in Microsoft IIS</a><br />
<a href="http://www.codinghorror.com/blog/archives/000819.html" target="_blank" >Creating User Friendly 404 Pages</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.devirtuoso.com/2009/06/how-to-create-a-useful-404-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Things that Can Help or Hurt Your Web Usability</title>
		<link>http://www.devirtuoso.com/2009/06/things-that-can-help-or-hurt-your-web-usability/</link>
		<comments>http://www.devirtuoso.com/2009/06/things-that-can-help-or-hurt-your-web-usability/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 18:52:08 +0000</pubDate>
		<dc:creator>Shawn</dc:creator>
				<category><![CDATA[Development Best Practices]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[web usability]]></category>

		<guid isPermaLink="false">http://www.devirtuoso.com/?p=543</guid>
		<description><![CDATA[Trying to keep your users happy is the name of the game.  A usable website can help your users, and in turn help you with your ultimate goal of your website. The following is a list of dos and do nots of web usability.

Things that Hurt Your Web Usability
This is a list of usability [...]]]></description>
			<content:encoded><![CDATA[<p>Trying to keep your users happy is the name of the game.  A usable website can help your users, and in turn help you with your ultimate goal of your website. The following is a list of dos and do nots of web usability.</p>
<p><span id="more-543"></span></p>
<h2><span style="color: #800000;">Things that Hurt Your Web Usability</span></h2>
<p>This is a list of usability no-nos that can frustrate your users.  Try and avoid the following.</p>
<h3>Hiding Information from the User</h3>
<p>Nothing is more frustrating than going on a site and you can&#8217;t find what you&#8217;re looking for. If your user is looking for something simple like contact info, rates or prices and can&#8217;t find them, its more than likely they&#8217;re going to go somewhere else. Make it easy to find information they&#8217;ll use.</p>
<h3>Forcing Users to Do Things Your Way</h3>
<p>When filling out forms the user should have to worry if there are dashes in their phone number or credit card.  Take care of this on the coding side, and give your users a care free time while using your website.</p>
<h3>Ask for Info You Don&#8217;t Need</h3>
<p>There is nothing worse than having to fill out a huge form just try a demo. People don&#8217;t like to give out unnecessary information. If you&#8217;re getting information from your forms like &#8216;asdf&#8217; it might be a good indicator to shorten it up.</p>
<h3>Faking Sincerity</h3>
<p>People aren&#8217;t stupid, they can tell when you are being sincere and when you just want something from them. Have content that can actually help people and not try and sell them something.</p>
<h3>Wasting Users Time</h3>
<p>Long flash intros and wading through feel-good marketing photos fall under this category.  People are in a hurry.  If you waste their time, don&#8217;t expect them to hang around.</p>
<h3>Your Site Looks Amateurish</h3>
<p>You could have the best content in the world but, if your website is sloppy, disorganized or generally unprofessional, users will loose all confidence in the content on your site.</p>
<h2><span style="color: #008000;">Things that Help Your Web Usability</span></h2>
<p>This is a list of things that can instill confidence in your user. With good reason, some of these are direct opposites of what can hurt your web usability.</p>
<h3>Know What People Want and Make it Obvious</h3>
<p>This could double as the definition of web usability. You just need to take the time and figure out how people are going to use your site, then make it really simple for them to do so.</p>
<h3>Tell User What They Want to Know</h3>
<p>It&#8217;s a good idea to be upfront with your users. A good example is shipping costs.  People want to know this.  They probably already know there is going to be a charge, so why not be upfront with them and gain there trust.</p>
<h3>Save Users Steps Wherever you Can</h3>
<p>Take the time in coding to make the users life easier. Try and make any processes as short as possible.  <a href="http://www.amazon.com/">Amazon.com</a> does a good job of this with their one-click checkout for members.</p>
<h3>Take the Time</h3>
<p>You want to make sure you take the time to make sure your content is well organized, easy to find, presented nicely, and is accurate. Without these the users confidence in your content goes out the window.</p>
<h3>Good FAQs</h3>
<p>Having a good FAQs section can really help out users.  Make sure that your FAQs are up to date, there is nothing worse than searching through irrelevant FAQs. Also don&#8217;t use FAQs as a marketing pitch. (e.g. &#8220;I&#8217;m glad you asked that&#8230;we have sooo many features that handle this exact problem&#8230;yada yada yada.&#8221;)</p>
<h3>Make it Easy to Recover From Errors</h3>
<p>People make mistakes. If you give them a way to recover from them, they&#8217;ll love you for it.  <a href="http://www.google.ca/ig?hl=en">iGoogle</a> does a good job of this when you remove a widget from your home page.  They give you the option to undo incase you mistakenly press the remove button.</p>
<h3>Appologize if Neccessary</h3>
<p>If there is a case that you just can&#8217;t get around, applogize for your shortcommings. A common case is if your site is down for maintenace.</p>
<p>Hopefully these will help guide you to improve your web usability on your site.  When in doubt just try and figure out what will make things faster and easier for your user.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devirtuoso.com/2009/06/things-that-can-help-or-hurt-your-web-usability/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reasons Why You Should Use a Function</title>
		<link>http://www.devirtuoso.com/2009/06/reasons-why-you-should-use-function/</link>
		<comments>http://www.devirtuoso.com/2009/06/reasons-why-you-should-use-function/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 09:08:25 +0000</pubDate>
		<dc:creator>Shawn</dc:creator>
				<category><![CDATA[Development Best Practices]]></category>
		<category><![CDATA[Back End]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.devirtuoso.com/?p=520</guid>
		<description><![CDATA[When is a good time to use a function or a method? Here is a list of reasons when you should use them.

Reduce Complexity
This is probably the most important of all reasons to use a function.  You can create a function and forget about its inner workings.  This creates an abstraction of all the code [...]]]></description>
			<content:encoded><![CDATA[<p>When is a good time to use a function or a method? Here is a list of reasons when you should use them.</p>
<p><span id="more-520"></span></p>
<h3>Reduce Complexity</h3>
<p>This is probably the most important of all reasons to use a function.  You can create a function and forget about its inner workings.  This creates an <a title="Abstraction: Making Code More Readable" href="http://www.devirtuoso.com/2009/05/abstraction-making-code-readable/" target="_blank">abstraction</a> of all the code within it by <a title="hiding the information" href="http://www.devirtuoso.com/2009/05/making-the-most-of-your-code-by-hiding-information/" target="_blank">hiding the information</a> every time you use the function. Not to mention it helps with code size, maintainability, and correctness.</p>
<p>Example:</p>
<div class="codecolorer-container php " style="overflow:auto;white-space:nowrap;width:580px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace">&nbsp;</div></td></tr></tbody></table></div>
<p>//Complex &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
if ($val &gt;= 32 || $val &lt; 10){</p>
<p>for($i =0; $i &lt; 10; $i++){<br />
echo &#8220;name&#8221;. $i<br />
}<br />
}else{<br />
echo &#8220;no name&#8221;;<br />
}</p>
<p>//Simple &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
echo getName($val);</p>
<p>?&gt;</p>
<h3>Make Code Easier To Read</h3>
<p>Putting a piece of code within a well named function is one of the best ways to document your code. Instead of reading multiple lines of code you can simply read a single descriptive line of code.</p>
<p>Example:</p>
<div class="codecolorer-container php " style="overflow:auto;white-space:nowrap;width:580px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace">&nbsp;</div></td></tr></tbody></table></div>
<p>// Difficult to read&#8230;it takes time to<br />
//figure out what is going on.<br />
$names = array(&#8217;Bob&#8217;,'Ted&#8217;,'Bill&#8217;);<br />
for ($i = 0; $i &lt; count($names); $i++){<br />
echo $names[$i];<br />
}</p>
<p>//Self explanitory code.<br />
DisplayNames();</p>
<p>?&gt;</p>
<h3>Avoid Duplicate Code</h3>
<p>If you find that you have several instances of the same code spread through out, it is probably a good indication you should use a function in its place.</p>
<p>Example:</p>
<div class="codecolorer-container php " style="overflow:auto;white-space:nowrap;width:580px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace">&nbsp;</div></td></tr></tbody></table></div>
<p>function getUserName(){<br />
$firstname = getFirstName();<br />
$lastname = getLastName();<br />
$name = $firstname . &#8221; &#8221; . $lastname;<br />
return $name;<br />
}</p>
<p>// Functions prevents having to use duplicate code.<br />
echo &#8220;Welcome &#8220;. getUserName() . &#8220;!&#8221;;<br />
echo &#8220;What kind of name is &#8220;. getUserName() . &#8220;?&#8221;;</p>
<p>?&gt;</p>
<h3>Hide Sequences</h3>
<p>It is usually a good idea to hide the order in which things happen.  If a program has a set of processes it has to go through, it’s best that each process doesn’t have to rely on any others to work.  Placing each process in it&#8217;s own function will help keep things organized.</p>
<p>Example:</p>
<div class="codecolorer-container php " style="overflow:auto;white-space:nowrap;width:580px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="coMULTI">/*<br />
* Splitting up the process into functions,<br />
* each process doesn't know what the other<br />
* one is doing. This allows you to make changes<br />
* to the process with little to no trouble.<br />
*/</span></div></td></tr></tbody></table></div>
<p>$userName = getUsername();<br />
$validUsername = checkUsername($userName);<br />
updateDatabase($validUsername);</p>
<p>?&gt;</p>
<h3>Improve Portability</h3>
<p>Use functions to help portability by isolating code into nice little packages.</p>
<p>Example:</p>
<div class="codecolorer-container php " style="overflow:auto;white-space:nowrap;width:580px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br /></div></td><td><div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="kw2">function</span> add <span class="br0">&#40;</span><span class="re0">$a</span><span class="sy0">,</span> <span class="re0">$b</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
<span class="kw1">return</span> <span class="re0">$a</span> <span class="sy0">+</span> <span class="re0">$b</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div></td></tr></tbody></table></div>
<p>// First lame program<br />
echo add(1,7);</p>
<p>//Function works just as well in any program&#8230;as lame as it might be. <img src='http://www.devirtuoso.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
for ($i = 0; $i<br />
echo $;<br />
}<br />
?&gt;</p>
<h3>Simplify complicated Boolean Tests</h3>
<p>If you have an overly complicated Boolean test, placing the test within a function can help make your condition statements a lot easier to read, and use.</p>
<p>Example:</p>
<div class="codecolorer-container php " style="overflow:auto;white-space:nowrap;width:580px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace">&nbsp;</div></td></tr></tbody></table></div>
<p>//Complicated<br />
if ((2*5+3/7)/2 &gt; 30){<br />
echo &#8220;wtf?&#8221;;<br />
}</p>
<p>//Simplified<br />
if (isValidNumber()){<br />
echo &#8220;Ahh much better.&#8221;;<br />
}</p>
<p>?&gt;</p>
<h3>Improve Performance</h3>
<p>Instead of running around trying to optimize your code in several places, functions allow you to place your code into one place.  This way you can optimize your code in one place and it will take effect in several areas, in turn making your life easier.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devirtuoso.com/2009/06/reasons-why-you-should-use-function/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Levels of Design: Breaking Down Program Construction</title>
		<link>http://www.devirtuoso.com/2009/06/levels-of-design-breaking-down-program-construction/</link>
		<comments>http://www.devirtuoso.com/2009/06/levels-of-design-breaking-down-program-construction/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 01:32:32 +0000</pubDate>
		<dc:creator>Shawn</dc:creator>
				<category><![CDATA[Development Best Practices]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[top down]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.devirtuoso.com/?p=515</guid>
		<description><![CDATA[When designing an online application, it is always good to start broad and work your way into the details.  This is called top down development. Here is the breakdown of the different levels that you should consider when designing a program.

Entire Program
At this point you should just figure out what you want the application to [...]]]></description>
			<content:encoded><![CDATA[<p>When designing an online application, it is always good to start broad and work your way into the details.  This is called <a title="top down design" href="http://www.devirtuoso.com/2009/05/making-development-easy/" target="_blank"><strong>top down development</strong></a><strong>.</strong> Here is the<strong> </strong>breakdown of the different levels that you should consider when designing a program.</p>
<p><span id="more-515"></span></p>
<h3>Entire Program</h3>
<p>At this point you should just figure out what you want the application to do. Figure out the prerequisites and the ultimate goal of the application.</p>
<p><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="levels-application" src="http://www.devirtuoso.com/wp-content/uploads/2009/06/levelsapplication.jpg" border="0" alt="levels-application" width="240" height="196" /></p>
<h3>Packages</h3>
<p>At this point you want to figure out how you want to split up the application.  Some examples might be user interface, graphics, data storage, business rules…etc.  Basically layout everything your application will need in the most general of terms.</p>
<p><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="levels-packages" src="http://www.devirtuoso.com/wp-content/uploads/2009/06/levelspackages.jpg" border="0" alt="levels-packages" width="240" height="196" /></p>
<h3>Design Classes</h3>
<p>Each package should be separated further into classes. Also you should be figuring out how each class interacts with one another.  An example might be splitting up the business rules package into smaller pieces. You might have a class for parsing data from the database, one class for any rules, one class for any restrictions…etc.</p>
<p><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="levels-classes" src="http://www.devirtuoso.com/wp-content/uploads/2009/06/levelsclasses.jpg" border="0" alt="levels-classes" width="240" height="196" /></p>
<h3>Design Methods</h3>
<p>Break down the classes even further into methods.  For each class you should figure out the elements it needs.  Also which methods are private and which ones are public. For example you might have a class for manipulating data from the database.  You might break the class down into methods that handle adding info, editing info, selecting info and deleting info.</p>
<p><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="levels-methods" src="http://www.devirtuoso.com/wp-content/uploads/2009/06/levelsmethods.jpg" border="0" alt="levels-methods" width="240" height="196" /></p>
<h3>Internal Method Design</h3>
<p>Now you’re down to the nitty gritty. You should just fill out the methods and make them work. At this point you should have a firm understanding how your application is laid out and how each method / class interacts with one another.</p>
<p><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="levels-internal-method" src="http://www.devirtuoso.com/wp-content/uploads/2009/06/levelsinternalmethod.jpg" border="0" alt="levels-internal-method" width="240" height="196" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.devirtuoso.com/2009/06/levels-of-design-breaking-down-program-construction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Design Patterns: Making Websites More User Friendly</title>
		<link>http://www.devirtuoso.com/2009/06/web-design-patterns-making-websites-more-user-friendly/</link>
		<comments>http://www.devirtuoso.com/2009/06/web-design-patterns-making-websites-more-user-friendly/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 19:06:03 +0000</pubDate>
		<dc:creator>Shawn</dc:creator>
				<category><![CDATA[Development Best Practices]]></category>
		<category><![CDATA[Front End Development]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.devirtuoso.com/?p=484</guid>
		<description><![CDATA[Web Design Patterns are elements in website design that have become popular by the masses. So much so that users instinctively know how to use them. Why not use them and make your website that much easier to use.

How Patterns Come About
Web design standards usually come about when one website first uses it, and people [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Web Design Patterns</strong> are elements in website design that have become popular by the masses. So much so that users instinctively know how to use them. Why not use them and make your website that much easier to use.</p>
<p><span id="more-484"></span></p>
<h3>How Patterns Come About</h3>
<p>Web design standards usually come about when one website first uses it, and people find the element so useful that they copy it for their own website. A good example of this might be tabs navigation. They&#8217;re common place in web design now-a-days, but there was a time when these didn&#8217;t exist in web form. Someone thought it might be a good idea to create a navigation that replicated the real world filing system. Sure enough it was a hit, and spread like wild fire.</p>
<h3>Patterns are Useful</h3>
<p>Why would you use web design patterns? The beauty of design patterns is that you already know people know how to use them. If you feel like being creative and create a cool navigation, you’re taking the chance that someone might not figure it out. Why not use a design standard that has been tried and true, and put your own twist on it. Users quickly scan websites looking for what they need. If design patterns are in place it gives the user a sense of familiarity, and in turn helping them navigate without frustration.</p>
<h3>Designer Troubles</h3>
<p>Designers often avoid using these standards with good reason. Often times the designer feels that they have been paid to create something new and exciting, and there is nothing new and exciting about commonly used elements. By all means try and create new and exciting elements, but make sure they are painfully easy to use. If it requires an explanation, there are going to be people out there that don&#8217;t get it. Instead use a design standard and dress it up a bit with your own flair.</p>
<h3>Examples</h3>
<p>Here is a list of a couple of patterns. If you wish to see a complete list please visit <a title="Yahoo's Design Pattern Library" href="http://developer.yahoo.com/ypatterns/" target="_blank">Yahoo’s design pattern library</a> or <a href="http://www.welie.com/patterns/index.php" target="_blank">Welie’s design pattern library</a>.</p>
<h5>Accordion</h5>
<p><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="image" src="http://www.devirtuoso.com/wp-content/uploads/2009/06/image.png" border="0" alt="image" width="175" height="260" /></p>
<h5>Breadcrumbs</h5>
<p><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="image" src="http://www.devirtuoso.com/wp-content/uploads/2009/06/image1.png" border="0" alt="image" width="590" height="47" /></p>
<h5>Tag Cloud</h5>
<p><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="image" src="http://www.devirtuoso.com/wp-content/uploads/2009/06/image2.png" border="0" alt="image" width="420" height="287" /></p>
<h5>Footer Sitemap</h5>
<p><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="image" src="http://www.devirtuoso.com/wp-content/uploads/2009/06/image3.png" border="0" alt="image" width="570" height="185" /></p>
<h5>Autocomplete</h5>
<p><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="image" src="http://www.devirtuoso.com/wp-content/uploads/2009/06/image4.png" border="0" alt="image" width="570" height="168" /></p>
<h5>Paging</h5>
<p><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="image" src="http://www.devirtuoso.com/wp-content/uploads/2009/06/image5.png" border="0" alt="image" width="293" height="89" /></p>
<h5>Tabs</h5>
<p><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="image" src="http://www.devirtuoso.com/wp-content/uploads/2009/06/image6.png" border="0" alt="image" width="420" height="89" /></p>
<h5>Shopping Cart</h5>
<p><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="image" src="http://www.devirtuoso.com/wp-content/uploads/2009/06/image7.png" border="0" alt="image" width="570" height="240" /></p>
<h5>Rating</h5>
<p><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="image" src="http://www.devirtuoso.com/wp-content/uploads/2009/06/image8.png" border="0" alt="image" width="278" height="79" /></p>
<h5>Vote to Promote</h5>
<p><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="image" src="http://www.devirtuoso.com/wp-content/uploads/2009/06/image9.png" border="0" alt="image" width="570" height="93" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.devirtuoso.com/2009/06/web-design-patterns-making-websites-more-user-friendly/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Better Web Usability Through Visual Relationships</title>
		<link>http://www.devirtuoso.com/2009/06/better-web-usability-through-visual-relationships/</link>
		<comments>http://www.devirtuoso.com/2009/06/better-web-usability-through-visual-relationships/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 18:43:13 +0000</pubDate>
		<dc:creator>Shawn</dc:creator>
				<category><![CDATA[Development Best Practices]]></category>
		<category><![CDATA[Front End Development]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[web usability]]></category>

		<guid isPermaLink="false">http://www.devirtuoso.com/?p=466</guid>
		<description><![CDATA[Web Usability is more important than ever. People have little to no time to read through all of your information to find what they are looking for. Creating visual relationships can help users find what they are looking for quicker and more efficiently.

Prominent = Important
Humans naturally look for similarities and differences in everything. That&#8217;s how [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Web Usability</strong> is more important than ever. People have little to no time to read through all of your information to find what they are looking for. Creating <strong>visual relationships</strong> can help users find what they are looking for <strong>quicker</strong> and <strong>more efficiently</strong>.</p>
<p><span id="more-466"></span></p>
<h3>Prominent = Important</h3>
<p>Humans naturally look for similarities and differences in everything. That&#8217;s how we can tell people apart. Naturally things that stand out get more attention that ones that don&#8217;t. Like noticing the person with the crazy hair in the subway&#8230;what were they thinking? <img src='http://www.devirtuoso.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Fortunately with design we get to choose what is more prominent. How do you do this you ask? There are several ways.</p>
<p>Here is a list of a few:</p>
<ul>
<li>Put near the top of the page</li>
<li>Make the info <span style="font-size: 16px">Larger</span></li>
<li>Make the info <strong>Bolder</strong></li>
<li>Give text a different <span style="color: red">color</span></li>
<li>Separate with white space</li>
<li>All of the above</li>
</ul>
<p>The more of these you use, the prominent it will be. Having a more prominent element will be a separater letting the user know that anything around it more than likely relates to it.</p>
<h3>Items Related Logically are Related Visually</h3>
<p><strong>Grouping Under Header &#8211; </strong>Placing information underneath a header logically suggests that it belongs to that header.  This is common in newspapers, and pretty well any text you read.  This creates a visual hierarchy.</p>
<p><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="newspaper-logical" src="http://www.devirtuoso.com/wp-content/uploads/2009/06/newspaperlogical.jpg" border="0" alt="newspaper-logical" width="420" height="313" /></p>
<p><strong>Same Visual Styles</strong> – Much like brothers or sisters, you can usually tell when people are related because they look similar.  Same thing applies to text, if you want something to relate to one another, use the same styling. e.g. All links are blue and underlined.</p>
<p><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="visual-relationship" src="http://www.devirtuoso.com/wp-content/uploads/2009/06/visualrelationship.jpg" border="0" alt="visual-relationship" width="420" height="313" /></p>
<p><strong>Clearly Defined Area</strong> – Like putting your socks in a sock drawer, putting text into defined areas help organize information. By doing so also helps suggest that all the information is related.</p>
<p><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="defined-area" src="http://www.devirtuoso.com/wp-content/uploads/2009/06/definedarea.jpg" border="0" alt="defined-area" width="420" height="313" /></p>
<h3>Nest Information Visually</h3>
<p>Visually placing information nested within one another is an easy way to create a relationship with information. On the out most you have a general description, as you work your way inwards it becomes more specific.</p>
<p><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="nesting" src="http://www.devirtuoso.com/wp-content/uploads/2009/06/nesting.jpg" border="0" alt="nesting" width="420" height="313" /></p>
<h3>Be Careful About Creating Unwanted Relationships</h3>
<p>Unfortunately it is easy to create unwanted relationships. All it takes is a misplaced emphasis on some text, that leaves the wrong impression. So be careful how you lay things out.</p>
<p><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="bad-relationships" src="http://www.devirtuoso.com/wp-content/uploads/2009/06/badrelationships1.jpg" border="0" alt="bad-relationships" width="420" height="313" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.devirtuoso.com/2009/06/better-web-usability-through-visual-relationships/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>10 Characteristics of Good Program Design</title>
		<link>http://www.devirtuoso.com/2009/06/10-characteristics-of-good-program-design/</link>
		<comments>http://www.devirtuoso.com/2009/06/10-characteristics-of-good-program-design/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 03:50:24 +0000</pubDate>
		<dc:creator>Shawn</dc:creator>
				<category><![CDATA[Development Best Practices]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[design principles]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.devirtuoso.com/?p=458</guid>
		<description><![CDATA[This is a list of goals that a developer should try and have in their software design. Some goals contradict other ones, but that is where you have to decide what is best for your program.
 

Minimal Complexity
The main goal in any program should be to minimize complexity.&#160; As a developer most of your time [...]]]></description>
			<content:encoded><![CDATA[<p>This is a list of goals that a developer should try and have in their software design. Some goals contradict other ones, but that is where you have to decide what is best for your program.</p>
<p> <span id="more-458"></span>
</p>
<h3>Minimal Complexity</h3>
<p>The main goal in any program should be to minimize complexity.&#160; As a developer most of your time will be maintaining or upgrading existing code. If it is a complete mess, then your life is going to be that much harder. Try and avoid those solutions where you use a one line complex solution to replace 20 lines of easy to read code. In a year, when you come back to that code, it will take you that much longer to figure out what you did.</p>
<h3>Ease Of Maintenance</h3>
<p>This is making your code easy to update. Find where your code is most likely going to change, and make it easy to update. The easier you make it, the easier your life is going to be down the road.&#160; Think of it as a little insurance for your code.</p>
<h3>Loose Coupling</h3>
<p>So What is loose coupling? It is when one portion of code is not dependant on another to run properly. It is bundling code into nice little self reliant packages that don’t rely on any outside code.&#160; How do you do this? Make good use of <a title="abstraction" href="http://www.devirtuoso.com/2009/05/abstraction-making-code-readable/" target="_blank">abstraction</a> and <a title="information hiding" href="http://www.devirtuoso.com/2009/05/making-the-most-of-your-code-by-hiding-information/" target="_blank">information hiding.</a></p>
<h3>Extensibility</h3>
<p>This means that you design your program so that you can add or remove elements from your program without disturbing the underlying structure of the program. A good example would be a plug-in.</p>
<h3>Reusability</h3>
<p>Write code that will be able to be used in unrelated projects.&#160; Save yourself some time. Again <a title="information hiding." href="http://www.devirtuoso.com/2009/05/making-the-most-of-your-code-by-hiding-information/" target="_blank">information hiding</a> is your best bet for making this happen.</p>
<h3>High Fan-in</h3>
<p>This refers to having a large number of classes that use a given class. This implies that you are making good use of utility classes. For example you might have a bunch of classes that use the Math class to do calculations.</p>
<h3>Low to medium Fan-out</h3>
<p>This refers to having a low to medium amount of classes used by any given class.&#160; If you had a class that includes 7 or more classes this is considered high fan out.&#160; So try and keep the number of classes you include down to a minimum.&#160; Having a high fan-out suggests that the design may be too complex.</p>
<h3>Portability</h3>
<p>Simply put, design a system that can be moved to another environment.&#160; This isn’t always a requirement of a program, but it should be considered. It might make your life easier if you find out your program does have to work on different platforms.</p>
<h3>Leanness</h3>
<p>Leanness means making the design with no extra parts.&#160; Everything that is within the design has to be there.&#160; This is generally a goal if you have speed and efficiency in mind.&#160; A good example of where this might come in handy is creating a program that has to run on a system with limited resources (cell phone, older computers)</p>
<h3>Standard Techniques</h3>
<p>Try and standardize your code.&#160; If each developer puts in their own flavor of code you will end up with an unwieldy mess. Try to layout common approaches for developers to follow, and it will give your code a sense of familiarity for all developers working on it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devirtuoso.com/2009/06/10-characteristics-of-good-program-design/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
