As I have mentioned previously I have being spending some time looking at Adobe Flex, so it goes without saying that you’ll no doubt find more information in my blog.
First I should begin explaining what Adobe Flash is. Flash is a kinda equivalent to a Java Virtual Machine. It is a zero-install plugin that runs in all browsers. In fact I’ll go so far to say that it has become ubiquitous in that it has a massive installed base. From now on I’ll refer to Flash as the Flash VM as I find that a better qualification.
Just like the Java VM the Flash VM interprets psuedo byte code. It offers a rich API for the UI including a time dimension and streaming animation.
Flex is a language and set of UI component libraries developed to make applications that once compiled can run in a Flash VM. Does that sounds like Java? Yes, Flex is what Java is for the Java VM but for the Flash VM. The Flex libraries provide a plethora of UI components that can be re-used.
Just as with thick UI interfaces of the past and present Flex uses an event based architecture. This allows events to be fired and dispatched to components that respond if the event is valid in their context. This is not a new concept. Java Server Faces and even SAP Netweaver WebDynPro offer exactly the same concept and provide an implementation. Struts and Spring MVC on the other hand are not component based but rather page based. So for those coming from a Struts background with no thick client experience this made be a new learning curve!
With the current trend on e-SOA a new pattern has quickly emerged: MVCS. For most of us the MVC pattern is well known. The “S” of course is for Services. The big difference here is that rather than using the model as is often the case as a go-between to the domain model or back end, we instead use Value Objects that represent objects on the UI. The Service layer acts as an interface to providers and as a factory of Value Objects sometimes also refered to as Data Transfer Objects.
The structuring of the UI is declared in MXML whilst the components are written in ActionScript. These are bundled into a .swf that are run in the Flash VM. ActionScript looks a lot like Java. In fact I actually prefer the syntax. It is also possible to write inline ActionScript in the MXML. Although we frown on doing exactly this in the Java world with JSP’s and inline Java, it is still possible to quickly test. So, my tip would be don’t even think about it. Start as you mean to go on!
Whilst designing a UI using MXML might not be very intuitive once one gets the hang of it, it is easy. Another option is to buy or run the evaluation edition of the Flex SDK plugin for Eclipse. Nice and easy drag and drop with a price tag!
How does this compare with AJAX derivatives such as that from Backbase? Well AJAX vendors provide tools and libraries to extend HTML. Again these are usually also zero-based installs. Taking Backbase as a example, Backbase do not provide a VM in which their components run. No, they provide extensions to HTML that make use of their libraries that must be installed in the browser.
The difficulty with HTML and JavaScript is that different browsers interpret it differently. This is one advantage that Flex and Flash has over HTML and Backbase – Write Once, Run Anywhere. Sound like the Java utopia? Correct.
Here is the crux… doesn’t matter whether it is AJAX or Flash we still need to test the HTML.