Input, Process, Output Pattern?
I am trying to create a class with the following generic methods: Input, Process, Output. The Process method is actually another abstract base class with a bunch of derived classes, all doing different processing. These Process classes will not change, nor are they expected to be derived further. The Input and Output methods have to customized and will be derived.
My current design is something like:
<pre>
class IO {
Stuff in(){}
void out( Stuff){}
}
class Process {
IO _io;
Process( IO io){ _io=io}
void doIt() {
Stuff s = _io.in();
do stuff;
_io.out( s);
}
}
</pre>
Is there another way to organize this?
Re: Input, Process, Output Pattern?
It's impossible to say anything about your code, we do not know the related classes structure nor what exactly do you want to do... Please post more info.
Re: Input, Process, Output Pattern?
I don't have code - I am designing. My pseudocode should look like:
Code:
class IO {
Stuff in(){}
void out( Stuff){}
}
class Process {
IO _io;
Process( IO io){ _io=io}
void doIt() {
Stuff s = _io.in();
do stuff;
_io.out( s);
}
}
I only have 2 base classes, IO and Process. IO is an abstract class that needs an 'in' and 'out' routine to get data into and out of the Process class. The Process class is a factory? class, that has different subclasses that all use the in/out methods, but process the data differently. The Process subclasses are known and final. The IO class implementations are derivable.