Flex News Desk
Rich Internet Applications - State of the Union
What's your technology choice for implementing RIA?
Feb. 10, 2008 11:15 AM
Java
Even though the
Java programming language became popular largely because of applets and
the famous dancing Duke (http://java.com/en/download/help/testvm.xml ),
applets haven't become Java's main use pattern. The main reason: the
large footprint of the required JVM (currently 16MB). And there are
other drawbacks. For instance, although Java Swing pushed a
platform-independent look-and-feel, absent any good-looking
off-the-shelf GUI widgets it was hard selling it to the public. In this
regard Flash and Flex creators did a much better job with their
eye-candy components. Or take audio and video integration. Today people
are used to having streaming audio and video components embedded in Web
pages. But the multimedia Java API remains rudimentary, to say the
least.
There are some efforts to minimize the size of the JVM used
by Web browsers and the Java Browser Edition project now needs "only"
about 3MB to run a primitive Hello World applet. But this can't compete
with Flash Player 9, which managed to accommodate two virtual machines
in a 1.2MB download that can run any RIA however complex.
Another
issue with Java applets is that they don't offer a seamless download of
the proper version of the JVM along with the applet. Flash Player's
express install does precisely that.
Having said that, I must
acknowledge that Java Swing is a very mature and robust technology for
creating GUI applications delivered either over the Web or installed on
the desktop. You can do literally anything with Java Swing - if you can
afford it. No, you don't pay licensing fees, but because of the longer
development cycle and need to engage expert programmers,
industrial-size Swing projects are usually quite expensive to build and
maintain.
Adobe Flex 2
Flex
2 applications run cross-platform in a ubiquitous Flash Player 9 that's
a lightweight virtual machine. The platform includes:
- an XML-based language called MXML that supports the declarative programming of GUI components targeting designers;
- the standard object-oriented programming language, ActionScript 3.0, based on the latest ECMAScript specification;
- server-side integration via Flex Data Services giving client applications transparent access to the world of J2EE;
- charting components, access to multimedia controls, etc;
- and an Eclipse-based full-featured IDE with automated deployment, debugging, and tracing facilities.
The Flex 2 platform is easily extendable and integrates well with server-side Java, ColdFusion, PHP, Ruby, ASP, and the like.
The
SWF file format is open, and there are third-party open source products
that offer tools for creating RIAs delivered by Flash Player like
OpenLaszlo from Laszlo Systems.
This is what comes at no cost with Flex 2:
- MXML - an XML-based declarative programming language for creating GUI.
- ActionScript 3.0 - an object-oriented language similar to Java.
- Flash
Player 9 - a virtual machine with a tiny footprint that lives inside a
Web browser and runs your compiled bytecode (.SWF).
- Command-line compilers and debugger.
- Flex
Framework, which includes a library of well-designed GUI component:
buttons, tab folders, data grids, tree controls, animated effects, and
more.
- Flex Data Services Express (FDS) - a template Web
application deployed in a J2EE server to communicate with ActionScript
client application run by Flash Player. FDS Express is limited to a
single CPU, which makes it useful only for learning purposes.
The following Flex tools require a purchased license:
- Flex Builder - the Eclipse-based IDE
- Charting component
- Flex Data Services Departmental, 24x7, 100 concurrent users
- Flex Data Services Enterprise, 24x7, unlimited users
In a nutshell, the process of creating a basic Flex 2 application consists of the following steps:
1. Design application by adding MXML components like this button:
<mx:Button label="Place Order" click="processOrder(event)"/>
If you use Flex Builder IDE, you can apply drag-and-drop techniques. Alternatively, you can write the MXML as text.
2. Write the code in ActionScript per your functional specification, for example:
private function processOrder (event:Event):void{
//The business logic goes here
}
3.
Compile the code: The Flex compiler automatically converts MXML into
ActionScript and creates bytecode output in a form of an SWF file to be
run in Flash Player 9 or above. You'll enjoy a fully automatic
compilation process if you use the Flex Builder IDE.
4. Deploy the
SWF file and the wrapping HTML page in the Web server of your choice.
The deployment process and creating the wrapped can be completely
transparent if you use the Flex Builder IDE.
More advanced Flex
applications can include interaction with the server-side systems
through FDS, which provides remote access to server-side Java objects
and Java EE components, extensive messaging support (including JMS
integration), synchronization with persisted data, and integration with
other persistent technologies.
WPF
Recently
released Microsoft's Windows Foundation Platform, or WPF uses an
XML-based declarative programming language called XAML to create GUIs
and C# as a general-purpose programming language. WPF is suitable for
creating both RIA and desktop applications. XBAP stands for XAML
Browser Application and it's a WPF way of creating RIAs that runs in
Internet Explorer.
Microsoft has released a Beta version called
WPF/E that will run on some non-Windows platforms (this version uses
substitutes C# with JavaScript). While living in a sandbox, XBAP will
have access to all .NET 3.0 functionality but WPF/E won't. Common
Language Runtime (CLR) is the client's WPF engine.
To create WPF
applications, developers can use Microsoft's Visual Studio 2005 IDE
with installed .NET 3.0 extensions. The next version of this IDE,
called Orcas, will include a visual GUI designer. WPF developers use
the same code base for writing XBAP and desktop applications: they just
enclose the code sections that aren't allowed in XBAP into the ifdef
blocks.
Microsoft XAML code looks similar to Adobe's MXML. Even
though today's Flex 2 is a lot more mature than WPF, Microsoft has an
established developer base, while Adobe traditionally catered to
designers, and its main goal today is to convince enterprise developers
(particularly the Java camp) that Flex can be a tool of choice for
creating business RIAs.
About Yakov FainYakov Fain is a managing principal of Farata Systems, consulting, training and product company. He has authored several Java books, dozens of technical articles. SYS-CON Books released his latest co-authored book , "Rich Internet Applications with Adobe Flex and Java: Secrets of the Masters" in Spring 2007. Sun Microsystems has nominated and awarded Yakov with the title Java Champion. He leads the Princeton Java Users Group. He is an Adobe Certified Flex Instructor. Currently Yakov works on the book for O'Reilly "Enterprise Application Development with Flex".