<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Clean and efficient coding technique in PHP</title>
	<atom:link href="http://roshanbh.com.np/2007/12/clean-and-efficient-coding-technique-in-php.html/feed" rel="self" type="application/rss+xml" />
	<link>http://roshanbh.com.np/2007/12/clean-and-efficient-coding-technique-in-php.html</link>
	<description>Useful Tutorials, Scripts , Tips, and Resources for all PHP and Ajax beginners and experts .</description>
	<lastBuildDate>Mon, 07 May 2012 21:11:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: meridia</title>
		<link>http://roshanbh.com.np/2007/12/clean-and-efficient-coding-technique-in-php.html/comment-page-1#comment-5603</link>
		<dc:creator>meridia</dc:creator>
		<pubDate>Thu, 19 Aug 2010 12:28:03 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/clean-and-efficient-coding-technique-in-php/#comment-5603</guid>
		<description>nice articvle</description>
		<content:encoded><![CDATA[<p>nice articvle</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ????? ?????? ????? - ::IDMania FORUM::</title>
		<link>http://roshanbh.com.np/2007/12/clean-and-efficient-coding-technique-in-php.html/comment-page-1#comment-4866</link>
		<dc:creator>????? ?????? ????? - ::IDMania FORUM::</dc:creator>
		<pubDate>Wed, 02 Dec 2009 23:34:42 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/clean-and-efficient-coding-technique-in-php/#comment-4866</guid>
		<description>[...]  [...]</description>
		<content:encoded><![CDATA[<p>[...]  [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam IT</title>
		<link>http://roshanbh.com.np/2007/12/clean-and-efficient-coding-technique-in-php.html/comment-page-1#comment-4606</link>
		<dc:creator>Sam IT</dc:creator>
		<pubDate>Tue, 22 Sep 2009 02:09:40 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/clean-and-efficient-coding-technique-in-php/#comment-4606</guid>
		<description>Agreed with pretty much everything but just wanted to add that in many cases I use classes instead of functions so the code is better organized and clearer.

For example instead of calling a function such as:

get_customers_profile();

I would use:

$customer-&gt;get_profile();

Or if I use a framework (I usually do) such as Codeigniter:

$this-&gt;customer-&gt;get or get_profile.

Much easier to keep the code clean and organized when it&#039;s in classes (same idea with folders).

Nice blog, keep it coming! :-)</description>
		<content:encoded><![CDATA[<p>Agreed with pretty much everything but just wanted to add that in many cases I use classes instead of functions so the code is better organized and clearer.</p>
<p>For example instead of calling a function such as:</p>
<p>get_customers_profile();</p>
<p>I would use:</p>
<p>$customer-&gt;get_profile();</p>
<p>Or if I use a framework (I usually do) such as Codeigniter:</p>
<p>$this-&gt;customer-&gt;get or get_profile.</p>
<p>Much easier to keep the code clean and organized when it&#8217;s in classes (same idea with folders).</p>
<p>Nice blog, keep it coming! <img src='http://roshanbh.com.np/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pusp jodhi</title>
		<link>http://roshanbh.com.np/2007/12/clean-and-efficient-coding-technique-in-php.html/comment-page-1#comment-4243</link>
		<dc:creator>pusp jodhi</dc:creator>
		<pubDate>Thu, 23 Jul 2009 13:02:42 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/clean-and-efficient-coding-technique-in-php/#comment-4243</guid>
		<description>i want to learn the standerd coding style in php. please if it can be possible please forward me</description>
		<content:encoded><![CDATA[<p>i want to learn the standerd coding style in php. please if it can be possible please forward me</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ellis Geeklab.net</title>
		<link>http://roshanbh.com.np/2007/12/clean-and-efficient-coding-technique-in-php.html/comment-page-1#comment-25</link>
		<dc:creator>Ellis Geeklab.net</dc:creator>
		<pubDate>Sat, 22 Dec 2007 23:34:00 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/clean-and-efficient-coding-technique-in-php/#comment-25</guid>
		<description>For the switch() - the code is a lot easier to read in my opinion. But I have seen bench marks showing that switch is slightly slower and vice versa.</description>
		<content:encoded><![CDATA[<p>For the switch() &#8211; the code is a lot easier to read in my opinion. But I have seen bench marks showing that switch is slightly slower and vice versa.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://roshanbh.com.np/2007/12/clean-and-efficient-coding-technique-in-php.html/comment-page-1#comment-24</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Sat, 22 Dec 2007 16:23:00 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/clean-and-efficient-coding-technique-in-php/#comment-24</guid>
		<description>I would rather bug the ppl writing the interpreter then take the effort to bring the &#039;best practice&#039;  of rewriting switch to if else statements. &lt;br/&gt;&lt;br/&gt;As noted above: write it cleanly and then profile and then take action accordingly. Practice also shows that when profiling the &#039;hotspots&#039; or bottlenecks are usually not in the place one expects. In short don&#039;t micro-optimize things.&lt;br/&gt;&lt;br/&gt;&quot;Commenting code line by line (or as near to line by line as is needed to clearly explain what operations are being performed).&quot; I can&#039;t disagree more. comment blocks of code; this way it ensures that your code is organised. This is because it forces the programmer to make one block of code do one thing(and do it well) and thus leave your code untangled. And as you don&#039;t comment lines it creates a limit to the amount of things that one line of code does. This removes (old) C++ alike-style line of code where a shitload of operations is done and everyone  has to look (adleast) twice(including the one who wrote the line) to figure out what&#039;s  going on. &lt;br/&gt;&lt;br/&gt;&quot;Making code as modular and reusable as possible.&quot;&lt;br/&gt;&lt;br/&gt;Is dangerous to say too; you can go overboard. Tbh I would go with something along the same lines as profiling. See that it repeats itself first and then refactor it out. Now I know PHP-refactoring support is limited at this time but I&#039;m sure it&#039;s there &#039;tomorro&#039;.</description>
		<content:encoded><![CDATA[<p>I would rather bug the ppl writing the interpreter then take the effort to bring the &#8216;best practice&#8217;  of rewriting switch to if else statements. </p>
<p>As noted above: write it cleanly and then profile and then take action accordingly. Practice also shows that when profiling the &#8216;hotspots&#8217; or bottlenecks are usually not in the place one expects. In short don&#8217;t micro-optimize things.</p>
<p>&#8220;Commenting code line by line (or as near to line by line as is needed to clearly explain what operations are being performed).&#8221; I can&#8217;t disagree more. comment blocks of code; this way it ensures that your code is organised. This is because it forces the programmer to make one block of code do one thing(and do it well) and thus leave your code untangled. And as you don&#8217;t comment lines it creates a limit to the amount of things that one line of code does. This removes (old) C++ alike-style line of code where a shitload of operations is done and everyone  has to look (adleast) twice(including the one who wrote the line) to figure out what&#8217;s  going on. </p>
<p>&#8220;Making code as modular and reusable as possible.&#8221;</p>
<p>Is dangerous to say too; you can go overboard. Tbh I would go with something along the same lines as profiling. See that it repeats itself first and then refactor it out. Now I know PHP-refactoring support is limited at this time but I&#8217;m sure it&#8217;s there &#8216;tomorro&#8217;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Topbit</title>
		<link>http://roshanbh.com.np/2007/12/clean-and-efficient-coding-technique-in-php.html/comment-page-1#comment-23</link>
		<dc:creator>Topbit</dc:creator>
		<pubDate>Sat, 22 Dec 2007 12:11:00 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/clean-and-efficient-coding-technique-in-php/#comment-23</guid>
		<description>echo &#039;Name :&#039;, $name, &#039;. Address : &#039;, $add, &#039;. Email &#039;, $email, &#039;.&#039;;&lt;br/&gt;// no concatenation involved&lt;br/&gt;&lt;br/&gt;I wouldn&#039;t bother rewriting it though if I had originally written it another way - chances are the time spent editing it would be more than the time a CPU takes to run it 10,000 times. CPUs are cheap - I am not.&lt;br/&gt;&lt;br/&gt;Such nano-optimisations are inevitably blown away by several orders of magnitude with poor algorithm choices, database or file-system accesses (unless they are perfectly optimised - which isn&#039;t going to happen anyway) or just using a library or framework that takes more time than it could, but you use it because it will save you a few minutes (or hours, or days) development.&lt;br/&gt;&lt;br/&gt;As always, write clean, secure, and easy to maintain code first. Then, and only &lt;em&gt;if&lt;/em&gt; it is not fast enough, look for the best thing to optimise - and just do that. Rinse, and repeat, if required.</description>
		<content:encoded><![CDATA[<p>echo &#8216;Name :&#8217;, $name, &#8216;. Address : &#8216;, $add, &#8216;. Email &#8216;, $email, &#8216;.&#8217;;<br />// no concatenation involved</p>
<p>I wouldn&#8217;t bother rewriting it though if I had originally written it another way &#8211; chances are the time spent editing it would be more than the time a CPU takes to run it 10,000 times. CPUs are cheap &#8211; I am not.</p>
<p>Such nano-optimisations are inevitably blown away by several orders of magnitude with poor algorithm choices, database or file-system accesses (unless they are perfectly optimised &#8211; which isn&#8217;t going to happen anyway) or just using a library or framework that takes more time than it could, but you use it because it will save you a few minutes (or hours, or days) development.</p>
<p>As always, write clean, secure, and easy to maintain code first. Then, and only <em>if</em> it is not fast enough, look for the best thing to optimise &#8211; and just do that. Rinse, and repeat, if required.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 2/11 queries in 0.072 seconds using disk: basic
Object Caching 292/292 objects using disk: basic

Served from: roshanbh.com.np @ 2012-05-17 05:26:53 -->
