问题描述
我已经阅读了有关Model-View-Controller模式的信息,我计划将其用于基于WTL的项目.例如,我想编写一个计算器应用程序.
首先,我编写执行实际计算的CCalculator类.这是用MVC表示的模型.
然后,我创建一个对话框并编写CCalculatorDlg类(从WTL的CDialogImpl模板类派生)来处理对话框事件.就MVC而言,这是什么?视图还是视图控制器?如果这只是一个视图,那么我是否应该编写另一个类,例如CCalculatorController,作为CCalculatorDlg和CCalculator之间的中介?如何正确地将MVC模式应用于WTL?
I''ve read about Model-View-Controller pattern, and I plan to use it for my WTL-based project. For example, I would like to write a calculator application.
First of all, I write CCalculator class that performs actual calculations. This is the model in terms of MVC.
Then I create a dialog and write CCalculatorDlg class (derived from WTL''s CDialogImpl<> template class) to handle dialog events. What is this in terms of MVC? View or view-controller? If this is just a view, than should I write another class, say CCalculatorController, as an intermediary between CCalculatorDlg and CCalculator? How to apply MVC pattern to WTL correctly?
推荐答案
这篇关于基于WTL的应用程序中的模型-视图-控制器模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!