jeudi 14 mai 2020

How can i manage legacy class with the new implementation?

I am currently working on an old application where I need to support a new feature which is more advanced of current one

For example Lets say I have a feature which open a file In a native window and now I want to add a different feature where the file can be opened in a web-browser which is wrapped inside a native window . For this I tried to create factory for both implementation which returns me appropriate object depending on user selection .Both native-window implementation and my web-browser implementation class implement an interface which my factory uses to return object of that type .

The problem here I am facing is the old implementation contains many methods which will not be required for my new implementation .I was thinking of using strategy pattern here but i donot want to add all the methods to an Interface to able to dynamically call different method depending on type of objects .Is there any way I can do this without putting much instance of check to distinguish between these two implementation.I donot have much leverage to change the old code .Any clue on this would be helpful

Aucun commentaire:

Enregistrer un commentaire