Seeking suggestions on redesigning the interface

Posted by ratkok on Stack Overflow See other posts from Stack Overflow or by ratkok
Published on 2010-06-03T14:58:31Z Indexed on 2010/06/03 17:04 UTC
Read the original article Hit count: 225

As a part of maintaining large piece of legacy code, we need to change part of the design mainly to make it more testable (unit testing). One of the issues we need to resolve is the existing interface between components. The interface between two components is a class that contains static methods only.

Simplified example:

class ABInterface {

    static methodA();
    static methodB();
    ...
    static methodZ();
};

The interface is used by component A so that different methods can use ABInterface::methodA() in order to prepare some input data and then invoke appropriate functions within component B.

Now we are trying to redesign this interface for various reasons:

  • Extending our unit test coverage - we need to resolve this dependency between the components and stubs/mocks are to be introduced

  • The interface between these components diverged from the original design (ie. a lots of newer functions, used for the inter-component i/f are created outside this interface class).

  • The code is old, changed a lot over the time and needs to be refactored.

The change should not be disruptive for the rest of the system. We try to limit leaving many test-required artifacts in the production code. Performance is very important and should be no (or very minimal) degradation after the redesign. Code is OO in C++.

I am looking for some ideas what approach to take. Any suggestions on how to do this efficiently?

© Stack Overflow or respective owner

Related posts about c++

Related posts about unit-testing