Adobe Flex 和 Microsoft Silverlight 对比

Some
objective comparison of Adobe Flex and Microsoft Silverlight

译者:巴巴鲁

In the past I’ve read a number
of posts comparing Silverlight to Flex. Often the authors remain very vague on
why Flex is better than Silverlight. We all know by now that the Silverlight
plug-in isn’t near the installed base of the Flash player but there’s more than
that. Therefore I think it’s about time to give an overview of my recent
experience.

 

在过去,我经常会独到一些关于Silverlight Flex做比较的文章。通常作者关于为什么Flex优于Silverlight的阐述都比较模糊。我们都知道Silverlight 插件并没有Flash player安装的那么广泛和普及。因此我通过我最近的经验给出一些我的概述。


I’ve
been developing a proof of concept application in Silverlight after having
developed the exact same proof of concept application in Flex. Just to be
clear: I have much more experience with Flex than Silverlight but I’m pretty
sure that the information below is based on facts, not fud.

 

我曾经开发一个应用使用的是Silverlight,然后由于需求又开发了同一个应用使用Flex 。很明确:我有比Silverlight更多的Flex经验,但我敢肯定是下面的信息是基于事,而不是唠叨(fud不知道美国人真正的意思是什么)。


1. Binding – Both
technologies support binding but binding in Silverlight is way more cumbersome.
First of all you need a special hack (using StaticResource) to bind UI
components together. Even worse is the fact that you need to dispatch property
changed events yourself (in Flex you simply specify the [Bindable] attribute on
class and/or property level). A direct binding to an expression is also not an
option in Silverlight. The fact that there’s 2 way binding in Silverlight is an
advantage for Silverlight because the current version of Flex is limited to 1
way binding (the upcoming release of Flex has 2 way binding).

1. 
绑定两种技术均支持绑定,但在Silverlight中绑定的方法更多一些。首先你需要一个特殊的HACK(用于静态资源StaticResource)用于同UI组件绑定。甚至更糟的是,事实上你需要去指派你自己被改变事件的属性(在Flex你简单的指定[Bindable]属性到类或者属性级别)。直接的绑定表达式,在Silverlight中不会出现。事实上有两种方法在Silverlight中进行绑定是Silverlight的优势,因为现在的Flex版本只有一种绑定方法(即将发布的Flex版本会有两种绑定)

2. Data
communications – In Silverlight you’re more or less stuck with SOAP and JSON
for the time being (you could consider using WebOrb or FluorineFx – this gives
Silverlight AMF support).

 

2. 
数据通信Silverlight中,你可以暂时使用SOAP JSON(你可以考虑使用WebOrb
或者 FluorineFx – 这些给于
Silverlight AMF
支持)


3.
Layouting – Thank God there’s Flex. Need to layout a data entry form? In Flex
you can use Form and FormItem. In Silverlight you need to use Grid,
RowDefinition and ColumnDefinition. Not too bad if you didn’t have to specify
Column and Row IDs because what do you need to do when you need to insert a
line in your form… right… renumber everything. There are also no ‘right’
and ‘bottom’ properties in – pretty annoying.

 

3. 
布局感谢上帝赐予了Flex。假如你需要去布局一个数据表单?在Flex中你可以使用Form
FormItem
。在Silverlight中你需要去使用GridRowDefinition ColumnDefinition。不算太糟,因为当你需要在你的表单中插入一行权限所有的重编号,你需要指定Column
Row IDs。在Silverlight中也没有‘right’ ‘bottom’属性,相当令人讨厌。

4. Exception handling – This is a ‘bad in both cases’ topic. In Flex there’s
still no global exception handler. Silverlight has one but for some strange
reason the screen goes blank after certain exceptions. In other words: there’s
global exception handler support in Silverlight but it doesn’t work…

 

4. 
异常 处理 这是一个‘两者都不好’标题。在Flex中仍然没有全局异常处理。Silverlight在一些重问题certain异常后,屏幕变空白。另一种言论说:Silverlight有全局异常处理,但它没有工作

5.
Code behind – To me it’s not essential but the fact that there’s no out of the
box support for code behind in Flex is a pitty. The fact that there’s no out of
the box WYSIWYG design support in Visual Studio 2008 is probably much more
problematic for developers starting with Silverlight (or do you really expect
them to constantly switch between slow blend and quick visual studio???).

 

5. 
代码 背后(behind不清楚是不是应该这样翻译)对我来说这并不重要,事实上没有框架支持的Flex是可怜的。实际上没有所见即所得设计框架的Visual Studio 2008对于开发者开始使用Silverlight是更为困难的(或者你真的希望他们融合缓慢和快速的visual
studio
)。


6.
Multi-language – I haven’t completely figured out the multi-language support in
Silverlight but it’s already clear to me that it’s way easier to implement in
Flex. Just to be clear: the internationalization in Flex is also far from
perfect. You need to take care of date formats, decimal and thousands separator
support yourself because there’s no application global setting in Flex (which
is problematic when using validators and binding).

 

6. 
多国语言我没有完整了解Silverlight对多国语言的支持,但是Flex的多国语言让我很清楚。明确的说:国际化在Flex里也远没有作到完美。你需要考虑日期格式,小数和千位分隔符的支持。因为这些不能够在Flex通过全局设定(使用验证validators和绑定有一些问题)。


7. Validation – although
not perfect in Flex (do they really think all telephone numbers are formatted
the US
way…), the support in Silverlight is simply absent. You will need to develop
validators and the nice red "error tips" yourself.

 

7. 
验证 尽管在Flex中并非完美(你认为他们考虑到了所有国家的电话号码格式和美国一样吗)。Silverlight这方面的支持更为贫乏。你自己需要开发验证和好看的红色“错误提示”。


8.
Generics and LINQ – currently there’s no support for generics in Flex (actually
Actionscript).

 

8. 
泛型和LINQ –目前Flex不支持泛型的

What’s even worse: there’s
no LINQ (or something similar) in Actionscript. Silverlight comes with LINQ and
that is definitely an advantage (you can’t use it for database querying
however). Support for partial classes and extension methods is another
advantage of Silverlight over Flex. It’s clear that we’re in need of
Actionscript 4 (even if that results in non-compliance with Ecmascript).

 

更坏的是:在Actionscript没有LINQ(或者类似的)。SilverlightLINQ 绝对优势(但是你不能使用它的数据库查询 。支持部分扩展方法Silverlight优于Flex的另一个点。很然,我需要的脚本4 (即使果不遵守的ECMAScript

9. Components – The
Silverlight component set is smaller than the Flex component set (eg. a menu
bar component is missing). This might change quicky however. There are already
more 3rd party component development companies working on Silverlight controls
than companies working on Flex controls.

9. 
组件 – Silverlight 组件设置与Flex组件设置类似(例如。缺少菜单栏的组成部分)这种状况可能很快 比针对于Flex更多的第三方开发公司针对Silverlight的控件开发

10. Browser compatibility – Although there are some issues with Flash player
running in Google Chrome – the situation is much better compared to
Silverlight. That one just doesn’t work in Google Chrome.

10.             
浏览器兼容性 尽管Flash player 运行于 Google Chrome有一些问题,但这些问题要比Silverlight强很多,因为至今Silverlight还不能运行于Google Chrome。(中国话就是有问题不怕,总比不能用强)。

I’ll
probably discover more differences during the coming weeks. If so I’ll post a
new overview over here.

我将会在接下来几周发现更多的不同之处。如果发现了,我将会在这里发布。

 

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: