<?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>Thu, 04 Dec 2008 13:18:41 -0600</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Debuggable Blog: Programming Psychology II: Private methods ]]></title>
      <guid>http://www.phpdeveloper.org/news/10560</guid>
      <link>http://www.phpdeveloper.org/news/10560</link>
      <description><![CDATA[<p>
According to <i>Felix Geisendorfer</i>'s <a href="http://www.debuggable.com/posts/programming-psychology-ii-private-methods:481ed862-b0d8-4a0e-9247-165c4834cda3">newest post</a> on the Debuggable blog, he thinks that "private and protected methods and properties are one of the most stupid concepts of OOP."
</p>
<blockquote>
This is a thought I first shared at <a href="http://debuggable.com/posts/cakefest-orlando-2008-summary:480f4dd6-6404-4774-a771-4e8fcbdd56cb">CakeFest Orlando</a> this year, but could not explain properly at the time.
</blockquote>
<p>
He illustrates with an example of a protected "balance" variable in a BankAccount class. Sure, it's marked as private but less skilled programmers might not use it that way. He recommends a method without the getters/setters to help make the usage of the variable a bit simpler. He also suggests that using protected/private scoping helps to promote "crappy code" - using them to provide a sort of protection for code that you either don't want getting used or hiding it away so the API can't get at it.
</p>]]></description>
      <pubDate>Tue, 08 Jul 2008 08:44:58 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Brian Moon's Blog: Stupid PHP Tricks: Normalizing SimpleXML Data]]></title>
      <guid>http://www.phpdeveloper.org/news/10328</guid>
      <link>http://www.phpdeveloper.org/news/10328</link>
      <description><![CDATA[<p>
<i>Brian Moon</i> has a "stupid PHP trick" posted to his blog today - <a href="http://brian.moonspot.net/2008/06/03/stupid-php-tricks-normalizing-simplexml-data/">normalizing SimpleXML data</a> you've pulled in from just about any external source.
</p>
<blockquote>
Anyhow, one annoying thing about SimpleXML has to do with caching.  When using web services, we often cache the contents we get back.  We were having a problem where we would get an error about a SimpleXML node not existing.
</blockquote>
<p>
They were using memcache to store the information but came across problems when their code tried to use a (sometimes) empty tag. He gives two solutions - one using a recursive function that identifies the empty items and the other that encodes then decodes the object to and from JSON, keeping the values intact.
</p>]]></description>
      <pubDate>Tue, 03 Jun 2008 09:34:22 -0500</pubDate>
    </item>
  </channel>
</rss>
