<?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, 08 Jul 2008 23:16:24 -0500</pubDate>
    <ttl>30</ttl>
    <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>
