Let me start by doing a small summary of the changes we did in our code in the last year. We have a software (VERY big) that is used to visualize multiples underground networks, enter data in the entities in the network and create simulation in this network.
In the 20 years of development of this application (in MFC C++), multiple people have worked on it, lots of patch have been done and it's in constant developpement. Over the year, a monster class has been created. The class is called "CNetwork" and each network is a subclass of it.
To illustrate this moment in the code history, the prototype of a typical dialog was this:
public SuperNiceDialog(int nID, CNetwork* pNetwork);
After a course on unit testing, it was obvious for me that we needed to create interface to make everything more testable. Since most of our "functionnality" were in the network,CNetwork was implementing a lot of them and now when we need to call the same dialog, it looks like this:
public SuperNiceDialog(int nID, ITranslateNetwork* pTranslate, IUnitManager* pUnitManager, ICommonVectorProviderAQ* pCommonVectorProviderAQ, INetworkInfo* pNetworkInfo, IDatabaseManager* pDatabaseManager, ISimulation* pSimulation, INetworkAutonumerotation* pNetworkAutonumerotation, ISpreadsheetInfoProvider* pChiffrierInfoProvider, IPolygonManager* pPolygonManager, ISetterValidation* pSetterValidation)
I will not unit test a dialog but a lot of class called inside this dialog could be tested but for most of them, I must passe a lot of interface to get the work done. And I can't juste pass the network because some of the interface are removed from CNetwork to slowly remove functionnality from a single class.
So we think about it and one of the ideas that we had was to create a "package" object which could be a simple structure containing pointers to interfaces and getter to get access to these pointers (Like a Facade object). For example
My dialog would be called like this
public SuperNiceDialog(int nID, CDialogInterfacePackage* pPackage)
And in the code, I would use it like that
Since most of the Dialog needs the same interface, we could put 10 interfaces in it and just pass this to the dialog. We could create "interface package" for various module for example for simulation, spreadsheet, etc..
One part of me think it's a good idea but another part is telling me that I will be slowly creating a new "CNetwork" in some kind of way... Any idea about this problem of having too much interfaces? Is this a good approach?