I've been a zone leader with DZone since 2008, and I'm crazy about community. Every day I get to work with the best that JavaScript, HTML5, Android and iOS has to offer, creating apps that truly make at difference, as principal front-end architect at Avego. James is a DZone Zone Leader and has posted 639 posts at DZone. You can read more from them at their website. View Full User Profile

James Ward on Flex, AIR and Java

04.29.2009
| 19970 views |
  • submit to reddit
Artist:James Sugrue Plays:244
Length:31:16 minutes (8.95 MB) Downloads:19062
Format:MP3 Mono 44kHz 40Kbps (CBR) Download:Click to download
Listen:

About this podcast

I recently had a conversation with James Ward,Technical Evangalist for Flex at Adobe. We started by discussing what Flex and AIR are, and the differences between them, before moving onto Flex's integration with Java, the competing technologies (JavaFX and SilverLight), the use of Flex in the next generation of Eclipse, and what James would use for development if I took Flex away. 

Adobe Flex®, part of the Adobe Flash® Platform, is an open source framework for building RIAs that run in the browser using Adobe Flash Player software, or outside the browser with the Adobe AIR™ runtime.  Download Adobe Flex Builder™ Free 60-day Trial and the Adobe AIR SDK.

 

James Sugrue: Today I'm here with James Ward from Adobe and we're going to talk a little about Flex and AIR integration. Hi, James, how are you?

James Ward: Good, how are you, James?

Sugrue: I'm very good. Can you tell us a little bit what you do, please?

Ward: Yeah, sure. I'm an evangelist for Flex at Adobe, and I focus mostly on the enterprise software communities, a lot of Java and also just working with integrating companies like Oracle, Salesforce.com into it, and others.

Sugrue: And you do lots of talks at conferences and things like this?

Ward: Yeah, definitely. I speak at a lot of conferences, mostly Java conferences. And then I also go to Java User Groups. I'm on a Java User Group tour right now, going to a bunch of JUGs all over the US and talking about how to integrate Flex and Java together. So definitely a big part of my job is just getting out there and teaching people about what Flex is and how to use it. Also writing blogs and a book and articles and all that sort of thing. So, yeah.

Sugrue: And at the conferences, do you get good feedback on Flex? Do you people ask you a lot of questions about the problems they have with it, or not problems but just how to use it?

Ward: Definitely. There's always a lot of people who want to know how Flex works in their specific environment. Everyone's got different use cases, and they want to know how Flex will work them or how it won't work for them. So it's always interesting, that interaction with people and I get to hear what they need to use it for and what their requirements are. And also, I run into a lot of people now that are using Flex and are loving it. So it's great to hear from them, what their experience has been like and what they want to be better and what they love and all those sorts of things.

Read James Wards Flex Refcard Click here to read James' Refcard on how to get going with Flex.

Sugrue: Excellent. I'm a Java developer mostly. I haven't really done much with Flex. I've played around with it a little bit. So I suppose I've got a few of the more basic questions about it. Maybe you could start out with what is Flex and how is it different from Flash?

Ward: Sure. Flex is a developer tool that allows you to develop Flash-based applications. So Flex apps can either run in a browser inside Flash Player, or they can run on a on a desktop with Adobe AIR. So Flex is a developer tool: the components, the compiler, the debugger, all the language features, all the stuff that a developer needs to actually write code to build those applications. So traditionally a Flash application or Flash content was built on a timeline-based tool called Flash Authoring. But developers don't think in terms of timelines, they think in terms of objects and method calls and properties.

And that’s what Flex is, it started out as a way for developers to think in terms of objects and build applications by assembling objects together and not having to use the timeline-based tool to take advantage of the Flash Player and the ubiquity of Flash Player.

Sugrue:  Would it be fair for me to say that Flex is the Flash SDK, to put it in simpler terms?

Ward: Yeah, I think that's definitely a good way to look at it. It's definitely an SDK to build Flash applications. So I think that's a good way to put it.

Sugrue: As far as I can tell, it's a bit of MXML and a bit of ActionScript? Is that correct.

James: Yeah, that's correct. And let me give a little bit more input about that. ActionScript is the core language of Flex. It's an object-oriented language. It supports static typing. So it has a lot of the language features that you'll find in Java or C#, but it also has the option for a developer to do some dynamic stuff as well. So that's the core language, that's really what everything ultimately is before it becomes byte language in Flex. MXML is an optional declarative language that wraps ActionScript. So it's not a general purpose language; there are no loops and additions in MXML. It's purely declarative. So all that can be done in MXML is substantiate variables or set up properties on them.

So it's really pretty oriented around building user interfaces, describing user interfaces with a declarative language. But that can definitely also be done in ActionScript. So it's really up to the developer when they use MXML and when they use ActionScript.

But there's certain things that can never be done in MXML. You can never talk to a web service with MXML, make an RPC call. That sort of things, to parse data, that has to be done in the procedural language, which is ActionScript.

Sugrue: So I suppose that MXML is a kind of clean separation, in a way, between the design side of things and the dynamic?

Ward: Yeah, definitely. The declarative is there probably for a couple of reasons. One of them is that a lot of developers who come to Flex are coming from the HTML world, and they're just familiar with having declarative way of laying out the user interfaces. The other reason is that for tooling support in Flex Builder, the Eclipse-based tooling, it has a design view in it and design view tools really need a declarative language to work well. So that's the other reason for declarative languages, just tooling support.

Sugrue:  And then we've got AIR. So AIR is for the desktop. How does this relate to Flash and to Flex?

Ward: AIR is the desktop runtime for Flex applications. What that means is that - usually people are pretty familiar with Flash Player being inside of the browser. But there's definitely some security sandbox limitations with running applications within the browser. And so what AIR is, is a way to take Flash-based applications and run them as desktop applications. And so then they get outside the browser sandbox that actually have to be installed on the user's machine, and they then can do a number of things that you just can't do inside the browser. Just do a little file system, do system notifications, do applications, do SQL Light, persistence data locally. So there's a number of APIs that are available to AIR applications that you just don't see inside of the browser.

Also, the web kit, HTML rendering application is part of the AIR run time. So that means that HTML and JavaScript are fully for citizen inside of AIR . So, that's what AIR is. That's the same development environment. You build an AIR application and you can reuse code between the web and the desktop, just that the packaging, deployment and APIs that are available, are different between if you run it in the browser or if you run it on the desktop.

Sugrue: It's always interesting with Flash that the amount of machines that is is downloaded on is maybe 90-something percent of all machines. Do you have any download statistics for the AIR run time to show how popular it is at the moment?

Ward: Yeah, it's really grown in popularity. We published numbers a few months ago that AIR, which has been out for a little more than a year now has had 150 million installs. So that's we debated back and forth over which number to publish, the downloads or the installs. Some people when they talk about their adoption, they are only publishing download numbers. We thought it was more useful to talk about actual successful installs of AIR and so they're definitely very different numbers. And so we announced that we had had 150 million installs of AIR and that was a couple of months ago now.

Sugrue: That's really good. I guess there's a lot more AIR applications to show off now. The main one I can think of is Tweet Deck, a Twitter application.

Ward: Yeah, Twitter is a hot spot for AIR applications for sure, a lot of them.

Sugrue: Actually one thing I have heard about Tweet Deck is the memory used. Some people say it's quite high. I haven't actually seen this happen myself. Are there any reasons for this or is it just best practices in programming?

Ward: A lot of the times when you run into memory issues with Flex or AIR it's just because the developer is not coding in a way so it's filing objects to garbage collected. And so, a lot of the times, there are simple ways to deal with this just by making sure that references are being removed. But the Flex SDK and AIR certainly are not 100 percent bug free. So, in some cases people are finding memory leaks and the AIR team is working with SQL to get those addressed and fixed. I think in the case of Tweet Deck the AIR team was working directly with them to resolve some of the memory issues and I think they have had pretty good success so far.

Sugrue: Good to hear. So AIR and Flex can really be used together. You can have the idea of single sourcing that Java FX is really pushing at the moment that you can write for the desktop or for the browser from one source. Will that be possible with Flex also?

Ward: So with Flex you can definitely reuse things between a browser application and a desktop application. But inside the browser you don't have access to a lot of the ATIs that you have in AIR. So, what people do most of the time is they'll actually have two different versions of their application which have a lot of common code. But the AIR application will have additional functionality for offline data synchronization which can't be done inside the browser. It's just a notification and application update.

So there will be some part of it is specific to what can be done as an application. So for the most part, yeah, most of the code is fully reusable between the web and the desktop. You want to have slightly different experience for off line or whatever. So there are some small changes that you make between the two versions.

Sugrue: Where can the developer get Flex in AIR and is there a cost in getting started? Is the SDK free?

Ward: Yeah, so the runtimes are all free. The Flex player and AIR are free runtimes. The developer tooling which is the Flex SDK is free and open sourced. It's MPL licensed and that's available on OpenSource.Adobe.com. So that's really if you want to get started, you can get started just by downloading the open source SDK and following some instructions and start compiling open source applications with that. There is also the Adobe professional tooling for Flex called Flex Builder that is Eclipse-based, the tooling and that is commercial. There is a 60-day free trial. And then it is also free for students and educators.

Then also currently we're doing the Adobe stimulus package to anybody that has currently unemployed, been laid off, they can get a free copy of Flex tool there to hopefully help them find a new job. Learn Flex and find a new job. So there's information by searching Google for that.

That's a good way to learn, if your 60-day trial runs out you can just switch over to the Flex SDK and it's the same functionality, just without the Eclipse plugin.

Sugrue: It's great to hear you are doing that stimulus package, by the way. I think it's fantastic. It's great to just get people looking at newer technologies. It's a great opportunity maybe for people to learn the latest stuff. So is there any free alternatives to Flex Builder? Has anyone tried to do an open source version? It looks like it would be a big undertaking to me.

Ward: Yeah, it would be a big undertaking. There is an open source project, at least one that we know of out there that is working on an open source Eclipse plugin for doing Flex development. And I don't remember the name of it off hand. I'm sure some Google searches would find that. That's one option. Last I checked, didn't have an XML support yet, but it does have action scripts support. Also there are some other options like IntelliJ now has Flex support in their tool. I met a guy in New Orleans last week was working on a Net Beams plugin for Flex support which was also open source. That may be another option. I'm not sure how far along that one is.

There are definitely some community efforts beginning to spring up and I'm going to let some of those evolve and people get involved and contribute to those and make those open source efforts better.

Sugrue: Speaking of community actually, it reminds me of the Eclipse e4 project. I'm not sure if you're familiar with it.

Ward: Yeah, I've looked into it.

Sugrue: Yeah, it's interesting that one of the targets for the applications in their compilations is to generate Flex applications or Flash applications.

Ward: Yeah. It's pretty interesting. They're allowing you to write SWT code and then that compiles down into ActionScript and then compiles using the Flex SDK down into byte code. So it's pretty interesting to be able to write Java code in SWT and run it inside Flash Player. So I'm definitely excited to see where that goes.

Sugrue: Would it be something that, as an evangelist, you'd get involved with, in the newsgroups or anything, or even in the development? Or because it's outside of Adobe, is it just something that you keep an eye on and maybe pass on bits of advice?

Ward: I would love to get more involved with that. I think it's pretty interesting to be able to write Java code, especially for existing SWT developers. So I think there's certainly some value to that, and I don't see any reason why I would not want to be helping people to be aware of that and adopt that. So, yeah, I think it's an exciting project and we'll definitely have to see where that goes.

Sugrue: So for people who want to get started with Flex, we know where to go and where to get the runtime and what dues are available. But are there any sites that you'd really recommend as their first port of call for learning Flex?

Ward: Definitely check out Tour de Flex. Tour de Flex is a great resource that has tons of code examples in it and components, and really will give people an idea for how to start writing some of these applications. It goes over everything from UI controls to the data access controls to custom components that people in the community have built. So Tour de Flex is really a great resource to get started. Also, I worked on a ref card for DZone called "Very First Steps in Flex." And that was a couple chapters from Bruce Eckel's and my book called "First Steps in Flex." So that's another good resource to help people get started.

I definitely just encourage people to download Flex, either the SDK or Flex Builder, and give it a try. It's pretty easy to start learning and start writing verifications. There's a lot of articles and blogs out there about how to do it. There's the Adobe Developer Connection. Adobe.developer.com had a Flex section with a ton of information in it on how to get started, and them more in-depth articles as well.

So, yeah, there's so much content out there. Definitely Tour de Flex is a great place to start as well as the "Very First Steps in Flex."

Sugrue: As a title for a book, it definitely catches your attention. I was curious about the book. Where does it end? Where does it leave the reader? It obviously gets you going at the very basics and explains everything all the way. What is the ending of the book?

Ward: The whole kind of theme of the book was to write something that was going to help people take those first few steps. We wanted to keep it short, so it's actually only about 103 pages. And just point people into the directions for when they need to go and learn now. So throughout the book there's further learning topics that you can go to firststepsinflex.com and then enter one of the further learning topics. And then that gives you a bunch of links for where you can go learn more about the specific topics.

So we really wanted to give just those first few steps and really empower the reader to go and learn on their own the next few steps. So that's kind of where it leaves them is hopefully having taught them about how to take those first few steps and give them confidence to take a few more.

Sugrue: Are there any courses or certifications available for Flex developers?

Ward: I believe that there is a developer certification program. I don't know a whole lot of information about that. We haven't done as much with that program as we have with - as other companies have done. Sun made a big deal out of Java certification, and we haven't yet made a huge deal out of developer certification. I certainly hope that we continue to invest in that and make it a big deal. But I don't know a whole lot of information about where it sits today.

Sugrue:  Just getting back into detail about Flex, is there a mobile option for it? Is there a way of getting it onto mobile devices or phones?

Ward: There isn't yet. It's something that we're working on right now. We definitely want to be able to take the Flex applications and run them on mobile devices, either as small applications via Adobe AIR on mobile devices, or just as in-browser application. So we want to be able to do both. Right now we're working on getting the Flash Player and Adobe AIR to run on mobile devices as well as on TVs and set-top boxes as well as everywhere. So that's our biggest focus right now in the platform group at Adobe, is working on that. So it's currently under way and we'll definitely be seeing more about that in the near future.

Sugrue: OK, so do you think those options will be available, having it on TV and mobile this year, or do you think it'll go into 2010?

Ward: I don't know if we've announced any specific time frames yet. There were some announcements recently about we working with specific partners. We're working with Android and some of the other mobile vendors. But I don't know if we've announced specific time frames yet. It certainly is work that is currently underway.

Sugrue: The next thing, I guess, is Flex and Java integration. That's something I've been quite interested in, how I can get a nice Flex UI working with my Java backend. Anything I've read about it had Java on the server side. So are there are any other options? Or maybe you could talk a little bit about how to get Flex and Java to play together?

Ward: Yeah, sure. So certainly talking from Flex on the client to Java on the server, there's a lot of different options for that, as you're aware. You can use web services, REST yourself. You can use VMF via ASDS. You can use the Spring BladeDS integration. So there are lots and lots of options for Flex on the client to Java on the server. From Flex on the client to Java on the client to one option that is out there is Merapi. What it does is it allows you to easily communicate over a socket between an AIR application and a local Java application.

So that's the one option that I know of. I can use that Merapi at merapiproject.org. So that's pretty exciting. They are using it for really interesting stuff. They are starting to create Java and functionality that exists in Java that isn't that available in AIR yet for that kind of logic to get outside his limitations and use Java for some interesting things. Or if you already have a bunch of Java code you can take advantage of that that way as well.

Sugrue: I am definitely I'm going to have to check that out. While we're on the topic of Java, what are your opinions on Java FX?

Ward: I think Java FX is really interesting. It's definitely, first of all, proving that Flex is doing some of the right things and having a declarative language and that making great looking UIs important. So Java, of course, which is definitely validating what we're doing. But also I'm not a religious bigot when it comes to technology. I recommend people use the right tool for the job. There certainly are cases when Java FX is the right tool over Flex and I'm not going to argue against that.

So I think that it's great for the Java community to have that available and to be able to build great UIs in Java and using declarative language and some of the other key features that we added in Java FX. So I'm pretty excited about it.

I personally feel there won't be using it for anything that I work on but it's not because I don't like it. It's just don't have projects that require it.

Sugrue: Actually if I were to take Flex away from you, Flash and AIR and everything, what would you fall back on to write your applications, out of curiosity?

Ward: That's an interesting question. I think it would be looking at a Java FX. I would also be playing around more with some of the Ajax frameworks. Things like jQuery and PXGJS, some of these frame works look really interesting. So also some of the just traditional web application architecture or frameworks are also maturing and doing some great things. So I was just hanging out with Howard M. Lewis Ship from Tapestry yesterday. They're doing great things for Tapestry and I would want to play with that kind of stuff again. So there's a lot of great technology out there and never enough time to play with it all.

Sugrue: Yeah. That's true. And what do you think of Silverlight then? Just to bring in that last option that's there.

Ward: Yeah, like Java FX there's a lot of interesting things in Silverlight. There has been a lot of great stuff technology in a lot of what we're doing. I sure that the future will be a combination of Ajax, Java FX, Silverlight, Flex, all these are going to code for us in the future. Silverlight is especially interesting to traditional .NET shops. People that are already using Visual Studio and just familiar with Microsoft and comfortable with Microsoft developer tools. So I think it's going to be great for them. But definitely some real interesting things in Silverlight.

I use Linux a lot and unfortunately the Linux support for Silverlight is not great. So hopefully they improve that. I'd be more interested in taking a look and playing with it. But we'll see where that goes.

Sugrue: So we always hear about the good things about Flex. Are there any limitations? Is there anything that it can't do?

Ward: Yeah, there definitely is. So in the browser one of the challenges that some people have with Flex in the browser is that there isn't a good way to integrate HTML content into a Flex application. It's kind of strange because you would think that you are in the browser, HTML is already there and supported. It shouldn't be hard to render HTML inside of a Flex application. But it's actually pretty limited what you can do as far as HTML rendering in Flex. I hear people have legacy HTML content, if you can call it that, and they need to render that in their Flex application. They end up having to do like these iframe hacks that are really messy and make more problems. So that's definitely one of the places that is a current limitation of Flex. I hope that we do something to address that, but it's definitely a hard point.

On the desktop with AIR the AIR runtime is limited in some ways that you won't find with Java. So AIR applications can't execute local programs. There's no JNI like UPI but you do need call so there's not like USG API to talk to USB devices. Of course, you could talk to them through the default system UPI. They are mounted to the default system, but talking to like a bar code reader or something like that you would have to use Merapi or something. So, there certainly are some limitations with what AIR can do on the desktop.

This is one of those things where AIR and Flex are great for a lot of things, but they're not the silver bullet for everything. So there's definitely check them out and pick the technology that is right for the job.

Sugrue: Definitely. I've learned a lot more about Flex and AIR from our conversation here and I think I understand things a bit better. It definitely sounds like great technologies. For me to say that isn't easy. I'm very much happy with my Java technologies and Eclipse and everything. So it is good to have this type of alternative here. I guess you can write these applications for a specific purpose perhaps you are using these technologies.

Ward: Yeah, definitely. That's one of the benefits of Flex to build a better user interface more quickly. And building software is still not being done by monkeys or computers. It's done by skilled people. So if Flex isn't the magic bullet it's not going to make someone who's not a good coder be able to create great software all of a sudden. But certainly it does open up some options for building better software, more quickly. Definitely.

 

Comments

Joaquin Garrido replied on Thu, 2009/04/30 - 10:33am

Lots of typos, it seems.

Jakob Jenkov replied on Thu, 2009/04/30 - 11:56am

I am a Java developer, but has recently played around with Flex. Getting started is actually rather easy. There is a lot of documentation available for free from Adobe, and most of it is rather good. The MXML is easy to understand I think, and it's not that hard to layout components in a nice way. A lot easier than with SWT or Swing I'd say (I've tried both).

 

There are a few little things in Flex though, that can be a little hard to understand. One of them is the fact that Flex is Flash, and Flash used to be rendered like a movie, with a frames-per-second setting etc. This is fine for games and movies / animations, but traditional applications are usually not rendered like that. When developing games, animations, or custom components for Flex, this little issue becomes visible. It's not a big deal. It's just something to learn to live with. 

 

One more thing that have challenged me, is navigating the UI components at runtime. Like accessing the selected nodes of a tree, table etc. It is actually pretty easy to access these nodes, but are you accessing some table cell objects, or the data directly from the data provider? For instance, it doesn't seem possible to hide a cell in a table, since there seem to be no table cells. Only the raw data, and a Renderer, which knows how to render each row of the raw data. There are no objects corresponding to a table row, in which you can set the background color, make that row invisible etc. Or, at least I haven't found that out. 

 

This is actually one thing I found is missing a bit in the Flex documentation. More detailed description of the individual components. How are they rendered etc. I also really miss a reflection framework in Flex, so you could find out what type you ae looking at, look it up in the FlexDocs. There are nice examples of each component, but the examples do not cover each and every use case. For instance, how do you read the expanded nodes of a tree component, update the data in the tree by reading XML from the server, and expand the nodes that were expanded before again?


 

For those interested I have written a small Tetris Game in Flex. I have also started a small tutorial on how to develop custom components in Flex. Adobe as a 200+ book available on that subject. I have tried to cut it down to the essentials (and basics), and focused on examples. Here are the links:

 

http://tutorials.jenkov.com/flex-tetris/index.html

 

http://tutorials.jenkov.com/flex-components/index.html

 

 

Philipp dsfgsdf replied on Sat, 2009/05/02 - 3:52am

"A lot of the times when you run into memory issues with Flex or AIR it's just because the developer is not coding in a way so it's filing objects to garbage collected."

 

So he blames the developers. That is interesting because I tried the Adobe TourDeFlex demo and memory usage rose to 200MB. Quite a lot for an application that does almost nothing. 

James Ward replied on Sun, 2009/05/03 - 12:26pm in response to: Philipp dsfgsdf

Hi Philipp,

The most recent version of Tour de Flex should use less memory.   More details here:

http://gregsramblings.com/2009/02/24/adobe-air-html-control-flash-content-and-garbage-collection/


Certainly there are some memory leaks in Flash Player and Adobe AIR.  But most of the time when applications have leaks it's due to the developers not removing references and event listeners.

 

-James

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.