📜 ⬆️ ⬇️

Flex 3 vs. Silverlight 3 in Enterprise Development


We see an abundance of articles compared to Flex and Silverlight, but I never saw a single word about the comparison of both technologies from enterprise development. Many people who are professionals at Flex cite the basics, but in a corporate environment this should not be the main argument, but only one of the facts that will affect your decision.

Having experience in developing enterprise software on the .NET platform since its inception, I recently took a break and spent several months working with very large Flex applications.

Rich Internet Applications (RIAs) are maturing. Adobe has created its Flash offer more developer-oriented - Flex. Microsoft has recently entered the market with Silverlight.

In my opinion, Adobe has a powerful designer portfolio with great looking applications. The Microsoft and .NET platform is a leader in business application development, which left an imprint on Silverlight, where business functionality is more important than appearance.
')
I strive to show in this article, by comparing the two technologies, that I believe that the price of providing Silverlight integrated business functionality is significantly lower than that of Flex.

Languages ​​- C # vs. vs. Actionscript


C # is a completely object-oriented programming language that occupies a leading position in the development of business applications ... Actionscript was originally a scripting language for the Flash player, which tolerated changes in Actionscript 3. As an object-oriented language, it lacks a lot of features that are Java or .NET developers take for granted. Some differences I will list:

C #

Actionscript:

These missing features are the same result in dirty and optional confusing OO code. Type casting is most often mandatory, for example, when you refer to collections. But it is still technically possible to do the things that we need in Actionscript, the code as a result will be inevitably amateurish, less type-safe and more difficult to maintain.

It is known that Flex lacks support for decimal types, this problem is especially acute when developing financial applications. Math with a floating point, most often, is not accurate enough for financial calculations, you can read about it here . FXComps brought its decimal implementation to Flex, but when I performed the performance tests, I found that the decimal division was 3000 times slower than the float division. Decimal multiplication is 650 times slower than float multiplication. Honestly, decimal calculations are slower than float in C #, but not on the scale here . This item should be enough for people who are considering creating financial applications to have serious doubts about the suitability of Flex.

As a result of this and other shortcomings, the Actionscript compiler is less effective in identifying problems at the time of compilation. Compilation is slower than C # (Flex needs 2 minutes per 100,000 lines of code). Simply put - Actionscript is much slower than C #.

Without touching the language itself, you can see that C # has a .NET Framework, many of which are available in Silverlight. In this regard, Flex / Actionscript needs a lot more to implement.

MXML vs. XAML


MXML and XAML are trying to do similar things. Both are markup language for locating UIs and animations. MXML is relatively simple and intuitive, therefore experienced developers can learn MXML quickly. On the other hand, XAML is less strict, more powerful, but also difficult to learn.

Silverlight contributes more to the separation between code and markup, with partial classes offering a cleaner code-behind model. Flex allows you to place script blocks in the MXML file, which inflates the UI markup files with the presentation code model.

Framework Components


Right out of the box, Flex still has a more comprehensive set of components. If you need more complex functionality of these components, the quality is not always compatible.

Ask any Flex developer who worked with Advanced DataGrid internals what he thinks? ( description of the problem ). I saw that people manually did the focus of the control, processing the tab events, and also implemented the scrolbar work in comboboxes in grids in the code. It turns out that as soon as a slight complication of functionality is required, the complexity of the code in Flex grows exponentially.

Microsoft did a good job absorbing some features from Flex. However, there are things that Silverlight lacks: video and audio recording, printing.

Third Party Components


Microsoft is especially good here. Look at the offers from Infragistics , Syncfusion , Telerik . Using these sentences, you can quickly create a powerful UI without writing, almost, no code.

Flex also has commercial and open source offers, such as the ILOG Elixir from IBM . But there are companies that have been developing components for Microsoft for years. Flex offers are more limited.

Patterns and Practices, Framework and Inversion of Control (IoC)


Silverlight has a number of frameworks that you can immediately take from the shelf: Composite WPF, CLSA.net, Spring.net. Using such frameworks can significantly increase developer productivity, not only because of installing repetitive templates for writing consistent and supported code, but it also involves a lot of the most complex code you would have to write in a project that is already implemented for you.

Again, .NET has several excellent IoC frameworks that can reduce code dependencies. One of my favorite frameworks is Google Autofac. And although Actionscript is moving in this direction, it still remains heavily behind C # in this regard. Spicefactory's Parsley is good, but it requires large configuration files, like Spring, of which I am not a fan. Adobe has LifeCycle ES , which offers a lot of things, although sometimes it imposes certain restrictions.

IDE / refactoring tools


In large projects, IDE can save a lot of developer time and therefore money. Conversely, a non-stable IDE with limited capabilities leads to delays in projects.

This is one of the areas where Silverlight is leading. Visual Studio 2008 is an excellent IDE, especially when combined with refactoring tools like Resharper.

FlexBuilder and Eclipse have certain drawbacks, including:


Unit testing / mocking


Flex unit testing ability is satisfactory. Personally, I think that projects can get bogged down with a choice of such tools in this area. However, C # has the best selection of moq libraries.

Unit testing in C # using Visual Studio can become more efficient if you use such integrated tools as MS Test or Resharper - just select methods or class for testing and see the result in the IDE. If the test is unsuccessful, just click on it, and it will open the unsuccessful test method. If you need to test only a small part of your Flex application, you must create a separate test class to run, define test conditions, recompile and then run the project. If the test fails in the Flex Unit, you must flag the failed tests and manually find them in the IDE.

Yes, we can test in Flex, but it is more difficult and takes more time.

Profiling


The profiling tool in Flex Builder is very poor and there are no third-party alternatives. Performance statistics are taken from the start of the application, and not between two copies.

As far as I know, there is not yet a profiler for Silverlight, nevertheless it is quite simple to convert your code to WPF and after that use the profiling tools, my favorite is dotTrace . You can use Aqtime and DevPartner .

Code examples and documentation


99% of what you want to do in C # has already been implemented, 90% and more have been described on the Internet. A community of .NET developers is thriving. If you are stuck, then spending 5 minutes on google or viewing MSDN - you will find the answer. Flex Livedocs also has a much smaller set of materials than MSDN.

Developer Experience


In general, Flash / Flex developers have many years of experience creating an application with a pleasant interface, but they do not always write reliable, supported code.

Also, there is an abundance of C # developers with many years of experience in writing enterprise applications, but most of their user interfaces are poor.

Naturally there are exceptions in both cases. I am familiar with several excellent Flex developers.

Installation base


Flash Player is installed on 99% of computers. If you want to reach as many users as possible using a lightweight application, then Flex / Flash is the obvious choice.

For an enterprise application, this is not a powerful enough argument. In general, if a customer buys your application, a request to install Silverlight is not too complicated or demanding. Many corporations now include Silverlight, as part of their standard installer.

Summary


Ultimately, for me, the choice falls to what you are trying to achieve. At the moment, if the appearance of the application is what you care most about, then Flex will most likely suit you. However, if you are going to develop complex business functionality and are also interested in using money, then Silverlight is best for you. This is mainly due to the result of the code that you get in the Siverlight project: simple, high-level, more supported and cleaner. With increasing complexity, it is very important to have a structured base code. Without this, the number of errors and regression will only grow and turn into extra costs.

I have been developing for years with C # and have fun. Turning to Flex, I had the feeling that my hands were tied behind my back. It is frustrating that the medium provides only a small fraction of what could be achieved. By saying this, I recognize that Flex applications are the most pleasant looking applications I've seen.

Special thanks to XaocCPS for correcting the translation.

Source: https://habr.com/ru/post/66047/


All Articles