Topic: MVC图中的 事件,方法调用 的区别?

  Print this page

1.MVC图中的 事件,方法调用 的区别? Copy to clipboard
Posted by: wangfeng
Posted on: 2004-09-13 08:52

一直对这个图中的事件与方法调用存在疑惑.

事件 是用户的动作(键盘,鼠标 发出请求?) 或者是一些其他消息,消息队列, email? ??

方法调用 又是什么???

请知道的告知一下,多谢!!!

2.Re:MVC图中的 事件,方法调用 的区别? [Re: wangfeng] Copy to clipboard
Posted by: floater
Posted on: 2004-09-13 12:21

direct method calls, not like the other, event driven(observers).

3.Re:MVC图中的 事件,方法调用 的区别? [Re: wangfeng] Copy to clipboard
Posted by: wangfeng
Posted on: 2004-09-13 12:38

还是不是很清楚..
你说的是什么意思?
不清楚你用英文表达的是什么意思?
直接方法调用, 不像其他的,比如事件驱动机制的东西(比如Observer?)

好像没有从我说的东西里面分辨出什么,
只是说不同,我要的不是说"同还是不同",而是具体的不同点.

事件在这里具体是指什么..
方法调用又具体是指什么.
两者有何不同.

4.Re:MVC图中的 事件,方法调用 的区别? [Re: wangfeng] Copy to clipboard
Posted by: zyzhang
Posted on: 2004-09-13 18:51

The good place for the detailed explanation on this diagram is in the Sun J2EE Blueprint. and the reference implementation is in the JAVA PetStore. you can check them in sun website.

The idea behind MVC is trying to give a clear boundary between M,V and C. The implementation for this principle are generally using the design patterns of Observer, Command and(or) Delegate.

In the Java pet store(implementing the MVC), the initial version were using State Machine(you can check the codes) to give the solution on how model change can notify the views. The events mentioned in the diagram are from the Model(when the state change occured). and the methods invocations are all related to the state quering, updating and notification among the MVC. This(invocations) actually represets how these componets(MVC) are collobrating and their responsibility.

After you take a close look at the java pet store codes, you can get the real feeling on the MVC diagram.

Actually, the java pet store and MVC implementation are a good solution in theory(Sun is very good at this), but in reality, the MVC using Observer(events) to collobrate the other parts is arguably a ideal soltution for most of the real world solution, it introduces unnessary complexity, as Rod in the book of J2EE Design and Development.

So, it's good to check the sun j2ee blueprint and java petstore implementation(codes) to clear your mind. and then, you can have a look on the Rod's J2ee books for the real-world implementation on MVC. This is my roadmap, hopefully this can also help you and others.

5.Re:MVC图中的 事件,方法调用 的区别? [Re: wangfeng] Copy to clipboard
Posted by: wangfeng
Posted on: 2004-09-13 20:24

Thank you very much for answering my question.
You are so enthusiastic and so patient!!


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923