On 04/02/2009, Jakob Westhoff <ja...@westhoffswelt.de> wrote: > >> $p = new ezcSystemProcess( 'foobar' ); > >> $p->workingDirectory( 'my/directory' ) > >> ->environment( 'MY_ENVIRONMENT_VARIABLE', '42' ) > >> ->environment( 'MY_OTHER_ENVIRONMENT_VARIABLE', '23' ) > >> ->redirect( ezcSystemProcess::STDERR, ezcSystemProcess::STDOUT ) > >> ->redirect( ezcSystemProcess::STDOUT, '/tmp/some/file') > >> ->argument( '--first-option' ) > >> ->argument( '--second-option-with-a-value' ) > >> ->argument( $someValue ) > >> ->pipe( $anotherSystemProcess ) > >> ->execute(); > > To me this reads like the environment has a redirect and that the > > argument has a pipe etc. How is the above an improvement over the > > classical interface: > > $cmd = array( 'foobar', '--first-option', > > '-second-option-with-a-value', $someValue ); > > $p = new ezcSystemProcess(); > > $p->workingDirectory = 'my/directory': > > $p->addEnvironment( 'MY_ENVIRONMENT_VARIABLE', '42' ) > > $p->addEnvironment( 'MY_OTHER_ENVIRONMENT_VARIABLE', '23' ) > > $p->addRedirect( ezcSystemProcess::STDERR, ezcSystemProcess::STDOUT ) > > $p->addRedirect( ezcSystemProcess::STDOUT, '/tmp/some/file') > > $p->addPipe( $anotherSystemProcess ) > > $p->execute( $cmd ); > > > > I think the latter more clearly describes the relation between the > > options and the process. > > > As far as I am concerned the fluent interface provides the way to create > the command both ways. As you are not forced to use it, but have the > chance to do so. Yes, you have created a new way to create commands. But why? If it doesn't provide any benefits over a normal interface what is the point? I understand that you could use the fluent interface in the old fashioned way also. But providing both just adds to the complexity which makes it harder for people to use. > Moreover it would be more consistent with the database > abstraction component. I don't see why you would want to be consistent with the database abstraction component. It solves a completely different problem which is a lot more complex. The two components are not related in any way.
> > Thats a problem, which may be solved using the way I described in my > other response to the idea of trying to reuse the database abstraction > api. (Message-ID: <4989b633.6090...@westhoffswelt.de>) I think that is to overcomplicate the solution quite drastically. Keep it simple. Frederik -- Components mailing list Components@lists.ez.no http://lists.ez.no/mailman/listinfo/components