What should I do with too much interfaces needed for a dialog

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

m_pPackage->GetITranslation()->Translate(123456);

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?

Thanks

2

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

What should I do with too much interfaces needed for a dialog

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

m_pPackage->GetITranslation()->Translate(123456);

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?

Thanks

2

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật