views:

212

answers:

3

how are the classses in MFC match the model-view-control pattern ?

the model is suppose to handle the Business Logic , the control suppose to be some kind of mediator and the view suppose to be the gui ?

what class in MFC represent each one ? cause it seems pretty different to me as i read more about mfc. (seems like CView represent the control, CfrmWnd the view , and CDocumnet the data- though i'm not sure if by data they mean BL)

clarifications ?

+1  A: 

MFC does not implement the MVC pattern. However, there are ways to integrate MVC with MFC.

Nemanja Trifunovic
A: 

MVC is to desktop widget libraries like the ISO OSI model is to the internet protocols. It just does not fit because it is too rigid.

I don't think a single pattern exists that describes MFC (or desktop GUI programming in general) well. Maybe the hierarchical Model-View-Presenter is a good approximation.

Rafał Dowgird
+1  A: 

MFC is a Document/View architecture, not a full-blown MVC. Reference MFC Library Reference Document/View Architecture.

In short in MFC the CDocument is the Model, and the CView classes combine the View and Controller aspects.

By "BL" in your question do you mean "business logic"? And in this case the CDocument does not mean business logic, but the actual data underlying your app.

sdg
Put another way, CDocument bridges your Model and Business Logic to the View/Controller objects.
Frank Krueger
Actually the Controller can be split between CDocument and CView. Both are able to respond directly to user input.
Mark Ransom