C++ Design pattern

Hi Guys,

I am working on a task to write a data extractor from a database to a flat delimited file.
The trick is that the output format although is fixed (i.e. what columns I need) , it is subject to change in the future (as with any software system requirements :-) )

I can write a program and make the fields configurable via a input file or hold it in a table etc, but was wondering if there is any standard C++ design pattern that can address this situation.

I looked at MVC/Observer but looks like what I need is the reverse where my view can change, but my model remains the same.

Is Mediator pattern worth a shot?

Let me mention that my Model (i.e. Database / table / columns) are pretty stable. It is just that the output is subjected to change in the future.

Thanks in advance

I need is the reverse where my view can change, but my model remains the same.
Are you sure?
Yes, Atleast for now my output is the changeable component in the extract and my database table / columns are stable.

Where does "your output" get its information?
The output value will be from the database and whether to include the column in my output can be decided by say a config file.

What i would like is to change the config file to add a new column to output, but shouldn't need to change the program.


The config file is part of your model.
Either the strategy pattern http://sourcemaking.com/design_patterns/strategy

or the template method pattern http://sourcemaking.com/design_patterns/template_method

(or perhaps both a la streams, locales and facets) seem appropriate.
Topic archived. No new replies allowed.