[Biophp-dev] The humunguous IO class etc
Nico Stuurman
biophp-dev@bioinformatics.org
Mon, 28 Apr 2003 11:57:28 -0700
I have to let this sink in a bit before I make up my mind, but - in
general - I do not think it is a good idea to try to do everything with
a single class/function. Better to chop is up in small manageable
pieces that can be reused elsewhere.
> I've also attached a code snippet from GenePHP 2.0's IO
> class, in which the "parser class" you were mentioning
> earlier are its methods. The general idea here is that
>
That will break the code (it is a class, not a function). It could be
a subclass though.
> people only use ONE AND ONLY ONE class to read/write
> data from WHATEVER SOURCE (console, variable, file, SQL
> DB, etc.) to WHATEVER DESTINATION.
I would keep the read and write routines separate. What use is it to
have to pass a 'r' or 'w' as an argument, if you could just name the
function/class accordingly? Or, I'd prefer:
IOseq_read($whatever) // this is a better name than 'parse'
and
IOseq_write ($whatever) returns //
over:
IOseq($whatever,'w') and IOseq($whatever,'r')
The reason is that the objects returned when doing writing or reading
are going to be quite different (an IO_seq_read and IO_seq_write object
will not share much in functionality).
If they need to be merged it could be:
IOseq->read($whatever)
and
IOseq->write($whatever)
Best,
Nico