精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>编程开发>>● 系统分析>>待整理2000/4/25之后>>好文章不敢独享:Model-View-Controller

主题:好文章不敢独享:Model-View-Controller
发信人: duckstone()
整理人: majorsun(2000-10-11 09:51:08), 站内信件
好文章,以飨才俊。(现尝后买)
下面是节选,大家可以在
http://msdn.microsoft.com/componentresources/html
/articles/pwp/pwp_009.asp找到全部内容。

An Architecture for Windows® DNA Applications
by Roguewave Software

Basic concepts of MVC
~~~~~~~~~~~~~~~~~~~~~~~~
The MVC architecture is an object-oriented framework and design
pattern for building applications and reusable GUI components. 
MVC prescribes a way of breaking an application or component 
into three parts: the model, the view, and the controller. 
The original motivation for this separation was to map the 
traditional input, processing, and output roles in the GUI realm: 
The user input, the system function/state, and the visual 
feedback to the user are separated and handled by controller,
model, and view respectively. Figure 1 represents the basic 
MVC triad and lines of communication. 

Figure 1. The MVC triad

The model is the cornerstone of the triad. As its name implies,
its job is to model a real world system by emulating its state 
and functionality. Models define queries for reporting state, 
commands for altering state, and notifications to inform 
observers (that is, views) that a change in state has occurred.

The controller is responsible for defining thebehavior of the 
triad. Its job is to receive mouse and keyboard input and map 
this user stimulus into application responsey executing the 
model抯 commands, for example. 

The view manages a rectangular area of the display and is 
responsible for data presentation and hit testing1. Due to 
its observer relationship with the model, new views can be 
defined and attached to a model while holding the model 
interface constant. 

Distinguish between architecture and technology
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Why should you use MVC when there are already so many frameworks
that take full advantage of the latest technologies? Because MVC
is not designed to be yet another framework, but rather to 
complement and extend existing frameworks. While most frameworks
address particular technology and platform issues, MVC helps to
provide an architecture. 

Often, the technologies used to implement a system become an 
integral part of its architecture, which can limit flexibility. 
To the extent possible, your architecture should abstract and 
encapsulate the technical and platform details so team members 
can effectively specialize. This focus on architecture and 
encapsulation helps to reduce complexity while minimizing and 
localizing the impact of shifting technologies. For these 
reasons, it is advantageous to keep architecture and platform 
dependencies separate and distinct. 



--
※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.99.18.87]

[关闭][返回]