Design pattern: static function call with input/output containers?

Posted by Pavlo Dyban on Programmers See other posts from Programmers or by Pavlo Dyban
Published on 2013-11-05T15:21:40Z Indexed on 2013/11/05 16:10 UTC
Read the original article Hit count: 216

Filed under:

I work for a company in software research department. We use algorithms from our real software and wrap them so that we can use them for prototyping. Every time an algorithm interface changes, we need to adapt our wrappers respectively.

Recently all algorithms have been refactored in such a manner that instead of accepting many different inputs and returning outputs via referenced parameters, they now accept one input data container and one output data container (the latter is passed by reference). Algorithm interface is limited to a static function call like that:

class MyAlgorithm{
static bool calculate(MyAlgorithmInput input, MyAlgorithmOutput &output);
}

This is actually a very powerful design, though I have never seen it in a C++ programming environment before. Changes in the number of parameters and their data types are now encapsulated and they don't change the algorithm callback.

In the latest algorithm which I have developed I used the same scheme. Now I want to know if this is a popular design pattern and what it is called.

© Programmers or respective owner

Related posts about design-patterns