Re: oo design question - how to avoid a factory

From: Date: Mon, 20 Dec 2004 17:34:54 +0000
Subject: Re: oo design question - how to avoid a factory
References: 1 2 3 4  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-35183@lists.php.net to get a copy of this message
On Mon, 20 Dec 2004 09:59:52 -0500, Andrew Nagy <andrew.nagy@villanova.edu> wrote: > Olivier Guilyardi wrote: > > > Now, there may be another solution, to keep bc : In the constructor, > > issue a warning like "Please use the factory...", and then act as > > a decorator to the real datagrid. This is very possible because the > > Structures_DataGrid class is currently an almost empty wrapper. > > Here is what I would like to do. I have implemented your diff that you > sent me, however instead of removing the datagrid from the constructor > of the render drivers I have left that in so that PHP5 users don't have > to use the factory method. > > How does this sound? I will check it into CVS for you to see > In other words, it will silently break on PHP4 if you use the constructor? And also, you have two different syntaxes for different PHP versions. Part of the argument above is that factories aren't hard to make users use....as long as you tell them that they have to use it. I guarantee that if you allow both users *are* going to use the 'new' method much more often than they should be. -- Justin Patrin

« previous php.pear.dev (#35183) next »