Input, Process, Output Pattern?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Input, Process, Output Pattern?

  1. #1
    Join Date
    Jul 2009
    Posts
    2

    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?

  2. #2
    Join Date
    Jul 2005
    Location
    Currently in Mexico City
    Posts
    568

    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.
    Wanna install linux on a vacuum cleaner. Could anyone tell me which distro sucks better?

    I had a nightmare last night. I was dreaming that Iím 64-bit and my blanket is 32-bit and I couldnít cover myself with it, so Iíve spent the whole night freezing. And in the morning I find that my blanket just had fallen off the bed. =S (from: bash.org.ru)

    //always looking for job opportunities in AU/NZ/US/CA/Europe :P
    willCodeForFood(Arrays.asList("Java","PHP","C++","bash","Assembler","XML","XHTML","CSS","JS","PL/SQL"));

    USE [code] TAGS! Read this FAQ if you are new here. If this post was helpful, please rate it!

  3. #3
    Join Date
    Jul 2009
    Posts
    2

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center