{"id":122,"date":"2008-09-11T00:34:53","date_gmt":"2008-09-10T19:04:53","guid":{"rendered":"http:\/\/www.bin-co.com\/blog\/?p=122"},"modified":"2008-09-11T00:34:53","modified_gmt":"2008-09-10T19:04:53","slug":"10-principals-of-php-development","status":"publish","type":"post","link":"https:\/\/www.bin-co.com\/blog\/2008\/09\/10-principals-of-php-development\/","title":{"rendered":"10 Principals of PHP Development"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.bin-co.com\/blog\/wp-content\/uploads\/2008\/09\/php-logo-1-1.png\" alt=\"PHP Logo\" title=\"PHP Logo Custom\" width=\"179\" height=\"98\" class=\"alignnone size-full wp-image-123 intro\" align=\"right\" \/><\/p>\n<p class=\"intro\">Are you a PHP developer? Go read the article &#8216;<a href=\"http:\/\/nettuts.com\/articles\/10-principles-of-the-php-masters\/\">10 Principles of the PHP Masters<\/a>&#8216;. Do you want to learn PHP? Go read it. <\/p>\n<blockquote><p>With PHP&#8217;s widespread adoption,it&#8217;s almost too easy to find a script or snippet to do exactly what you need. Unfortunately, there&#8217;s no filter as to what is a &#8220;good practice&#8221; and what&#8217;s, well&#8230; not so good when writing a PHP script. We need trustworthy sources, who have proven they have a solid grasp on the best practices of PHP.<\/p><\/blockquote>\n<h2>Use PHP Only When You Need it<\/h2>\n<p>Rasmus Lerdorf<\/p>\n<p><a href=\"http:\/\/www.oracle.com\/technology\/pub\/articles\/php_experts\/rasmus_php.html\">PHP was designed for Web Development<\/a> &#8211; and its very good at it. Just because you can use it to create desktop apps don&#8217;t mean that you have to.<\/p>\n<h2>Use Many Tables With PHP and MYSQL for Scalability<\/h2>\n<p>Matt Mullenweg<\/p>\n<p>This advice comes from a rather controversial <a href=\"http:\/\/ma.tt\/2006\/03\/wordpress-and-lyceum\/\">database design choice he made when creating WordPress MU<\/a>. It created separate tables for each blog rather than the usual method.<\/p>\n<h2>Never, ever trust your users<\/h2>\n<p>Dave Child<\/p>\n<p><a href=\"http:\/\/www.addedbytes.com\/php\/writing-secure-php\/\">Validate everything<\/a> that comes from the user. Yeah, I know its boring &#8211; but it must be done.<\/p>\n<h2>Invest in PHP Caching<\/h2>\n<p>Ben Balbo<\/p>\n<p><a href=\"http:\/\/www.sitepoint.com\/article\/caching-php-performance\/\">Caching is very important<\/a> if you have a busy site.<\/p>\n<h2>Speed up PHP Development with an IDE, Templates and Snippets<\/h2>\n<p>Chad Kieffer<\/p>\n<p>I find it a bit hard to support this. Yeah <a href=\"http:\/\/2tbsp.com\/node\/104\">IDEs speed up development<\/a> &#8211; a small bit. About Snippets &#8211; use them if you trust the source.<\/p>\n<p>But if you really want to speed up development, <\/p>\n<ul>\n<li>Use a framework(coming up later)<\/li>\n<li>Invest in code generation.<\/li>\n<\/ul>\n<h2>Make Better Use of PHP&#8217;s Filter Functions<\/h2>\n<p>Joey Sochacki<\/p>\n<p>This is actually new to me &#8211; but I am going to try this out.<\/p>\n<blockquote><p><a href=\"http:\/\/devolio.com\/blog\/archives\/413-Data-Filtering-Using-PHPs-Filter-Functions-Part-one.html\">Filtering data<\/a>. We all have to do it. Most, if not all of us, despise doing it. However, unbeknown to most are PHP&#8217;s filter_* functions, that allow us to do all sorts of filtering and validation. Using PHP&#8217;s filter_* functions, we can validate and sanitize data types, URLs, e-mail addresses, IP addresses, strip bad characters, and more, all with relative ease.<\/p><\/blockquote>\n<h2>Use a PHP Framework<\/h2>\n<p>Josh Sharp<\/p>\n<p>This is one thing that really speed up development. Also, the programmers that have to maintain your programs will thank you for it.<\/p>\n<h2>Don&#8217;t use a PHP Framework<\/h2>\n<p>Rasmus Lerdorf<\/p>\n<p>The basic argument is that <a href=\"http:\/\/szeged2008.drupalcon.org\/program\/sessions\/rasmus-lerdorf-keynote-simple-hard\">Frameworks slow things down<\/a>. Keep that in mind when your choosing a framework.<\/p>\n<h2>Use Batch Processing<\/h2>\n<p>Jack D. Herrington<\/p>\n<p>This refers to the tasks that can processed in the background &#8211; Herrington recommends <a href=\"http:\/\/www.ibm.com\/developerworks\/opensource\/library\/os-php-batch\/\">using batch processing and cron<\/a> here. As most of you are aware, PHP don&#8217;t have threads &#8211; and it don&#8217;t matter to me. You don&#8217;t use threads when serving a web page. But in  cases like these, threads come in handy.<\/p>\n<p>My advice? Use Python or some other language that has threads to do do the job for you &#8211; you don&#8217;t have to do everything in PHP.<\/p>\n<h2>Turn on Error Reporting Immediately<\/h2>\n<p>David Cummings<\/p>\n<p>This is very important when developing the app &#8211; <a href=\"http:\/\/www.sitepoint.com\/article\/quick-php-tips\/\">error reporting lets you find future bugs<\/a>. Make sure they are on.<\/p>\n<p>And just as important is the fact that you should turn them off in the production system &#8211; you don&#8217;t want your users seeing your error messages.<\/p>\n<h2>Related Links<\/h2>\n<ul>\n<li><a href=\"http:\/\/nettuts.com\/html-css-techniques\/10-principles-of-the-css-masters\/\">10 Principles of CSS Masters<\/a><\/li>\n<li><a href=\"http:\/\/www.phpdeveloper.org\/news\/10989\">NETTUTS.com: 10 Principles of the PHP Masters<\/a><\/li>\n<li><a href=\"http:\/\/ifacethoughts.net\/2008\/09\/10\/principles-for-php-programming\/\">Principles For PHP Programming<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>My take on the recent &#8216;<a href=\"http:\/\/nettuts.com\/articles\/10-principles-of-the-php-masters\/\">10 Principles of the PHP Masters<\/a>&#8216; article. Bottom line &#8211; go read it &#8211; and decide which advices are good for you.<\/p>\n<\/div>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,30],"tags":[178,220,221,222],"class_list":["post-122","post","type-post","status-publish","format-standard","hentry","category-php","category-web-development","tag-master","tag-practice","tag-principle","tag-programming"],"_links":{"self":[{"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/posts\/122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/comments?post=122"}],"version-history":[{"count":0,"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/posts\/122\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/media?parent=122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/categories?post=122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bin-co.com\/blog\/wp-json\/wp\/v2\/tags?post=122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}