<?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, 18 May 2013 21:54:57 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Community News: Privates - Harmful or Useful? (Discussion)]]></title>
      <guid>http://www.phpdeveloper.org/news/18878</guid>
      <link>http://www.phpdeveloper.org/news/18878</link>
      <description><![CDATA[<p>
There's been a few articles posted on various blogs in the PHP community recently about the "most correct" usage of the "private" scope in your PHP applications. As with any feature of just about any language out there, there's people on both sides of the fence. Here's the ones that have weighed in so far:
</p>
<ul>
<li><i>Brandon Savage</i>'s <a href="http://www.brandonsavage.net/private-methods-considered-harmful/">initial post</a> (an excerpt from his upcoming "Do This, Not That" book)
<li>A <a href="http://blog.ircmaxell.com/2012/12/response-private-methods-considered.html">response to this</a> from <i>Anthony Ferrara</i>
<li><i>Brandon</I>'s <a href="http://www.brandonsavage.net/in-further-defense-of-avoiding-private-methods/">own response</a> to comments on his previous article
<li><a href="http://www.garfieldtech.com/blog/private-composition-inheritance">This new post</a> from <i>Larry Garfield</i> and some of his experience from the Drupal world
</ul>
<p>
Various topics come up during these posts including static coupling, using interfaces versus inheritance, wrapper classes and developer intent.
</p>]]></description>
      <pubDate>Wed, 12 Dec 2012 09:53:57 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Larry Garfield's Blog: readfile() not considered harmful]]></title>
      <guid>http://www.phpdeveloper.org/news/17909</guid>
      <link>http://www.phpdeveloper.org/news/17909</link>
      <description><![CDATA[<p>
In <a href="http://www.garfieldtech.com/blog/readfile-memory">this new post</a> to his blog <i>Larry Garfield</i> tries to dispel a common misconception in the PHP development world - that the <a href="http://php.net/readfile">readfile</a> function should be considered harmful and can cause memory issues in your code.
</p>
<blockquote>
If you're like me, you've probably read a dozen or two articles about PHP performance in your career. Many of them are quite good, but some are simply flat out wrong, or misinformed. One of the old truisms that has been repeated for as long as I can recall is "don't use readfile() if you have big files, because it reads the whole file into memory and your server will explode." [...] There's just one problem with that age-old truism: It's not true.
</blockquote>
<p>
He created some benchmarks to illustrate the differences between several of the common methods for working with files via the <a href="http://php.net/fread">fread</a>, <a href="http://php.net/fpassthru">fpassthru</a>, <a href="http://php.net/stream_copy_to_stream">stream_copy_to_stream</a> and of course <a href="http://php.net/readfile">readfile</a>. He reports the results based on the runtime and the peak memory usage and noted, ironically, that while the times varied slightly, the memory consumption was exactly the same for all of the approaches. Since there's no real reason not to use "readfile", he looks at three reasons why there might be this stigma attached to it (including the issues that could come up with output buffering enabled).
</p>]]></description>
      <pubDate>Fri, 04 May 2012 09:51:38 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Timothy Boronczyk's Blog: Spaghetti Code Considered Harmful]]></title>
      <guid>http://www.phpdeveloper.org/news/16367</guid>
      <link>http://www.phpdeveloper.org/news/16367</link>
      <description><![CDATA[<p>
<i>Timothy Boronczyk</i> has a new post to his blog proposing something that any veteran developer already knows - <a href="http://zaemis.blogspot.com/2011/05/spaghetti-code-considered-harmful.html">"spaghetti code" is harmful</a> to the health of your application. He's done a little research, though, and tried to explore what this "bad code" really is.
</p>
<blockquote>
The phrase "spaghetti code" is an all-too-common pejorative we programmers use to describe horrible code, whether it's difficult to understand, poorly organized, or just plain long-winded. And there-in lays the problem. What really constitutes spaghetti code is subjective; I've yet to hear a concrete definition or standard metric that measures it. [...] Everyone has his or her own opinion as to what aspects would make them label it spaghetti.
</blockquote>
<p>
Suggested definitions include: quickly written, non-standardized, beginner-level quality and any code that makes use of "goto". He suggests that applying the term to someone's code is less about the real quality of the code and more about social aspects of not wanting to upset the other developer over its quality.
</p>
<blockquote>
But besides negatively affecting others, our complaining about spaghetti code hurts ourselves too. It's easier to motivate ourselves when tasked with fixing a bug when we're not dreading having to trudge through spaghetti. When we label code as spaghetti code, we are actually creating roadblocks that hamper ourselves and artificially increase the difficulty of the task at hand.
</blockquote>]]></description>
      <pubDate>Fri, 20 May 2011 10:50:46 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Nay Pryce's Blog: "Dependency Injection" Considered Harmful]]></title>
      <guid>http://www.phpdeveloper.org/news/15712</guid>
      <link>http://www.phpdeveloper.org/news/15712</link>
      <description><![CDATA[<p>
While it's not PHP specific, <a href="http://www.natpryce.com/articles/000783.html">this recent article</a> from <i>Nat Pryce</i> talks about dependency injection and how the pattern could be considered harmful in the wrong (framework's) hands.
</p>
<blockquote>
There are two aspects to Dependency Injection. Firstly, an object's interface should define the services that the object requires as well as those it provides. Secondly, the code that satisfies the requirements of an object by giving it a reference to the services of is collaborators is external to both the object and its collaborators. [...] The name "Dependency Injection" only relates to the second aspect. And worse, makes it sound like dependencies are "injected" through the object's encapsulation boundary rather than explicitly defined as part of the object's API. 
</blockquote>
<p>
He gives an example from the <a href="http://www.growing-object-oriented-software.com/">GOOS</a> project where objects are independent and APIs are defined in such a way that any dependencies are clearly distinguished. "Code that composes objects is separate from the objects being composed".
</p>
<blockquote>
The end goal is to need less and less code to write more and more functionality as the system grows.
</blockquote>
<p>
Be sure to check out <a href="http://www.natpryce.com/articles/000783.html#comments">the comments</a> on the post for some other good opinions and suggestions regarding dependency injection and its use in frameworks.
</p>]]></description>
      <pubDate>Mon, 10 Jan 2011 12:05:59 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DZone.com: Meaningless docblocks considered harmful]]></title>
      <guid>http://www.phpdeveloper.org/news/15496</guid>
      <link>http://www.phpdeveloper.org/news/15496</link>
      <description><![CDATA[<p>
On DZone.com today <i>Giorgio Sironi</i> <a href="http://css.dzone.com/articles/meaningless-docblocks">warns against</a> something that you might not have considered before but could still be harmful to you and your code - meaningless docblock content that could be confusing.
</p>
<blockquote>
However, docblocks may become as evil as comments when they're not treated as first-class citizens. [...] Too often docblocks are generated and left there without any additional information. In other cases, they are filled mechanically with information that can already be inferred. In that case, you're not helping the programmers, which will have to maintain that docblock containing information duplicated from the method signature.
</blockquote>
<p>
He offers a few hints to follow to make sure you stay out of the bad docblock trap - don't repeat the code definition, don't repeat the logic of the method, not using the &lt;code> tag and using @throws correctly.
</p>]]></description>
      <pubDate>Fri, 26 Nov 2010 08:43:32 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[PHP in Action: How harmful is "harmful"?]]></title>
      <guid>http://www.phpdeveloper.org/news/11640</guid>
      <link>http://www.phpdeveloper.org/news/11640</link>
      <description><![CDATA[<p>
In reference to some comments made on the <a href="http://www.phpdeveloper.org/news/11622">previous post</a> ("Comments Considered Harmful") to the PHP in Action blog, there's a <a href="http://www.reiersol.com/blog/1_php_in_action/archive/175_how_harmful_is_harmful.html">new post</a> explaining and responding to some of the things said by visitors.
</p>
<blockquote>
Conflict is not a bad thing. That is, if it leads eventually towards clarity and understanding rather than confusion and misunderstanding.  [...] A debate about a technical matter may be conducted in parallel with an altercation that addresses the relationship between the participants. This is confusing in itself. Keeping these discussion apart will help maintain clarity. 
</blockquote>
<p>
Using this tact, he responds to the criticism made on the previous post, specifically one that points to <a href="http://meyerweb.com/eric/comment/chech.html">this article</a> as to why "considered harmful" articles should only be seen as fodder for argument and should be "considered harmful" themselves. 
</p>]]></description>
      <pubDate>Tue, 30 Dec 2008 10:22:47 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[PHP in Action: Comments Considered Harmful]]></title>
      <guid>http://www.phpdeveloper.org/news/11622</guid>
      <link>http://www.phpdeveloper.org/news/11622</link>
      <description><![CDATA[<p>
In <a href="http://www.reiersol.com/blog/1_php_in_action/archive/174_comments_considered_harmful.html">this new post</a> from the PHP in Action blog, they comment on <i>Eli White</i>'s <a href="http://phpadvent.org/2008/commenting-on-comments-by-eli-white">comments</a> on commenting.
</p>
<blockquote>
There is too much old advice in PHP. A recent case comes from the PHP Advent calendar. <a href="http://phpadvent.org/2008/commenting-on-comments-by-eli-white">Eli White</a> is a strong believer in commenting code, including inline comments inside functions. Unfortunately, he's at least 10 years too late. This used to be good advice, but not any more. Up to a point, he's right.
</blockquote>
<p>
They propose a better way - refactoring code so that its as easy to read as possible, reducing the need for extensive commenting. They illustrate with a rework from the <a href="http://framework.zend.com">Zend Framework</a> function, changing up the method names to better reflect the action inside (rather than the current "doUpdate").
</p>]]></description>
      <pubDate>Wed, 24 Dec 2008 13:41:38 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[PHP in Action: Public constructors considered harmful]]></title>
      <guid>http://www.phpdeveloper.org/news/10109</guid>
      <link>http://www.phpdeveloper.org/news/10109</link>
      <description><![CDATA[<p>
According to the PHP in Action blog, public constructors can be <a href="http://www.reiersol.com/blog/index.php?op=ViewArticle&articleId=34&blogId=1">hazardous to your (application's) health</a> and should be replaced.
</p>
<blockquote>
Everybody who writes object-oriented code knows about constructors. You need them so the program knows how to instantiate objects, right? And you especially need them when a lot of things have to be done while instantiating an object. [...] So why would I be skeptical of public constructors?
</blockquote>
<p>
The solution, as <a href="http://www.reiersol.com/blog/index.php?op=ViewArticle&articleId=34&blogId=1">he sees it</a>, is to make a "constructor" that's actually called statically with parameters that returns an instance of the class it's in as well as performing the action. He argues that this can help make the code much more readable for some types of method calls.
</p>]]></description>
      <pubDate>Mon, 05 May 2008 10:21:33 -0500</pubDate>
    </item>
  </channel>
</rss>
