We have a feature that is currently implemented, let's call it implA.ImplA works but can't do many things. So we have decided to rewrite it. But we can't just replace it right away, so we will need to go through another implementation, implB, as a temporary solution to do the transition between implA and implC.Even when implC is available, many people will still be using implA because it relies on hardware that needs to be updated to use implC. Anyway, from there, we will try to use implC anytime possible but we still need to support implA for some time.This feature is used across the rest of the application, and I'm wondering the best course of action to make is as painless as possible in the code. So we will end up with implA, implB and implC.I'm wondering if there is a pattern for this, or just a simple solution I don't think about.I was thinking of wrapping it in a class that would then call the right impl. But my issue is that implC will have many more functionalities and the logic is different than in implA and implB. So I find it difficult to create a common interface for the 3 classes.What would be the best solution?
Best solution to switch between new and deprecated code
design patterns;c++
With the details given, i find difficult to justify the need for temporary implementation - ImplB. Anyway, am parking that here.As all the 3 are implemented for a specific purpose, though there could be added functionality for implC, I believe that there could be a certain abstract type for these 3 - interface or an abstract class. Once that is in place you could use factory pattern to supply the right instance to the caller depending on certain parameter / set of parameters.Reference:Factory pattern - http://en.wikipedia.org/wiki/Factory_method_pattern