Original URL: https://www.theregister.com/2005/12/04/anderson/

Hands on with Macromedia Flex 2.0

Tim Anderson gives alpha version a spin

By Tim Anderson

Posted in Software, 4th December 2005 18:28 GMT

The assumption behind Flex is that an unadorned browser is insufficient as a universal client. Microsoft beats this same drum, and promotes .NET smart clients as the means of adding the performance and rich user interface that only a local application can achieve.

To date, Microsoft’s campaign has had only limited success. Sun’s Java is cross-platform, more mature and more widely deployed, but has been most successful as a server technology.

Macromedia’s Flash client has wider penetration than either .NET or Java, but most of its usage is for multimedia applets. This indeed is what Flash was designed for. Macromedia’s goal with Flex is to make the Flash client suitable for Enterprise clients as well. Flash is fully network-aware, has rich user interface capabilities, and supports scripting with ActionScript, so why not use it as a fully-fledged application platform?

There are a few reasons. The Flash player is remarkable for its size, but cannot compete with a full operating system or even the Java platform in terms of a rich API. The Flash ActionScript language, based on the official Javascript standard known blandly as Ecmascript, is slow and underpowered compared to Java, C# or C/C++.

Third, the Flash IDE is aimed squarely at designers rather than developers. When Flash MX was announced in 2002, Macromedia promised that it would be as easy as Visual Basic for developers, but the promise was unfulfilled and the Flash IDE remains awkward and unfriendly for application development.

Flexing muscles

In 2004 Macromedia came up with Flex as another way to exploit the Flash client. The heart of Flex is MXML, an XML language for defining a Flash user interface. This can include embedded ActionScript, or for cleaner maintenance the script can be written in separate files. The MXML and script then gets compiled to a Flash SWF for deployment.

In Flex 2.0, there are two different deployment models. One is called the Enterprise model, and depends on Flex Enterprise Services, a Java application that runs on any of a number of J2EE servers. The MXML and script files are deployed to the server, and compiled to a SWF at runtime. The SWF is cached to avoid repeated compilation. The other model involves pre-compiling the SWF using the Flex compiler and deploying it directly.

This simpler model does not require Enterprise Services, giving Flex a broader appeal. With both types of deployment, the Flash client can communicate with the server using XML web services (SOAP) or plain HTTP, but one of the key benefits of Enterprise Services is that it additionally enables the Action Media Format (AMF) protocol, also known as Flash Remoting. AMF is an efficient binary protocol, proprietary to Macromedia, and makes it easy to call remote Java Beans or Enterprise Java Beans from ActionScript code.

Flex 2.0 breaks down into four pieces. The first is called the Flex Framework 2, which includes the Flex class library, MXML and ActionScript, compiler and debugger. Next there is Flex Builder 2, which is an IDE built on the open source Eclipse tools. This includes a visual form designer, although it is a relatively simple affair. Macromedia bundles Flex Builder and Flex Framework together. Third, there is Flex Enterprise Services 2, which enables remoting of Java objects via AMF. Finally, the Flex Charting Components 2 anticipate a common reason for using a Flash client, which is to visualize business data.

This new Flex, of which we tried the Alpha release, is a major step for Macromedia. On the technical side, there is the new IDE, an updated Flash player (8.5), and crucially version 3.0 of ActionScript. This implements significant new features, including an official extension called Ecmascript for XML (E4X) which is attracting a lot of attention from ActionScript developers.

E4X adds native XML types to the language, and arguably represents the most productive approach yet devised for working programmatically with XML. The new Flash includes an updated ActionScript virtual machine, which Macromedia states is substantially more performant than its predecessor, which becomes slow with larger applications. Our brief tests bear out this claim, even in the Alpha release. At a more detailed level, there many new Flex components, and new support for messaging, data and testing in the Enterprise Services layer.

Macromedia is also adopting a different marketing strategy. Flex 1.x is an expensive product sold on a per-CPU basis, making it interesting only to enterprises. Flex 2 will be marketed with per-developer licenses for Flex Builder and Flex Charting Components.

Long overdue

Put another way, this means that a developer-oriented IDE for Flash client applications will now be within reach of any organization, a long-overdue step for Macromedia. If the strategy succeeds, it will impact the enterprise market as well, by broadening the availability of Flex development skills.

The timing of Flex 2.0 is good. There is much debate centred on the client, and how to move beyond the capabilities of the browser without sacrificing benefits like zero deployment. Technologies like AJAX, Java, and Microsoft’s .NET and forthcoming XAML are scrambling for position. Flash is a competent platform, which deserves consideration. Flex removes one of the key objections, which is the weakness of the Flash IDE for application development.

There remain weaknesses. One is offline working; Macromedia is working on solutions for this, and Flash had limited support using a technology called local shared objects, but currently Flex is not ideal for occasionally connected clients, an area where .NET is particularly strong.

Another issue is that Flash applications are by design sandboxed, so if seamless operating system integration is desired Flex will not be suitable. Some developers will not want to give up the richness of C#, Java or C/C++ for the sparser Flash and ActionScript environment, or will prefer to work with the same language on client and server.

On mobile devices, Flash is making progress but is still much less widely deployed than Java. This still leaves a substantial subset of applications where Flash is more than sufficient. Flex 2.0 is likely to broaden its adoption considerably.

More information here; or try the alpha version here.

User comments on Flex 2.0

Thomas W. Gonzalez is managing director of Brightpoint Consulting, Inc., a company that specialises in business analytics and operational dashboards. The company has a Microsoft .NET background, so why is he interested in Flex?

“The pricing structure of Flex 1.5 made it prohibitive. With Flex 2, Macromedia is trying to hit the SME space as well as the Enterprise. From a technical standpoint, some of the features in Flex 2 are similar to what Microsoft is doing with XAML, which is having a declarative metaphor as well as a procedural or object-oriented metaphor. That gives us rapid prototyping and design.” So why Flex rather than XAML?

“It’s a hard decision and the jury is still out. What sways us towards Flex is Macromedia’s penetration, being on 98% of desktops as well getting to mobile devices. The second benefit is that the Macromedia footprint is very small. In contrast, Microsoft’s interesting work with XAML requires .NET 2.0, which is 30 to 40 MB. A lot of the Windows Presentation Foundation requires a whole new OS, Vista. We have to evaluate where the target platform is going to be. Right now, everyone is using Macromedia.”

Although Gonzalez intends to continue to use .NET and SQL Server on the server, he sees Flash as smaller and easier to deploy to clients. “We come from an almost exclusively Microsoft development background, right back to Visual Basic 5 and Windows DNA,” he explains. “Microsoft tends to do clunky types of integrations, whereas Flash is so ubiquitous and so seamless, I’ve not once had a deployment issue with a Flash solution. When I look at the history of the product development we’ve done with Microsoft, I can think back to myriads of situations where deployment has been an issue, in terms of browser integration, ActiveX controls, patches, compatibility issues, and DLL issues. My guess is that in order to use XAML you are going to need the latest Windows service pack as well as other products. Imagine rolling that out to a client base, even (say) a client with just 100 users. There’re now potentially 100 desktops that you are going to be forced to troubleshoot. With Flash, it’s simple.”

Independent developer Karl Offenberger is more interested in ActionScript 3.0 and E4X than MXML. “I am currently developing parsers and algorithmic art applications. The new ActionScript virtual machine has much improved performance.” Offenberger is less impressed with the Eclipse-based IDE. He considers it an improvement on the Flash IDE for ActionScript development, but “it will require me to compromise on many important workflows developers are used to from other IDEs such as Microsoft’s Visual Studio. Code completion is rudimentary at the most, and the visual form designers are on a level with Visual Basic 6. If Macromedia want to promote FlexBuilder as the framework for rich Internet applications, I believe it will need to look towards Visual Studio.”

Offenberger is also concerned that Flash is underpowered and may fall behind Microsoft. “Why is Macromedia so intent on keeping the Flash player small for fast downloads? People without broadband will hardly be looking at Flex applications. Why doesn't Macromedia offer full hardware acceleration of the graphics pipeline? Where's Flash 3D? Where's Flash Speech? I hope to see Flash and Shockwave merge into one improved platform and player that will contend with Windows Presentation Framework.” ®