<?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>Sat, 25 May 2013 14:30:01 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Debuggable Blog: Code Insults Round 1 - Why switch blocks are dumb]]></title>
      <guid>http://www.phpdeveloper.org/news/11305</guid>
      <link>http://www.phpdeveloper.org/news/11305</link>
      <description><![CDATA[<p>
In the first of his "<a href="http://debuggable.com/posts/i-will-insult-your-code!:48ac91d1-ca78-4e95-ad66-1e854834cda3">I will insult your code</a>" series, <i>Nate Abele</i> looks at <a href="http://debuggable.com/posts/code-insults-round-1---why-switch-blocks-are-dumb:4901d363-d210-482c-9794-65bd4834cda3">this submitted code</a> and points out that maybe blocks of switch/case statements aren't such a good idea after all.
</p> 
<blockquote>
The entire submission is actually two files, which together comprise a console script for interacting with a web service (the names of the entrants have been withheld to protect the identities of the guilty). Rather than examine the full entry, we're going to take a look at one part which I find comes up fairly often: switch block overkill.
</blockquote>
<p>
The example he's talking about has a switch statement with eight different cases under it, most of them just setting two properties on the current class. Its used ot map command line parameters to their correct properties. <i>Nate</i> suggests a bit different method - still using switch/case but pulling the properties to be assigned from an array of options rather than hard-coding them into the evaluation.
</p>]]></description>
      <pubDate>Wed, 29 Oct 2008 08:48:28 -0500</pubDate>
    </item>
  </channel>
</rss>
