<?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>Tue, 18 Jun 2013 00:09:12 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHPMaster.com: Practical Refactoring, Part 1 - What is Good Code?]]></title>
      <guid>http://www.phpdeveloper.org/news/18597</guid>
      <link>http://www.phpdeveloper.org/news/18597</link>
      <description><![CDATA[<p>
On PHPMaster.com they've started up a new series focused on refactoring code to make your applications not only easier to maintain but easier to expand on in the future. In <a href="http://phpmaster.com/practical-refactoring-1/">this first part</a> they focus on what the term "good code" really means.
</p>
<blockquote>
The main goal of refactoring is clean code, better code, or whatever you might call it. But what actually constitutes good code? Good code is smelled and tasted. If you've written a lot of code, you understand what I mean; you can easily identify whether code is good or bad with experience. But what if you are new to coding but still want to do things right? We can summarize the aspects of good code with these three guidelines: Readable, Extensible and Efficient
</blockquote>
<p>
He goes on to explain each of these three guidelines with descriptions of what they are and what they mean to you as a developer. In the next part of the series, he'll take these three ideas and apply them to code, showing some of the most common points where they can be applied to clean things up.
</p>]]></description>
      <pubDate>Fri, 12 Oct 2012 11:15:26 -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[Patrick Allaert's Blog: Readable PHP code #2 - Make your API handle more!]]></title>
      <guid>http://www.phpdeveloper.org/news/14572</guid>
      <link>http://www.phpdeveloper.org/news/14572</link>
      <description><![CDATA[<p>
In a new post today <i>Patrick Allaert</i> has continued his "Readable Code" series with some tips on how you can make your <a href="http://patrickallaert.blogspot.com/2010/05/readable-php-code-2-make-your-api.html">API handle more</a>.
</p>
<p>
His suggestions include:
</p>
<ul>
<li>Changing the handling to look for multiples by default
<li>Avoiding inner looping (repeated looping) and try for code reuse
<li>Transforming a scalar value into an array to make it easier to handle this way (by casting)
<li>and how to handle objects in the same array-handling kind of code
</ul>
<p>
He also tosses in a little mention of performance, noting that a call with <a href="http://php.net/range">range</a> in the argument to his array-handling method is faster than looping over the same range and calling the method each time.
</p>]]></description>
      <pubDate>Fri, 28 May 2010 08:41:22 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[NETTUTS.com: Top 15+ Best Practices for Writing Super Readable Code]]></title>
      <guid>http://www.phpdeveloper.org/news/13644</guid>
      <link>http://www.phpdeveloper.org/news/13644</link>
      <description><![CDATA[<p>
On NETTUTS.com today <i>Burak Guzel</i> has <A href="http://net.tutsplus.com/tutorials/html-css-techniques/top-15-best-practices-for-writing-super-readable-code">written up some good tips</a> on how to make your code much more readable (and easier to maintain in the future. Not all of them are directly PHP related, but they are general enough to be applied in other places in your development.
</p>
<blockquote>
Code readability is a universal subject in the world of computer programming. It's one of the first things we learn as developers. Readable and maintainable code is something to be proud of in a finished product. We can share it with others, contribute to other projects, and reuse code from applications we wrote months or even years ago.
</blockquote>
<p>Tips included in the list cover topics like:</p>
<ul>
<li>comments & documentation
<li>code grouping
<li>avoiding deep nesting
<li>using consistent temporary names
<li>using object-oriented code versus procedural
<li>effective refactoring
</ul>]]></description>
      <pubDate>Wed, 09 Dec 2009 07:50:51 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Shawn Straton's Blog: Code Readability Part 2, Code Structure]]></title>
      <guid>http://www.phpdeveloper.org/news/11767</guid>
      <link>http://www.phpdeveloper.org/news/11767</link>
      <description><![CDATA[<p>
<i>Shawn Straton</i> has <a href="http://www.shawnstratton.info/code-readability-part-2-code-structure">posted the second part</a> of his look at code readability today. This time the focus is on the structure of the code - file structure, code layout, etc.
</p>
<blockquote>
I've had the pleasure of
maintaining a legacy application developed by people who were past
deadline the second they had their assignment handed to them in the
past and it can get really interesting rather quickly when you see
how sloppy you can get when you are in such a hurry. Here are some
guidelines I've given myself to ensure that the structure is correct
at the end of the day.
</blockquote>
<p>Some of his suggestions include:</p>
<ul>
<li>Breaking larger files apart into smaller, easier to maintain pieces
<li>Correctly naming functions/variables/etc 
<li>Tabbing/spacing in to indent code blocks
<li>Input validation and error checking should always be included
</ul>]]></description>
      <pubDate>Mon, 19 Jan 2009 12:59:41 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[SocialGeek.be: Clean urls through readable slugs in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/11685</guid>
      <link>http://www.phpdeveloper.org/news/11685</link>
      <description><![CDATA[<p>
On the SocialGeek blog there's a <a href="http://www.socialgeek.be/blog/read/clean-urls-through-readable-slugs-in-php">recent post</a> that looks at making stubs for your URLs, making them easier to read and remember.
</p>
<blockquote>
This is where the fun begins of course. How many times have you been confronted with someone sending you an indecipherable, thus untrustworthy link? Right, so we agree that for a user, it is important to have a clean URL that is readable and includes the title of the page or (at least) some description related to the content. Slug time! 
</blockquote>
<p>
They explain what slugs are (and how they're useful for users) as well as how to convert a title into a "slugged" string by replacing anything that's not an A-Z or 0-9 character to remove the less URL friendly characters.
</p>]]></description>
      <pubDate>Tue, 06 Jan 2009 14:28:16 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[PHP in Action: More beautiful code]]></title>
      <guid>http://www.phpdeveloper.org/news/11376</guid>
      <link>http://www.phpdeveloper.org/news/11376</link>
      <description><![CDATA[<p>
Continuing on from a previous post, the PHP in Action blog <a href="http://www.reiersol.com/blog/1_php_in_action/archive/169_more_beautiful_code.html">takes another look</a> at their suggestions on "beautiful code" with some responses to the <A href="http://www.reiersol.com/blog/1_php_in_action/archive/168_beautiful_code.html">previous post</a>.
</p>
<blockquote>
I got some interesting comments to my previous post on "beautiful code". Some were pretty strong disagreements. So am I wrong? Did I get carried away? Did my critical faculty go on vacation somewhere nice and sunny? [...] My main point is that it's close to plain English. Not everyone agrees that that's a good thing, but I argue that we're built (genetically wired, in fact) to understand natural languages, not program code.
</blockquote>
<p>
He reasons that code should be easier to understand than just a bunch of random functions and parameters jumbled together. He thinks that it should read more like a human could understand rather than just the machine. With function names like "assertThat" and "hasSelect", it does make it easier to follow.
</p>]]></description>
      <pubDate>Mon, 10 Nov 2008 10:25:34 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Patrick Allaert's Blog: Readable PHP code #1 - Return ASAP]]></title>
      <guid>http://www.phpdeveloper.org/news/11207</guid>
      <link>http://www.phpdeveloper.org/news/11207</link>
      <description><![CDATA[<p>
<i>Patrick Allaert</i> has made <a href="http://patrickallaert.blogspot.com/2008/10/readable-php-code-1-return-asap.html">this recent post</a> to his blog looking at something that a large group of PHP developers seem to forget about - readable PHP code. Specifically, he mentions the "return as soon as possible" mentality.
</p>
<blockquote>
This is the first article of a series I will dedicate to tips to write PHP code that is easier to maintain, review, refactor,... These tips may be applied for other languages but are mainly focused on PHP. The first one could be entitled as "return as soon as possible.
</blockquote>
<p>
He compares a code example - simplifying multiple if/elses, replacing the need for multiple nested evaluations that make the code harder to read. Check out the <a href="http://1.bp.blogspot.com/_BZvUGkpgaiM/SPOF3_AMj6I/AAAAAAAAAFA/DnQqgY_cqlA/s1600-h/diff_2.png">before</a> and <a href="http://2.bp.blogspot.com/_BZvUGkpgaiM/SPOF0mCy3II/AAAAAAAAAE4/9HpsPgnA4NE/s1600-h/diff_1.png">after</a> to see how it helps the flow.
</p>]]></description>
      <pubDate>Tue, 14 Oct 2008 11:14:42 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[David Otton's Blog: Neat PHP tricks: Casting Arrays to Objects]]></title>
      <guid>http://www.phpdeveloper.org/news/10834</guid>
      <link>http://www.phpdeveloper.org/news/10834</link>
      <description><![CDATA[<p>
<i>David Otton</i> has a <a href="http://www.otton.org/2008/08/14/neat-php-tricks-casting-arrays-to-objects/">handy little tip</a> if you're looking for a cleaner way to deal with array data - casting it to an object.
</p>
<blockquote>
Array notation is fine, but it can look a bit clunky when you're working with complex structures. [...] Casting the array to an object allows us to use object notation (->) and makes the code more readable.
</blockquote>
<p>
He includes examples of the casting, showing the difference between the array and object notations including a method for creating an object based on a simple array that has basic properties built in. This sort of transformation can be useful if you want consistency through out the application - just passing objects with their properties rather than arrays.
</p>]]></description>
      <pubDate>Thu, 14 Aug 2008 13:38:10 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Stefan Koopmanschap's Blog: Tip: use clearly readable variable names, and constants!]]></title>
      <guid>http://www.phpdeveloper.org/news/9180</guid>
      <link>http://www.phpdeveloper.org/news/9180</link>
      <description><![CDATA[<p>
<i>Stefan Koopmanschap</i> has <a href="http://www.leftontheweb.com/message/Tip_use_clearly_readable_variable_names_and_constants">a good reminder</a> for developers out there in a new post to his blog - make your code much easier to understand via readable variable names and constants.
</p>
<blockquote>
Yes, you know what code you write and you also know how it works. You can find your way around it. But what if you haven't touched a piece of code for months or even years. Or what if someone else needs to work with your code. Prevent a hell: use clearly readable variable names and constants.
</blockquote>
<p>
He points out an example of what not to do - a specific line from the FUDForum code with multiple variables named with a single letter of the alphabet in a complex if() evaluation. He suggests even using "namespacing" of sorts (PHP6 here we come!) to help compartmentalize your variables to make things even easier.
</p>]]></description>
      <pubDate>Wed, 05 Dec 2007 12:05:00 -0600</pubDate>
    </item>
  </channel>
</rss>
