This question has been bugging me for a while.
I am looking for a testable architectural design pattern for a MFC application. Please don’t tell me MFC is already MVC or something like that because it does not make any sense as long as we can’t test the app.
I understand the rule of thumb is to make it View/Document as dumb as possible and
make other classes testable. But I want more details on that. How can I make View/Document as dumb as possible and connect them to other testable classes?
First I thought about MVP since I had some success with it for Windows .NET and Android app. But in this MFC case, we need to make Document dumb too. That complicates things.
I need an effective architecture which is maintainable in long term. Any advice from experienced developer would be appreciated.
I don’t think you may need any special design pattern to separate logics from UI. MVP can help but may not be practically necessary. The separation would be enough for testing if you can make your logics into separate dlls or static libraries and make them accessible from other applications. That will be a good start to practically make your logics to be testable.
But even before that, I would find a good testing framework for your development environment. I had some success with Google Testing framework or Boost Testing in case of MFC.
As for design patterns, they are very good to make your program maintainable and maximize code reuse, but I am not sure it’s a good practice to use them to make your program testable. Testability is a good property of your program but it may not be the goal of your design.