MVVM - Flex 中的演示模型与 Silverlight 中的演示模型:优缺点? [英] MVVM - Presentation Model in Flex vs Presentation Model in Silverlight: advantages and disadvantages?

查看:19
本文介绍了MVVM - Flex 中的演示模型与 Silverlight 中的演示模型:优缺点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如这里所说:

http:///houseofbilz.com/archives/2010/12/29/cross-training-in-silverlight-flexmvvm-vs-presentation-model/

如果您今天在 Google 上搜索MVVM 和 Flex",那么第一篇文章是由声称 MVVM 不适合 Flex 的人撰写的.我完全不同意.开箱即用的 Flex框架使得在 Silverlight 中实现演示模型比在 Silverlight 中实现类似的 MVVM 更容易.这并不是说没有好的第三方库可以使 Silverlight 中的更容易,但如果没有任何帮助,它更容易在 Silverlight 中实现弹性."

"If you do a Google search today for "MVVM and Flex", the first post is by somebody who claims that MVVM is not a good fit for Flex. I couldn’t disagree more. Out of the box, the Flex framework makes it much easier to implement a Presentation Model than similar MVVM implementations in Silverlight. That is not to say that there aren’t good third-party libraries that make it easier in Silverlight, but without any help, it is easier to do in Flex. "

因此,MVVM 作为 LOGICAL CONCEPT 可以在两者中实现,但它在 Silverlight 中的实现方式需要比 Flex 更多的 Plumbing.

So MVVM as LOGICAL CONCEPT can be implemented in both but the way it is implemented in Silverlight requires more Plumbing than Flex.

是什么阻止 Silverlight MVVM 像 Flex 一样实现?Silverlight 在事件系统中没有相同的能力来做同样的事情吗?

What prevents Silverlight MVVM to be implemented like Flex ? Doesn't Silverlight have same capability in event system to do the same ?

如果是的话,为什么 Silverlight 做的事情更复杂,那么有什么优势呢?是关于使用更强类型的类接口吗?

If yes why does Silverlight do things more complicated what's the advantages then ? Is it about using Class Interfaces which are more strongly typed ?

还有什么缺点?例如,对于为 1 个视图模型实现 MULTIPLE VIEWS,Flex 实现是否也使其更加明显?

What are the disadvantages also ? For example as for implementing MULTIPLE VIEWS for 1 View-Model does Flex implementation make it also more obvious ?

推荐答案

是什么阻止 Silverlight MVVM 像 Flex 一样实现?

What prevents Silverlight MVVM to be implemented like Flex ?

在 .net silverlight/wpf 中,一切都应该是透明的.绑定是通知机制,所以它应该至少"像事件基础系统一样.

in .net silverlight/wpf everything should transparent. Binding is notification mechanism so, it should act "at least" like event base system.

如果是,Silverlight 为什么要做这些事情比较复杂有什么好处那么?

If yes why does Silverlight do things more complicated what's the advantages then ?

对我来说,这与心态有关,如果我知道它是一个基于事件的系统,那么我应该谨慎使用它.不要过度使用它等

for me, it is about mindset, if i know it is an event base system, then i should carefully use it. do not over use it, etc.

案例:绑定转换器,很容易在 flex 中实现,而不是在 Silverlight 中.

cases: Binding converter, easily implemented in flex, not in silverlight.

in flex: text="{getColor(pm.customerName)}" 是的,它非常简单,但问题是你确定你的 PM 会被垃圾收集正确释放,因为它是一个事件基础系统,谁负责观察变化?getColor 方法?或 text 属性?或两者?真的很难知道.

in flex: text="{getColor(pm.customerName)}" yes it is amazing simple, but the question is are you sure your PM will be released correctly by garbage collection, because it is an event base system, who responsible to observe the change? getColor method? or text property? or both? really hard to know that.

in silverlight: text="{Binding CustmerName, Converter={StaticResources nameToColorConverter}}" 不用问谁负责观察,因为colorConverter只是binding支持的转换器.我不需要担心内存泄漏.

in silverlight: text="{Binding CustmerName, Converter={StaticResources nameToColorConverter}}" i don't need to ask who is responsible to observe, because colorConverter is only a converter supported by binding. i don't need to worry about memory leak.

所以,对我来说,一切都与心态有关.

so, for me its all about the mindset.

这篇关于MVVM - Flex 中的演示模型与 Silverlight 中的演示模型:优缺点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆