<?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>Fri, 08 Aug 2008 16:12:16 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHPImpact Blog: Static Factories vs Public Constructors]]></title>
      <guid>http://www.phpdeveloper.org/news/10638</guid>
      <link>http://www.phpdeveloper.org/news/10638</link>
      <description><![CDATA[<p>
On the PHP::Impact blog <i>Federico Cargnelutti</i> has <a href="http://phpimpact.wordpress.com/2008/07/17/static-factories-vs-public-constructors/">posted a comparison</a> of using static factory methods to create an instance of a class versus making an object, calling the constructor.
</p>
<blockquote>
Normally, creating an instance of a class is done by calling new, which calls the constructor. Static factory provides a static method that returns an instance of the class. So, you are using static factory instead of the constructor. Providing a static factory method instead of a public constructor has both advantages and disadvantages.
</blockquote>
<p>
He includes some of the advantages of the factory method and others for the normal call to create an object. He also mentions some comments made by <i>Dagfinn Reiersol</i> in <a href="http://www.reiersol.com/blog/1_php_in_action/archive/34_public_constructors_considered_harmful.html">a blog post</a> about public constructors.
</p>]]></description>
      <pubDate>Fri, 18 Jul 2008 12:58:31 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Greg Beaver's Blog: PHP namespaces become much better (Derick take note)]]></title>
      <guid>http://www.phpdeveloper.org/news/10462</guid>
      <link>http://www.phpdeveloper.org/news/10462</link>
      <description><![CDATA[<p>
<i>Greg Beaver</i>, noting some issues that <i>Derick Rethans</i> had <a href="http://greg.chiaraquartet.net/exit.php?url_id=655&entry_id=193">pointed out</a> about namespace support for upcoming PHP versions, has <a href="http://greg.chiaraquartet.net/archives/193-PHP-namespaces-become-much-better-Derick-take-note.html">posted about</a> a patch he submitted to solve the problem simply.
</p>
<p>
The issue <i>Derick</i> pointed out:
</p>
<blockquote>
In PHP 5.3 this would alias the class Interval in the namespace PEAR::Date to the class Interval. For now, this code would work just fine. However, if PHP would introduce a class "Interval" at some point in the future (and PHP can do this as it <a href="http://greg.chiaraquartet.net/exit.php?url=aHR0cDovL3d3dy5waHAubmV0L21hbnVhbC9lbi91c2VybGFuZG5hbWluZy5ydWxlcy5waHA=&entry_id=193">owns the global namespace</a>) then the above code would suddenly stop working.
</blockquote>
<p>
<i>Greg</i>'s patch makes it possible to "override" the internal class if need be, making it so that code currently working wouldn't break. All it takes is to "use" is like you normally would and and the magic happens behind the scenes.
</p>]]></description>
      <pubDate>Mon, 23 Jun 2008 11:19:27 -0500</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>
    <item>
      <title><![CDATA[Tobias Ebnother's Blog: Leopard native apache with custom (64bit) PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/8959</guid>
      <link>http://www.phpdeveloper.org/news/8959</link>
      <description><![CDATA[<p>
<i>Christian Stocker</i> <a href="http://blog.liip.ch/archive/2007/11/01/leopard-native-apache-with-custom-64bit-php.html">points out</a> a blog post from <i>Tobias Ebnother</i> showing how to set up a <a href="http://gorn.ch/archive/2007/11/01/leopard-native-apache-with-custom-64bit-php.html">native apache</a> instance on Leopard (OS X) with a 64 bit PHP included.
</p>
<blockquote>
With massive! help from <a href="http://marc.freeflux.net/">Marc Ammann</a> I was able to build a PHP Binary that loads with the Leopard shipped Apache.
</blockquote>
<p>
<a href="http://gorn.ch/archive/2007/11/01/leopard-native-apache-with-custom-64bit-php.html">His method</a> replaces the standard iconv file with a custom built one (based on <a href="http://developer.apple.com/opensource/">this source</a>) prior to compiling. Then, in his configure, he sets certain flags, specifically the "arch x86_64" one, to get it to recognize the new setup.
</p>]]></description>
      <pubDate>Fri, 02 Nov 2007 07:58:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[AlternateInterior.com: Communicating with threads in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/7768</guid>
      <link>http://www.phpdeveloper.org/news/7768</link>
      <description><![CDATA[<p>
Continuing on from a <a href="http://www.phpdeveloper.org/news/7759">previous post</a> on multi-threading in PHP, <i>Brian Bosh</i> is back with <a href="http://www.alternateinterior.com/2007/05/communicating-with-threads-in-php.html">something a bit more developed</a> that will allow for communication between the threads as well.
</p>
<blockquote>
<p>
Earlier this week, I suggested PHP could be multithreaded. The sample I provided was very simple and at least one reader quickly wondered how to communicate with threads. If you haven't already, take a look at <a href="http://www.alternateinterior.com/2007/05/multi-threading-strategies-in-php.html">part 1</a> to get some basic information about threads in PHP.
</p>
<p>
It took a bit longer to get that part working that simple threads, but as of now, I have a functional prototype of an HVAC thread. 
</p>
</blockquote>
<p>
The post is broken up into <a href="http://www.alternateinterior.com/2007/05/communicating-with-threads-in-php.html">five different files</a> to make things work:
<ul>
<li>an overall class for the main functionality (their example of running the heater or AC)
<li>a class to create and set up a thread
<li>a "thready utility" class to handle the response from a thread
<li>a thread library to handle creation/interaction/etc
<li>the example file of the system in use
</ul>
Following the code, he gives <a href="http://www.alternateinterior.com/2007/05/communicating-with-threads-in-php.html">a nice explanation</a> of how things work and how they all fit together.
</p>]]></description>
      <pubDate>Thu, 03 May 2007 13:38:16 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Matthew Weir O'Phinney's Blog: Extending Singletons]]></title>
      <guid>http://www.phpdeveloper.org/news/7228</guid>
      <link>http://www.phpdeveloper.org/news/7228</link>
      <description><![CDATA[<p>
<i>Matthew Weir O'Phinney</i> <a href="http://weierophinney.net/matthew/archives/135-Extending-Singletons.html">wonders about singletons</a>. He wonders how he can make them more flexible than they even are by making entire custom singletons accessible later, after they've been created.
</p>
<blockquote>
This morning, I was wondering about how to extend a singleton class such that you could retrieve the new class when retrieving the singleton later. In particular, Zend_Controller_Front is a singleton, but what if I want to extend it later? A number of plugins in the Zend Framework, particularly view helpers and routing functionality, make use of the singleton; would I need to alter all of these later so I could make use of the new subclass?
</blockquote>
<p>
He gives two code examples to illustrate his point - one that uses the current Zend_Controller_Front implementation to extend an instance and the other with a slightly modified version to do the same. The change is in the declaration of the $_instance value. By making it protected, the differently extended instance will be created. With the normal setting (private) you'll only ever get back the same default Zend_Controller_Front instance.
</p>
<p>
Check out <a href="http://weierophinney.net/matthew/archives/135-Extending-Singletons.html#comments">the comments</a> for some other suggestions as well.
</p>]]></description>
      <pubDate>Tue, 06 Feb 2007 09:27:00 -0600</pubDate>
    </item>
  </channel>
</rss>
