Re: Renderer or Writer?

From: Date: Fri, 26 Sep 2003 08:16:07 +0000
Subject: Re: Renderer or Writer?
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-22061@lists.php.net to get a copy of this message
Hi Wolfram, > But shouldnt "Query_Renderer" not be called "Query_Writer" since it > might also be able to have a method toFile() which writes the query to a > file, which is a writer in this case. Right? But it of course also > renders the query from the object presentation to a string (SQL). > Or shall "Query_Writer" be an extra package (besides "Query_Renderer"), > which writes queries to different destinations? > > i would be intersted in opinions, thanks The problem as I see it, is that with a toFile method, Query_Renderer goes beyond the scope of its class. A rendering file should simply transform one type of data to another (e.g. an SQL object representation to an SQL string), whereas a writing class should be limited to writing to streams or files. IMHO, the toFile method should be removed from Query_Renderer for the sake of clairty, and leave the file writing to another package. If this type of behaviour continues, PEAR is in danger of each class using its own implementation of a method where it should leave implementation to a dedicated class (e.g. File). Regards, David

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