<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Sun, 26 May 2013 00:27:48 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Bob Majdak: Extending an Iterator to use an Iterator to make your code a little cleaner]]></title>
      <guid>http://www.phpdeveloper.org/news/19300</guid>
      <link>http://www.phpdeveloper.org/news/19300</link>
      <description><![CDATA[<p>
In <a href="http://catch404.net/2013/03/extending-an-iterator-to-use-an-iterator-to-make-your-code-a-little-cleaner/">this new post</a> to his site <i>Bob Majdak</i> talks about extending iterators to help make it easier to customize it for your needs.
</p>
<blockquote>
One of the nice things about iterators is the ability to shove them into other iterators, allowing you to wrap their functionality in other functionality to return a more precise result set. Take for example the idea that we want to read a directory to list only the images inside of it. There are two main ways to do this, via <a href="http://www.php.net/opendir>opendir</a> / <a href="http://www.php.net/readdir">readdir</a> functions and via <a href="http://www.php.net/FilesystemIterator">FilesystemIterator</a> objects. Going the FilesystemIterator route, one common way seems to be extend another class called <a href="http://www.php.net/FilterIterator">FilterIterator</a> which allows you to customize a filter based on you overwriting a method called accept().
</blockquote>
<p>
He shows not only overriding the "accept" method, but also the constructor to make using this new iterator a much simpler (and cleaner) call. You can find out more about the FilesystemIterator (and others) over in <a href="http://www.php.net/manual/en/spl.iterators.php">the Iterators section</a> of the PHP manual.
</p>]]></description>
      <pubDate>Tue, 12 Mar 2013 09:25:04 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Adam Culp: Clean Development Series: Part 4, Rewrite dilemma]]></title>
      <guid>http://www.phpdeveloper.org/news/18729</guid>
      <link>http://www.phpdeveloper.org/news/18729</link>
      <description><![CDATA[<p>
<i>Adam Culp</i> has published the <a href="http://www.geekyboy.com/archives/547">fourth part</a> of his "Clean Code" series to his site today (see more about parts 1-3 <a href="http://phpdeveloper.org/news/18704">here</a>) with a look at the "Rewrite Dilema" - whether it's more productive to just rewrite or to try to refactor.
</p>
<blockquote>
Unfortunately the first reaction to a poorly written application is usually a resounding "rewrite".  Developers feel like a weight is lifted from their shoulders, as the manager hears a distant "cha-ching" sounds of money slipping away. [...] In the managers mind a rewrite means it must all be duplicated, and that's not far from the truth when we consider the salaries of an entire development team for the time it will take to rewrite the entire application.
</blockquote>
<p>
<i>Adam</i> talks about some of his experience in the past with challenging applications and a typical scenario where one group in the company splits off and creates the new version while another maintains the old. He suggests, however, that refactoring may be a more viable option. While it might not seem easier to handle overall, the end results could lead to a more stable system and could take less time than starting from scratch.
</p>]]></description>
      <pubDate>Mon, 12 Nov 2012 10:28:30 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Oscar Merida: Smelly PHP code]]></title>
      <guid>http://www.phpdeveloper.org/news/18720</guid>
      <link>http://www.phpdeveloper.org/news/18720</link>
      <description><![CDATA[<p>
<i>Oscar Merida</i> has written up a <a href="http://oscarm.org/2012/11/smelly-php-code">sort of continuation</a> to <a href="http://phpdeveloper.org/news/18704">this series</a> from <i>Adam Culp</i> about clean code, one that shares more tips on knowing when to refctor.
</p>
<blockquote>
Adam Culp posted the 3rd article in his Clean Development Series this week, <a href="http://www.geekyboy.com/archives/494">Dirty Code (how to spot/smell it)</a>. When you read it, you should keep in mind that he is pointing out practices which correlate with poorly written code not prescribing a list of things to avoid. It's a good list of things to look for and engendered quite a discussion in our internal <a href="http://musketeers.me/">Musketeers</a> IRC.
</blockquote>
<p>
His suggestions include things like "Comments are valuable", "Using switch statements" and a few other smaller ones involving error suppression, globals and prepared statements in database usage.
</p>]]></description>
      <pubDate>Fri, 09 Nov 2012 09:21:57 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Adam Culp: Clean Development Series (Parts 1, 2 & 3)]]></title>
      <guid>http://www.phpdeveloper.org/news/18704</guid>
      <link>http://www.phpdeveloper.org/news/18704</link>
      <description><![CDATA[<p>
<i>Adam Culp</i> has posted a three part series to his blog with some guidance about how to create "clean code" in your application development:
</p>
<blockquote>
Whether we're experienced developers or newcomers, we've all seen code that could/should have been done better.  Many times it's even code we ourselves wrote and revisited later for one reason or another.  I, for one, have seen my share of code written by a "past me" and wondered what on earth I was thinking when I wrote that.  Of course there has also been times when I was hired to fix another developers code, and it can be scary also.
</blockquote>
<p>There's three posts in the series:</p>
<ul>
<li><a href="http://www.geekyboy.com/archives/459">Part 1, Dirty Code (cause/effect)</a>
<li><a href="http://www.geekyboy.com/archives/479">Part 2, Dirty Code (why we do it)</a>
<li><a href="http://www.geekyboy.com/archives/494">Part 3, Dirty Code (how to spot/smell it)</a>
</ul>]]></description>
      <pubDate>Tue, 06 Nov 2012 11:26:26 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Laravel: Is It Really Clean and Classy?]]></title>
      <guid>http://www.phpdeveloper.org/news/18334</guid>
      <link>http://www.phpdeveloper.org/news/18334</link>
      <description><![CDATA[<p>
PHPMaster.com has a new tutorial in their series about the <a href="http://laravel.com">Laravel</a> framework posted today asking if the framework is really <a href="http://phpmaster.com/laravel-really-clean-and-classy/">"clean and classy"</a> as its documentation describes.
</p>
<blockquote>
"Laravel is a clean and classy framework for PHP web development. Freeing you from spaghetti code, Laravel helps you create wonderful applications using simple, expressive syntax. Development should be a creative experience that you enjoy, not something that is painful. Enjoy the fresh air." That's the text which can be found on the Laravel homepage and, if we'd believe it, wouldn't it be wonderful? Let's test this claim by building a simple TODO application and see how much effort we have to put into it.
</blockquote>
<p>
The article is pretty high-level and only touches on some of the key features like migrations (to create the database) and making the controller, model and view for the basic TODO app.
</p>]]></description>
      <pubDate>Wed, 08 Aug 2012 12:34:18 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Ibuildings techPortal: DPC Radio: Clean PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17718</guid>
      <link>http://www.phpdeveloper.org/news/17718</link>
      <description><![CDATA[<p>
On the Ibuildings techPortal today they've published the latest in their DPC Radio podcast series, sessions as recorded at the 2011 edition of the <a href="http://phpconference.nl">Dutch PHP Conference</a>. In <a href="http://techportal.ibuildings.com/2012/03/22/dpc-radio-clean-php/">this latest episode</a> <i>Sebastian Bergmann</i> talks about "Clean PHP".
</p>
<blockquote>
Even bad code can function. But if code isn't clean, it can bring a development organization to its knees. Every year, countless hours and significant resources are lost because of poorly written code. But it doesn't have to be that way. In this session you will learn how you can offset your technical debt with clean code that is readable and testable as well as reusable.
</blockquote>
<p>
You can listen to this latest session either using the <a href="http://techportal.ibuildings.com/2012/03/22/dpc-radio-clean-php/">in-page player</a> or by <a href="http://dpcradio.s3.amazonaws.com/2011_003.mp3">downloading the mp3 directly</a>. The slides (for a similar version of the presentation) can be found <a href="http://www.slideshare.net/sebastian_bergmann/clean-php-confoo-2011">on Slideshare</a>.
</p>]]></description>
      <pubDate>Thu, 22 Mar 2012 14:37:05 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Rafael Dohms' Blog: Book Review: The Art of Readable Code]]></title>
      <guid>http://www.phpdeveloper.org/news/17604</guid>
      <link>http://www.phpdeveloper.org/news/17604</link>
      <description><![CDATA[<p>
<i>Rafael Dohms</i> has posted <a href="http://blog.doh.ms/2012/02/27/book-review-art-of-readable-code/">a new review of a book</a> that focuses on helping you create better, more readable code - "The Art of Readable Code" (<i>Dustin Boswell</i>, <i>Trevor Foucher</i>, O'Reilly). This is isn't about "pretty code" as much as it is manageable, easy to follow structures and logic flows.
</p>
<blockquote>
"The Art of Readable Code" was written by Dustin Bowell and Trevor Foucher and basically focuses on concepts and suggestions to make you code not just readable, but comprehendible by other developers, or as the author's suggest, yourself in six months. Code readability is a topic that I truly believe the PHP community does not focus enough on and i really wanted a look at this book to see what kind of ideas it had and what I could do my best to bring to the attention of other developers.
</blockquote>
<p>
The book is language-agnostic and provides ideas that developers should keep in mind when doing their development - clear variable names, making comments that make sense, refactoring tips and hints for implementing your ideas in code. He recommends the book to any developer (in any language) to help them make code that will stand the test of time and be easier to manage/understand in the future.
</p>]]></description>
      <pubDate>Wed, 29 Feb 2012 10:41:12 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DZone.com: Writing clean code in PHP 5.4]]></title>
      <guid>http://www.phpdeveloper.org/news/17579</guid>
      <link>http://www.phpdeveloper.org/news/17579</link>
      <description><![CDATA[<p>
With the first stable release of PHP 5.4 not too far off, it's important to understand the new features it offers and how to use them effectively. In <a href="http://css.dzone.com/articles/writing-clean-code-php-54">this new post</a> to DZone.com <i>Giorgio Sironi</i> shows how to "write clean code" with these new features, including a few snippets of code to illustrate.
</p>
<blockquote>
After seven release candidates, it's clear PHP 5.4 is coming: as always the improvements from the previous minor version are many. [...] Let's look at the new features and score them on two metrics: usefulness, and potential for abuse. I'll try to avoid discussing non-language related matters.
</blockquote>
<p>
He starts by pointing out some of the "gotchas" that can happen with traits (like errors thrown when more than one method is named the same and that they are a separate hierarchy), the short syntax and dereferencing support for arrays, closure binding, upload progress and more. For each of them he gives two measurements - the usefulness of the feature and the potential for abuse.
</p>]]></description>
      <pubDate>Thu, 23 Feb 2012 12:08:18 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Perforce Software: Seven Pillars of Pretty Code]]></title>
      <guid>http://www.phpdeveloper.org/news/14403</guid>
      <link>http://www.phpdeveloper.org/news/14403</link>
      <description><![CDATA[<p>
As linked to <a href="http://paul-m-jones.com/archives/1324">by Paul Jones</a> there's an interesting whitepaper that's been published by Perforce Software about what they see as the <a href="http://www.perforce.com/perforce/papers/prettycode.html">Seven Pillars of Pretty Code</a>.
</p>
<blockquote>
The essence of pretty code is that one can infer much about the code's structure from a glance, without completely reading it. I call this "visual parsing": discerning the flow and relative importance of code from its shape. Engineering such code requires a certain amount of artifice to transform otherwise working code into working, readable code, making the extra step to leave visual cues for the user, not the compiler.
</blockquote>
<p>
The goal of these recommendations isn't to help you structure your code better or to optimize it for the best performance. The goal is to make code that is easy to follow and simpler to read for both the experienced developers and those just coming in.
</p>
<p>
Their suggestions include making the code blend in, keeping the code "untangled", including plenty of comments and reducing clutter overall.
</p>]]></description>
      <pubDate>Fri, 23 Apr 2010 12:08:43 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Francois Zaninotto's Blog: Introducing Code Usability]]></title>
      <guid>http://www.phpdeveloper.org/news/12460</guid>
      <link>http://www.phpdeveloper.org/news/12460</link>
      <description><![CDATA[<p>
<i>Francois Zaninotto</i> has <a href="http://totalusability.posterous.com/introducing-code-usability">a recent post</a> looking at something every developer should consider when creating their applications - especially the libraries that might be used by other developers: code usability.
</p>
<blockquote>
Usability guidelines can sometimes be of use in awkward places. I try to apply them to source code. [...] Of course, coding guidelines are there to make the code easy to read by everyone. But code usability goes somehow beyond. Let's see some of the differences.
</blockquote>
<p>He compares good versus bad code in a few different areas:</p>
<ul>
<li>Bad Code Comments
<li>Split Up Code
<li>Cleanliness
<li>New Conventions
<li>Listen To User Feedback
</ul>
<p>
Each item is described, some including code examples to help make them more clear. Be sure to check out <a href="http://totalusability.posterous.com/introducing-code-usability#comments">the comments</a> for more good suggestions.
</p>]]></description>
      <pubDate>Tue, 05 May 2009 13:48:19 -0500</pubDate>
    </item>
  </channel>
</rss>
