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

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

问题描述

正如这里所说:

http://houseofbilz.com/archives/2010/12/29/cross-training-in-silverlight-flexmvvm-vs-presentation-model/ 如果你今天做了一个MVVM和Flex的谷歌搜索,第一篇文章是有人声称MVVM不太适合Flex,我不能不同意,Flex框架比Silverlight中类似的MVVM实现更容易实现Presentation Model,这并不是说没有好的第三方库在Silverlight中更容易,但没有任何帮助,在Flex中执行起来更容易。

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



什么能阻止Silverlight MVVM像Flex一样被实现? Silverlight在事件系统中是否具有相同的功能?

如果是的话,为什么Silverlight会把事情做得更复杂呢?是关于使用更强类型的类接口?

还有什么缺点?例如,为了实现1个View-Model的多个VIEWS,Flex的实现是否更明显呢?

解决方案


什么能阻止Silverlight MVVM像Flex一样被实现?在Silverlight / WPF中,一切都应该是透明的。绑定是通知机制,所以它应该像事件基础系统一样至少。


如果是,为什么Silverlight做的事情
比较复杂b $ b的优点是什么?b

$ b $对于我来说,这是关于心态,如果我知道这是一个事件基础系统,那么我应该小心使用它。绑定转换器,很容易在flex中实现,不在silverlight中。



b

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



in silverlight: text ={Binding CustmerName,Converter = {StaticResources nameToColorConverter}}
所以,对我来说,所有关于心态的。


As it is said here:

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

"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. "

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

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

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 ?

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

解决方案

What prevents Silverlight MVVM to be implemented like Flex ?

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

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.

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

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}}" 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天全站免登陆