I've been thinking a lot about the weaknesses of static inheritance and polymorphism in most of the languages that people use. Often we need to write really complicated code to handle initialization of systems.
In PHP, on the other hand, there are really good tools like dynamic constructors $obj=new $SelectedObject($param); and PHP 5.3 introduces late static binding. I've been wondering if late static binding could be used to implement a Singleton or Multiton base class that other classes could inherit from. See the following article for a typical Multiton implementation in a static language: http://gen5.info/q/2008/07/25/the-multiton-design-pattern/ In the article I suggest that LSB could be used to do it better in PHP, but I haven't figured out exactly how. Any ideas? P.S. I think that the memory disadvantages of multitons would be less severe in PHP than they would be in other environments because of the short-lived nature of the PHP process.
_______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php