<?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"
	>

<channel>
	<title>Developer Tutorials' Webmaster Blog &#187; code reuse</title>
	<atom:link href="http://www.developertutorials.com/blog/tag/code-reuse/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.developertutorials.com/blog</link>
	<description>Keeping webmasters up-to-date on technology.</description>
	<pubDate>Tue, 02 Sep 2008 14:59:45 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<item>
		<title>Before you code&#8230;</title>
		<link>http://www.developertutorials.com/blog/php/before-you-code-9/</link>
		<comments>http://www.developertutorials.com/blog/php/before-you-code-9/#comments</comments>
		<pubDate>Sun, 27 Jan 2008 07:15:54 +0000</pubDate>
		<dc:creator>Akash Mehta</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[code reuse]]></category>

		<category><![CDATA[php tips]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/php/before-you-code-9/</guid>
		<description><![CDATA[So, you&#8217;re about to build an entire web application in PHP. You&#8217;ve worked out how you&#8217;re going to do it, you&#8217;ve got a general idea what it&#8217;ll look like, maybe you&#8217;ve even chosen a framework (if you don&#8217;t have any to choose from, find some). Before you go any further, take a step back and [...]]]></description>
			<content:encoded><![CDATA[<p>So, you&#8217;re about to build an entire web application in PHP. You&#8217;ve worked out how you&#8217;re going to do it, you&#8217;ve got a general idea what it&#8217;ll look like, maybe you&#8217;ve even chosen a framework (if you don&#8217;t have any to choose from, <a href="http://codeigniter.com/" target="_blank">find</a> <a href="http://cakephp.org" target="_blank">some</a>). Before you go any further, take a step back and run through this checklist.</p>
<ol>
<li><strong>Plan.</strong>  Do some design mockups, work out what functionality will go in what classes. You can never plan enough, and good planning can save you days of code rewriting later.</li>
<li><strong>Research.</strong> This is probably one of the most-forgotten areas of project planning. Chances are what you&#8217;re building has been done before, so do a bit of research on existing applications similar to yours. Consider any problems you may encounter and see how other applications handled these challenges. <a href="http://sf.net/" target="_blank">SourceForge</a> is a great place to start.</li>
<li><strong>Future proof.</strong> Depending on your application, this might not be terribly important, but consider what technologies are being used at the moment and may start being used. <a href="http://www.sitepoint.com/article/future-of-the-web-2008" target="_blank">This article</a> has a few suggestions. For example, maybe in future you&#8217;ll add a microformat-export function, and your code needs to be structured differently to support that?</li>
<li><strong>Don&#8217;t reinvent the wheel.</strong> Most developers I&#8217;ve seen simply don&#8217;t practice this enough. Sure, you&#8217;re using your framework for some common tasks, but many people assume they&#8217;ll need to write a lot of their own code for complex routines. Before you start, check out <a href="http://pear.php.net/" target="_blank">PEAR</a> and <a href="http://www.phpclasses.org/" target="_blank">PHP Classes</a>.</li>
<li><strong>Set some timeframes and get into it!</strong> Now that you have a good idea of what you&#8217;re going to build, and how you&#8217;ll make it happen, set some goals and get coding!</li>
</ol>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark" style="float:left;">
<div class="d9" style="overflow:hidden">
<div id="socialstyles"><a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/php/before-you-code-9/&amp;title=Before+you+code%26%238230%3B" title="Add to&nbsp;Del.icio.us">Del.icio.us</a></div><div id="socialstyles"><a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.developertutorials.com/blog/php/before-you-code-9/&amp;title=Before+you+code%26%238230%3B" title="Add to&nbsp;Digg This">Digg This</a></div><div id="socialstyles"><a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/php/before-you-code-9/&amp;title=Before+you+code%26%238230%3B" title="Add to&nbsp;Stumble">Stumble</a></div></div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/php/before-you-code-9/feed/</wfw:commentRss>
		</item>
		<item>
		<title>5 essential development facts every PHP developer should know</title>
		<link>http://www.developertutorials.com/blog/php/5-essential-facts-every-php-developer-should-know-6/</link>
		<comments>http://www.developertutorials.com/blog/php/5-essential-facts-every-php-developer-should-know-6/#comments</comments>
		<pubDate>Thu, 24 Jan 2008 11:00:38 +0000</pubDate>
		<dc:creator>Akash Mehta</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[code reuse]]></category>

		<category><![CDATA[php tips]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/php/5-essential-facts-every-php-developer-should-know-6/</guid>
		<description><![CDATA[There&#8217;s always a bridge between textbook knowledge of programming - syntax, procedure etc. - and the real world knowledge that you get from actually developing real applications. Here are five things every PHP developer should be familiar with before they begin developing web applications in PHP.
1. Frameworks
Frameworks are arguably one of the most important areas [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s always a bridge between textbook knowledge of programming - syntax, procedure etc. - and the real world knowledge that you get from actually developing real applications. Here are five things every PHP developer should be familiar with before they begin developing web applications in PHP.</p>
<p><strong>1. Frameworks</strong><br />
Frameworks are arguably one of the most important areas of PHP development. With no single accepted way of developing web applications in PHP, a number of open source frameworks are available, helping you code quicker, more consistently and more effectively. Some of the best include <a href="http://cakephp.com/">CakePHP</a>, <a href="http://www.symfony-project.org/">Symfony</a> and <a href="http://codeigniter.com/">CodeIgniter</a>. A lot of the frameworks also follow the <a href="http://en.wikipedia.org/wiki/MVC">MVC design pattern</a>, which you should definitely be familiar with should you ever have to work on code that follows it. After a while, you may even feel inclined to create your own framework to meet your needs.</p>
<p><strong>2. Templating engines</strong><br />
If you&#8217;re not using a framework that enforces a specific design pattern, chances are you want to be using a templating engine. Whether you create your own or using one of the existing options (like <a href="http://smarty.php.net/">Smarty</a>), a templating engine allows you to entirely seperate your code logic from your HTML interface code (and associated CSS/JS/etc.). This considerably simplifies your code, allows quick and easy modifications to the actual front-end of your application, and makes it easier for non-developers to modify your application&#8217;s visuals.</p>
<p><span id="more-6"></span></p>
<p><strong>3. Code availability</strong><br />
As I mentioned in a previous post, PHP has some of the best code availability of any language. From <a href="http://www.phpbuilder.com/snippet/">various</a> <a href="http://snipplr.com/all/language/php">snippet</a> <a href="http://www.roscripts.com/snippets/show_snippets/11">archives</a> to <a href="http://www.phpclasses.org/">entire class databases</a>, PHP developers are really spoilt for choice when it comes to reusing existing code. In fact, you can almost get away with building an entire application without writing a single line of code.</p>
<p><strong>4. Don&#8217;t reinvent the wheel</strong><br />
This might seem fairly obvious, and a little part of the previous point, but very few PHP developers realise how much power is already available as part of PHP itself. Forget pulling in new libraries, or writing long complex code routines - first take a look at the PHP manual. For example, have you ever heard of <a href="http://php.net/number_format">number_format()</a>, <a href="http://php.net/parse_url">parse_url()</a>, <a href="http://php.net/wordwrap">wordwrap()</a> or <a href="http://php.net/bbcode_parse">bbcode_parse()</a>? Take a look at <a href="http://php.net/manual/en/funcref.php">the entire function reference</a>, pick a category and have a browse - you&#8217;re bound to find something new.</p>
<p><strong>5. IRC is a wonderful thing</strong><br />
For when you&#8217;re stuck on a complex problem that you  just can&#8217;t make sense of,  hop on IRC.  The ##php unofficial support channel on Freenode is always full of experienced PHP developers happy. You&#8217;ll need an IRC client - <a href="https://addons.mozilla.org/en-US/firefox/addon/16">ChatZilla</a> is great if you&#8217;ve got Firefox - and a little patience; when you need help, <a href="http://pastebin.ca/">pastebin your code</a> and head to <a href="irc://irc.freenode.net/php">irc://irc.freenode.net/php</a>. Post your question and wait patiently; some kind soul (or multiple kind souls!) will answer. When you&#8217;ve finished, consider lurking in the channel to help others with their problems. No man is a mountain, especially with PHP&#8217;s enormous library of functions; on IRC, the pool of collective knowledge can solve just about any problem.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark" style="float:left;">
<div class="d6" style="overflow:hidden">
<div id="socialstyles"><a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/php/5-essential-facts-every-php-developer-should-know-6/&amp;title=5+essential+development+facts+every+PHP+developer+should+know" title="Add to&nbsp;Del.icio.us">Del.icio.us</a></div><div id="socialstyles"><a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.developertutorials.com/blog/php/5-essential-facts-every-php-developer-should-know-6/&amp;title=5+essential+development+facts+every+PHP+developer+should+know" title="Add to&nbsp;Digg This">Digg This</a></div><div id="socialstyles"><a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/php/5-essential-facts-every-php-developer-should-know-6/&amp;title=5+essential+development+facts+every+PHP+developer+should+know" title="Add to&nbsp;Stumble">Stumble</a></div></div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/php/5-essential-facts-every-php-developer-should-know-6/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Code reuse in PHP frameworks</title>
		<link>http://www.developertutorials.com/blog/php/code-reuse-in-php-frameworks-5/</link>
		<comments>http://www.developertutorials.com/blog/php/code-reuse-in-php-frameworks-5/#comments</comments>
		<pubDate>Wed, 23 Jan 2008 23:00:18 +0000</pubDate>
		<dc:creator>Akash Mehta</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[code reuse]]></category>

		<category><![CDATA[codeigniter]]></category>

		<category><![CDATA[framework]]></category>

		<category><![CDATA[php classes]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/php/code-reuse-in-php-frameworks-5/</guid>
		<description><![CDATA[Code reuse: a great boon for web development. With large repositories of PHP code out there, from snippet archives to class databases, PHP is arguably one of the best languages when it comes to existing reusable code.
Of course, it isn&#8217;t nearly that simple. Everyone writes code differently; different naming conventions, different approaches to achieving common [...]]]></description>
			<content:encoded><![CDATA[<p>Code reuse: a great boon for web development. With large repositories of PHP code out there, from snippet archives to <a href="http://phpclasses.org/">class databases</a>, PHP is arguably one of the best languages when it comes to existing reusable code.</p>
<p>Of course, it isn&#8217;t nearly that simple. Everyone writes code differently; different naming conventions, different approaches to achieving common tasks (e.g. configuration), even different ways of interacting with the code (functions, classes static/non-static etc.). The problem is compounded when you start using a framework, with the intention of enforcing some basic convention - convention which your existing code libraries may not follow.</p>
<p><span id="more-5"></span>Frameworks can&#8217;t - and shouldn&#8217;t - include masses of functionality by default; an easy way to extend them with existing code is pretty important.  Of all the PHP frameworks I&#8217;ve tried, <a href="http://codeigniter.com">CodeIgniter</a> seems to have one of the most flexible approaches; drop a class into the libraries folder, and as long as it doesn&#8217;t need data passed through the constructor, chances are it just works. (Slight filename and class name changes might be necessary).</p>
<p>I&#8217;ve managed this effortlessly with an XML parsing class from phpclasses.org: in under two minutes I had added an XML parser interface that I could use just like any native CodeIgniter library.</p>
<p>So, how have your attempts at code reuse inside frameworks gone? I haven&#8217;t had a chance to test CakePHP yet; please comment if you&#8217;ve tried it in the past.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark" style="float:left;">
<div class="d5" style="overflow:hidden">
<div id="socialstyles"><a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/php/code-reuse-in-php-frameworks-5/&amp;title=Code+reuse+in+PHP+frameworks" title="Add to&nbsp;Del.icio.us">Del.icio.us</a></div><div id="socialstyles"><a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.developertutorials.com/blog/php/code-reuse-in-php-frameworks-5/&amp;title=Code+reuse+in+PHP+frameworks" title="Add to&nbsp;Digg This">Digg This</a></div><div id="socialstyles"><a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/php/code-reuse-in-php-frameworks-5/&amp;title=Code+reuse+in+PHP+frameworks" title="Add to&nbsp;Stumble">Stumble</a></div></div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/php/code-reuse-in-php-frameworks-5/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
