Today we release the Flex & Spring Integration Refcard, which is now available to download. I asked the authors, James Ward and Jon Rose, a little bit more about integrating both technologies, as well as getting their views on the future of RIAs and whether JavaFX can fit it's place alongside Flex.
James Sugrue: Can you introduce yourselves to the readers please?
James Ward: I'm James Ward a Technical Evangelist at Adobe for Flex. I've been doing Java development for over ten years and Flex development for over four. I've recently been learning Spring and so far I'm really impressed by how simple it is and how easy it makes testing.
Jon Rose: Hi, I'm Jon Rose an enterprise software consultant and Director of Gorilla Logic's Enterprise Flex practice. We specialize in Java and Flex consulting, which commonly includes integrating Flex with Java back-ends built using the Spring Framework. As a consultant, I still encounter developers who think of Spring as just a dependency injection framework, but we often rely on it for a number of enterprise features, like securing our services (Blaze and otherwise). Up until this point, we have had to write custom code to integrate Spring and Flex. So, I am excited about the recent milestone two release of the Spring BlazeDS Integration project because they have really simplified the configuration for integrating the two technologies, and it is starting to look like the project will be ready for production applications very soon!
Sugrue: Is it very common for people to integrate Flex with Spring? Could you give us some real world examples?
Ward: There is certainly a ground swell happening with Flex and Spring integration right now. It's really beginning to take off. When Jeremy Grelle from SpringSource does a presentation about Flex and Spring one of his slides even states: "Flex is the obvious choice when a Spring developer is looking at RIA"
Rose: Over the last 12 months, our company has seen an increase in customers interested in the Adobe Flex framework. As long time Java consultants, the majority of our customers and prospects already have existing Java expertise and / or infrastructure. So, frequently our customers who are interested in Flex typically also desire to integrate Flex with Spring. For example, I just finished a long-term project with a mid-size financial services company who already had extensive internal Java and Spring skills. However, they traditionally struggled to build user interfaces that excited the users. So, they were able to team myself, and other members of our Gorilla Logic Flex consulting practice, with their internal Java resources to build an enterprise data management application. The application deals with large volumes of data and provides the business transparency into what is happening with their data in real time. Unfortunately, this project was chartered over a year ago, so we were not able to take advantage of the new Spring project with official support for BlazeDS, as it wasn't even announced until December 2008.
Sugrue: What are the main difficulties in getting these technologies to interact?
Ward: Whenever you move data over a wire you have to deal with all sorts of things you don't run into when you are just working in memory. There are many ways to do this with Flex. But the most efficient and maintainable is the AMF binary serialization technology. The combination of Flex, BlazeDS, and Spring makes using AMF to move data between the client and server very simple.
Rose: Without the Spring BlazeDS Integration project, integrating Flex with Spring requires custom code to return Spring beans through BlazeDS. This is because Spring does everything through injections in the Spring container, where a plain BlazeDS configuration expects POJOs that it can instance through its own loaders. In addition to the custom code, you end up duplicating configuration between BlazeDS and Spring configuration files. Now that Spring offers support for integrating the two, there is no longer any duplicate configuration, and all of the service classes can be configured within the standard Spring configuration files.
Sugrue: Can you give some background on the BlazeDS Project. What is it exactly?
Ward: BlazeDS is Adobe's open source Java-based reference implementation of AMF over HTTP. It contains two methods of interacting with a Java back-end: Remoting - a simple way to make method calls on back-end services; And Messaging - a Publish and Subscribe API that can also be connected to JMS or other back-end messaging systems.
Sugrue: What are your favorite things about both Flex, and Spring, as separate technologies?
Ward: Flex makes it much easier to build software that works well. There is too much software out there that is just painful to use.
Rose: Before Spring, building enterprise applications with Java was cumbersome and painful. The Spring Framework played a large role in changing how applications are built in Java, as it not only provided a framework with the features to build enterprise applications in a more elegant way, but it also changed the way the community as a whole thought about solving problems. At this point, most enterprise Java applications look the same, whether they are using Spring or not. Look at EJB 3, it uses POJOs in a very similar way to the Spring Framework, as the developer is able to annotate their Java classes to do things like adding security information, or declaring the class as a web service. So, whether its Spring or other POJO based frameworks, I love the state of Java (on the server) and believe Spring was one of the main driving forces in bringing the platform to this point.
I tend to think of Flex as doing the same thing for user interface development that Spring did for server side development. The rise of the web really brought the quality of user interfaces back to the dark ages. For the first 10 years or so that our industry was building online applications, the quality was low and the cost to build was high. The rise of Flex has really changed the game. Now, software vendors are finally working to provide serious platforms to empower developers to build quality user interfaces (e.g. Flex, SilverLight, and JavaFX). After years of struggling with Java web frameworks, Flex has been a true pleasure to develop with, as it has most of the components I typically need when building enterprise applications. It really is a domain specific language for building user interfaces.
Sugrue: What are your top tips for using Flex and Spring?
Ward: Pick a Flex micro-architecture that will fit well with the Spring programming model. Check out Spring ActionScript, Swiz, and SmartyPants IOC as possible options.
Rose: Both Spring and Flex are about making it easier to build high quality enterprise applications. If you are new to either, jump in with both feet! It won't be long before you are building some exciting features with the two platforms.
Sugrue: How important are RIAs for the future?
Ward: In some ways RIA is just another buzzword. But I think it does indicate that there is a paradigm shift happening in how we build software. The first important part of that shift is a focus on building more usable software. The second is that we are beginning to utilize the untapped power of the client rather than doing everything on the server. Today we call this new shift RIA but in five years we will just call it Software.
Rose: Better user interfaces are important for the future of our industry. This is the only part of the software our users ever see, and for most of the last decade we (as an industry) have ignored the importance of providing users rich experiences. The good news is, that in that time, the server side technologies have matured to an incredible place. So, we really have an opportunity to focus on the user experience without sacrificing other parts of the system. Now that the RIA revolution has began, users are going to demand more and more, and we finally have the platforms to deliver. It is an exciting time to build software.
Sugrue: Do you think that JavaFX can compete with Flex, especially when it comes to interacting with Java.
Ward: JavaFX has its place. There are things that Flex just can't do right now. For instance there is no way, even with Adobe AIR, to natively talk to a USB device. Of course Java can do this today and would be a great choice if you had requirements like this.
Rose: I don't believe anyone in the software industry is looking to Sun for leadership anymore, particularly in the area of user interface frameworks. Competition amongst the software vendors is good for developers, but I tend to think SilverLight is going to provide that to Flex, and not JavaFX.