Using AIR to add desktop GUIs - apache-flex

Suppose I develop an application with the logic as a CLI program that can be compiled to various platforms. To add a GUI, I could develop native versions separately for each platform or I could use a cross-platform tool like Tcl/Tk, wxLua, or PyGTK. Some people, like Bruce Eckel and James Ward, promote Flash/Flex on Adobe AIR for this.
I've looked into it, but haven't been able to find clear answers to these basic issues.
Native look and feel
The Spark architecture in Flex 4 improves support for skinning to the extent that you can match any L&F, it seems. What resources are available for implementing Windows/GTK+/Cocoa L&F and how much work is it?
Responsiveness
I would rank these popular toolkits from most to least snappy: FLTK, FOX, GTK+, Tcl/TK, Swing, Qt. Where does AIR fit in this range?
Stability
For a long-running app with extensive user interaction, how are the stability and memory management? I've read that memory leaks have been a significant issue with AIR.
Local system access
I think the biggest complaint about AIR 1 was its isolation from the local system. Now, AIR 2 adds communication via stdin/stdout with the NativeProcess class. How well is this working out for implementing the functionality you typically want in a GUI?
Package size
Ranging from a minor interface with a few buttons and textboxes up to something like an IDE, how big would an AIR version be, compared to say, something in Tcl/Tk or wxPython?
Hand coding
If you don't use Flash Builder, how hard is it, relatively, to create or maintain a nontrivial project?

Native look and feel: It's possible to skin a Flex app to make it look native. And load a different skin depending on the OS. There are already Windows and Mac skins (not sure if they are Flex 4 compatible yet) available on www.scalenine.com. But these skins will never be a 100% match since it's replicating the l&f, not actually using native widgets.
Responsiveness: I'd guess it's probably somewhere between Swing and GTK+. But I don't have benchmarks to back that up - just my personal experience.
Stability: As long as the code is good and objects are being GC'd then things should be fine. AIR 2 fixed some memory leaks that caused the issues you reference.
Local system access: NativeProcess allows you to do pretty much anything. But more complex use cases probably need something like Merapi.
Package size: The entire UI component set in Flex is around 2MB. Then any custom code will add to that number. Usually the bitmap assets are what really bloat SWF files. You can look at Apparat as a way to reduce the size of SWF files.
Hand coding: I hand code all of the time with just the open source Flex SDK, AIR SDK, and vim (my text editor of choice). That's all you really need. But you will lose out on code completion, visual debugging, etc. But there are some other open source tools out there for doing these things.

Related

Will a Flex app run on a mobile device?

Can a Flex application that was designed for use on a PC be run on an iPad, iPhone, or Android-based mobile device?
Seems like a simple enough question. Visiting http://www.adobe.com/products/flex.html yields a picture of a dude running a (presumably) Flex application on an Android. So at first glance, the answer would appear to be "yes." End of story.
but yet…
There is so much (mis)information out there on various tech sites that suggest Flash-based technologies simply won't run on iOS or other mobile platforms. Why is this? Perhaps they mean to say that Flex won't run "out of the box" and requires a plugin? Or do they mean it won't run at all?
Every time I think I've reached a definitive conclusion, some post on SlashDot or CNET directly contradicts it. So what's the scoop? Can one take an existing Flex application and run it on iOS/Android? (I realize there are screen size issues to consider so the app might not run effectively. I just want to know if the runtimes are available on the mobile devices to allow the Flex app to launch at all.)
Sorry for the noob question. My background is WPF / HTML5. Adobe technologies are completely foreign to me.
I wrote a lot below if you'd like to read it enjoy, if not sorry for taking your valuable bytes :) I directly answered the questions up here first:
Why is this?
It's a confusing matter read below for the why details.
Perhaps they mean to say that Flex won't run "out of the box" and requires a plugin?
Or do they mean it won't run at all?
Using the flash builder tools (the bin folder in the SDK) you can compile for native desktop application, desktop web browsers, native iOS application, native Android application. Android with FlashPlayer plugin installed will show Flash content within the web browser, iOS will only run the ones compiled with AIR, not in the the web browser but as a native app.
Every time I think I've reached a definitive conclusion, some post on SlashDot or CNET directly contradicts it. So what's the scoop? Can one take an existing Flex application and run it on iOS/Android?
Yes, if using AIR and run as a native app on all three platforms (the desktop Flex API is for the most part a superset of the web Flex API), your other points about performance and form factor are valid and should be considered though. The nice thing is you can write your model/controller code in a common library in AS3 then write separate presentation layer interfaces that all share the library.
Here's the very long version:
Using the flash compiler results in "bytecode" in the form of a file with a swf extension using the swf format, you can read a ton more about that here:
http://www.adobe.com/devnet/swf.html
To interpret the file you need some sort of run-time similar to some degree to running WPF/XAML/C# within a .NET framework context (either desktop or using silverlight on the web). In the case of adobe technologies (rough equivalence):
AS3 = C#
MXML = XAML
Flex = WPF+WCF (client side RPC not server side)
Flash Player = Silverlight
AIR (Adobe integrated runtime) = .NET
Framework Redistributable .dll(s)/.so(s) for desktop OSes
(Read this list very loosely please, I know XAML is preserved in the MSIL or whatever which is different because MXML is compiled to AS3 and only if a debug flag is set on the compiler does it include the debugging symbols, there's certainly tons of differences but I think this is an easy and correct enough model to use)
On iOS the browser does not allow for plugins in the traditional sense of netscape browser plugins or ActiveX plugins. For this reason you'll not be able to execute a plugin ie flashplayer or silverlight in the browser. Since Adobe did release a flashplayer for Android devices that does run in the browser it will work on those devices in the browser, however they have essentially thrown in the towel for supporting this long term, as they have to support the majority mobile device platform, iOS, in order to remain relevant (this was I think more a collective throwing in of the towel by Google, device manufacturers, carriers, Microsoft, all just following suit and trying to make the best business decision, WebKit and V8 or SpiderMonkey can probably do 99% of what Flash can do and better in some cases and WebKit will hopefully not splinter and will remain open source... frameworks and the browsers just need to get fleshed out and stabilized).
If the user installs AIR (or the runtime is packaged with the app) then a Flex/Flash (that is stuff coded in AS3 and/or MXML and compiled to a swf) can be transcoded/packaged to be interpreted by the run-time for that device correctly (be it iOS or Android or whatever RIM did, I don't think they have AIR for Windows Phone 7 and Win8 on ARM won't support browser plugins either). Part of the confusion is possibly from the fact that Apple denied the distribution of Apps that were "cross-compiled" which kept AIR out of the list of options for iOS for a good year, just after Adobe started announcing it was usable for that purpose (kicking Adobe while their down). Another part of the confusion probably comes from real vids of people who have 1 hacked their device or 2 were able to get open source alternatives to the flash player run-time to work on their iOS device (gnash was one I'm aware of from some occasional Linux tinkering, also possibly FAKE vids).
You can run Flex applications on mobile devices, but you cannot simply run any Flex project.
In Flash Builder ( Flex Ide) or in Flash Professional you can create mobile projects. These projects generate native applications for iOS and Android.
Last time I tried, the result and the available components where less than what I expected. So, if you can, I'll much recommend you go for something like Appcelerator.com or similar, which turns HTML5/Js code into native apps. I tried them, worked a lot better than Flex.
Short answer: No
Long answer: You can use Adobe's tools to compile your Flash/Flex app for use as a native iOS app. So you won't be able to embed the app in a web page like you normally could with Flex, but you can build it as a native app. Note you have to have Flash Builder 4.5 to do this.
It won't run on iPhone as a .swf file, but it will run on Android based devices that have adobe flash installed. It will also run on the BB playbook, which also has flash.
Flex is a framework.( Anyway it is very beutiful one which even sometime looks like complete different language ).
As soon as you are building AIR application it can run on various platforms like : Windows, iOS, Android, upcomming TV's, PlayBook, even .. into the future ( maybe/hopefuly ) on Windows Phone, plus Linux ( which AIR future is not very clear anyway ( but hopefuly Adobe will reconsider ) ).
So - application created with Flash Builder 4.5+ would probably run everywhere as soon as it is AIR application.
The compilation methoods is really simple, and you almost simultaneously compiling for everything you wanna to.
And one of the most important things here - your applications will run, work, look and feel the same way you were designed on one device. Flex is the thing which is responsible for everything to looks beutiful on each platform it is running.
For instance i am compiling currently for Android, and without even test i can clearly say that it will looks and feel the same way under iOS and Windows, and it will.

What are the pros and cons in C++ Qt vs Eclipse RCP for cross-platform GUI development?

I am going to develop a new GUI for an existing C++ application. The application works on Windows and Linux, and the communication with GUI is through client/server.
What are the pros and cons between Eclipse RCP and Qt?
Some pros of Qt:
C++ stuff will generally perform better; however, this is arguable.
Qt is the base of Meego, the mobile platform sponsored by Intel, AMD and others; however, its current momentum seems not too high to me. This means you can also create applications for various mobile and generally embedded devices
There are a lot of Qt-based applications out there.
It has a WYSIWYG designer.
Good for small to large projects especially because of QtQuick, which allows the creation of small applications in no time and with almost zero knowledge about C++
Qt has an amazing wrapper in Python called PyQt (there is also the PySide of course), which allows rapid development and slick prototyping. People often use PyQt (or PySide) for the UI-side of a Qt application because of that. You can of course combine with ease Python and Qt in the same application taking advantage of all their strengths (but also weaknesses). This allows relatively fast and smooth development cycles even for large projects
Some cons of Qt:
The code of Qt-based applications make use of some elements that are not part of C++, which have to be converted into C++ by a special preprocessor called moc (Meta-Object Compiler) prior to the actual compilation. You and your build system have to take that into account.
Nokia (former owner of Qt, since it acquired Trollech) has sold it to Digia. However, this does not imply their involvement in the development of the open source Qt has changed.
Some pros of Eclipse RCP:
Eclipse RCP is far more than a graphical toolkit:
It sports a plugin-based architecture that can help distributing functionality among different components (plugins) and keeping control over dependencies among such components (plugins). Eclipse plugin system relies on their own implementation of the Java component system specification called OSGi.
It provides a mechanism to enable decoupled application extensibility called extension points.
There are many Eclipse plugins that you can use in your application and many of them have distribution licenses that are friendly to commercial products.
It has a WYSIWYG designer.
Some cons of Eclipse RCP:
Eclipse uses a custom windowing toolkit called SWT; on each platform it relies on the native graphical layer. On Linux, it relies on Gtk+ (although it's also possible to use Motif), which in my experience (and other's) has performance problems, mostly with widgets that are updated at high rates. Actually many of us embed Swing elements in Eclipse RCP applications to overcome performance problems while keeping Eclipse's extensible architecture; this, however, can bring integration problems. There's a version of SWT that uses Qt as backend, but its incorporation into Eclipse's codebase seems stagnated since October 2010.
Startup time (understood as the time elapsed since the application is launched until it shows up a window) of Eclipse RCP applications can be very long.
If you intend to integrate C++ stuff with Java by means of JNI, be aware that some people find it difficult.
Eclipse has lots and lots of bugs. Eclipse's bugzilla is a very useful resource for the RCP developer.
The more you want you Eclipse RCP application's look&feel and behaviour to differ from Eclipse IDE, the more troubles you will get into.
Eclipse RCP development has a big learning curve, in my opinion.
Using Eclipse RCP for small projects is basically a suicide (unless you are restricting yourself to only creating a plugin or similar). It is meant for medium to large and very large projects due to the complexity of its infrastructure, resource requirements and the above mentioned steep learning curve.
Eclipse RCP is not for mobile development because...it's RCP (Rich Client Platform). If you want to go mobile, this is not for you.
Both their distribution licenses (LGPL/GPL/commercial for Qt, EPL for Eclipse) are flexible enough for most uses, in my opinion. Nevertheless, I am not a lawyer, so I may be mistaken about that.
And of course, other factors like the experience of the developers, their technical skills, the size of the team, concrete requirements, etc, should be taken into account.
BTW, I have much experience in Eclipse RCP but only theoretical knowledge on Qt, so I may be biased/mistaken in my statements.
Now that Qt has an LGPL license I would choose Qt any day of the week over Eclipse RCP.
I have used both to create fairly complex applications.
Since you can use eclipse to develop c++, I am assuming that we are comparing mostly swt/jface vs Qt, and not the eclipse development environment itself.
Some things I have noticed having used both:
1) Qt has better documentation and samples
Other than some half-baked examples on the web, I could find little useful eclipse documentation.
2) Qt has a lot more 'professional' users
There are many professional companies out there using Qt as their UI framework. Given it's three platform support (Windows, Linux, Mac), it is very flexible, and has a lot of backing.
3) Qt tends to be more complete and mature -
Using Eclipse I noticed that quite often the controls, and packages that were available were only partially done, and not quite complete. They were typically developed for someone's use, and only coded as far as that. Qt's controls were almost always a complete design.
4) Styling.
Both Qt and Eclipse render using local platform libraries, so your UI will 'look' like other UIs on the platform you are running on (i.e. Linux vs Windows). However, Qt also provides fairly sophisticated styling functionality that allows you to easily alter the look of any control, and gives you much more control over the look of your application.
With the new declarative language (Qt 4.7.*) you are approaching WPF level of control which is really amazing.
5) UI Designer:
Qt has a much richer Designer that allows you to layout your form, and do basic testing without having to compile any code. The designer also gives you the capability to add interactions between the controls on your form. Ex. Click this button - disable this option
Eclipse also has a form designer, although my experience with it is limited. I did try to use it a couple of times with very limited success. Finally I coded every form by hand through code. That is painful.
6) Interfacing with existing source code
If you don't have this problem, then you are very lucky. Because Qt is c++ based it integrates seamlessly with legacy C and C++ code. Integrating Java and C is not easy.
7) Drawing Libraries
I tried coding some hand-drawn shapes using the swt libraries and was forced to bypass large parts of the swt drawing library, because of the cludge that was in there. Using Qt to do something similar was no trouble at all.
8) Tree and List Models
Eclipse does provide some nice out of the box functionality for propagated data into trees, and lists and things. It is almost as good in Qt, although a little trickier to set up.
9) Application Layout
Eclipse provides some nice functionality to manage 'view's (dock panels), and 'perspectives' (workflows) that if you decide to use them makes life nice and easy. Qt requires you to do this yourself. Qt does have dock panel functionality, but when building a rich application you have to set this up yourself.
Extra Note:
Qt has also provided some extra libraries to support things like xml, etc... So this helps bridge the gap a little between c++ and java for things like this.

Adobe Air - How to make a hello world?

I am using Fedora 12 (linux) Installed Packages adobeair.i386 2.0.2-12610 #adobe-linux-i386.
I want to make a simple "hello world" application which is able to run in my desktop and also via http://localhost/air/index.php
Can someone please show me step by step, a working example?
Thank you
Regards
N.B: What are the differences between Adobe Air and Adobe Flex? Can you share please, seems very confusing, i could use C++ (which is Air) and i could use PHP (which is Flex), like that kind of difference?
The AIR app won't work in a browser. For the web version, you would use Flex and for the desktop version you would use AIR. Both applications can be written in Actionscript 3 however, unlike Flex apps, AIR apps can also be written in HTML/JS. If you write your apps in Actionscript 3, your Flex and AIR apps could use almost identical code. Obviously, there are a few classes which can only be used in AIR as these related to desktop functionality. If you look at the Actionscript 3 reference (http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/), you can see which of the classes are AIR only and which can be used in both Flex and AIR.
AIR files are exported as .air files while Flex file are exported as regular Flash .swf files.
As far as, "C++ (which is Air) and i could use PHP (which is Flex)", that is sort of right. AIR is a replacement for C++ in that you can write desktop apps with both. However, because of the AIR runtime, you do not have to write different versions for different operating systems. the one AIR app will work on Windows, Mac, Linux and now Android phones. With C++, you'd have to modify your codebase for all of these environments. Flex is not like PHP however, it's client side so is more like a more-powerful Javascript. You can have a Flex app talking to a PHP backend (using AMFPHP or Zend_AMF to communicate) which handles all the server-side stuff like retrieving data from a database and sending it back to the Flex app running in the browser on the client. Flex is sort of like a collection of components (it's officially an SDK) to make writing web apps easier. So, for example, there's drop-down menus, date-pickers, datagrids, trees, video displays, etc, plus everything else that's available in Flash. IMO, the best thing about Flex development over HTML/JS development is the layout model. You can make some very complex fluid layouts very easily in Flex which adapt to different screen sizes. You also don't have to do much in the way of cross-browser testing - it looks the same in all browsers on all OSes as long as the user has the approriate Flash Player. It's also very fast when handling lots of data and makes it easy to mix many different multimedia components, video, audio, etc, in the same app. Some good apps written in Flex are Aviary, Photoshop.com and Buzzword. Some good AIR apps are the eBay desktop client, Feedalizr, Seesmic Desktop, etc.
This could've been solved by googling "adobe air tutorial hello world", but here's the link to Adobe's official air beginner hello world tutorial: http://help.adobe.com/en_US/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7ecc.html

What's the advantage of an Adobe AIR app over a traditional desktop app?

I'm pretty familiar with using Adobe Flex & AS3, and compared with writing apps in JS/HTML I think it's very cool. However, since AIR is essentially a non-browser version of Flex with benefits like local storage, it seems to be competing as a cross-platform desktop application platform... and in that space it's much less mature than more established desktop technologies.
So what's the advantage of creating a desktop application using AIR compared to something like Java (or C++ using a cross-platform GUI library like wxWidgets)? Java's equally capable of communicating with the server for instance, I'm not quite sure what AIR adds when competing head-to-head in the desktop development world?
In my opinion the biggest advantage is productivity (if you are interested only on desktop)- it's much more faster to build a nice UI using Flex compared with Java Swing for example (try to build a transition in Swing). Also the new components from Flex4 allows to do component skinning much easier.
However (as written by Groky) you should take into account also the disadvantages. It would help if you write down what are the main features of your planned app and check how they are handled by various platforms. For example if multithreading is needed AIR is a bad choice.
AIR takes the goodness of Flash Platform cross-platform and as of 10.1 across many cutting edge mobile platforms as well not to mention that Google is actively working with Adobe on the mobile AIR for Android. That's the key perspective here and I think you don't doubt the fact that Google's open-source platform will be big. Android devices make the fastest growing chunk of mobile platforms already. Also, think of the upcoming Chrome OS. Is AIR going to have a role there? I bet it will.
IMHO AIR makes it a lot easier to deploy rich applications across platforms. Rich Applications as in terms of Flash Platform.
See what Wired has done with Adobe on ePublishing. That should answer this question well.
In my experience there is only one advantage:
Cross-platform
However there are a number of disadvantages:
No communication with native platform except by installing a separate server!
Native window handling is very primitive (no modal dialogs!)
Less mature (i.e. buggy)
Fair Question. Well to begin with AIR is not "a non-browser version of Flex" or "a non-browser version of Flash" ADOBE AIR is a run-time that hosts applications created in a variety of protocols including: HTML, JavaScript, AS3. If one is so inclined tools like ADOBE Alchemy will let users who prefer C++/ JAVA to compile code into SWCs and SWFs.
From a designer's perspective ADOBE FLASH, DREAM WEAVER, and FLASHBUILDER provide seamless desktop application development. While from a developers stand point the same code used for web based content becomes available creating desktop application with little to no recoding. This is all without mentioning the ability to leverage existing E-commerce and web based marketing APIs and SDKs; creating a dynamic intelligent experience for the end user on the desktop.
For me and my company, the main advantage is that it's the same code on our website as in our AIR app. This could be a Flex app or HTML/JS app, but you keep the same single codebase.
AIR 2.0 will address Groky's issues, with access to native applications, better window handling, and much less memory intensive, which led to lots of bugs in 1.0/1.5.
If you don't have a web app already, and you're not locked into AS/JS, then there's no real reason to go with AIR over Java/.Net/PxWidgets... unless you like the look of the latest Flex 4 components, which is quite nice.
I think it's because:
Cross platform
Very easy to develop - learning AS/JS/HTML is much easier than learning C++/Java/MFC. Most of the requirements are not that strict. I developed many tools with AIR/Flash for myself to save me hours of work. If I do that in C++, I will surely waste more.

What technology for a rich UI desktop application?

For an internship, I'm gonna have to develop a desktop application. The focus is creating a rich UI ( cool effects, sound etc ). Which tech should I go with ?
- Flash ? ( in this case, shoud I go with a flex project ? AIR ? what is the gain between this and a simple raw flash project )
- C#/Silverlight ?
Any other possibility ?
If experienced developers could give their advice, that would be great thanks.
The best technology to use is probably the one you're most familiar with, unless you mean you're going to be learning on the fly. But for the various options I'll take a stab.
Flash itself (the runtime) is a browser plugin, so that's not what you want, but if you build your application in Flash or Flex (the authoring tools), then you can publish it as an AIR application. AIR is also a runtime - basically it's Flash, plus a bunch of extra APIs for running outside the browser. The advantages to making an AIR app are:
The same app runs on win/mac/linux
You can make it with the same skills/tools you use for Flash (dubious utility if you don't have those skills/tools, of course)
Close tool integration with other Adobe tools (photoshop, after effects, etc.)
The main disadvantage is incomplete access to native (i.e. OS) capabilities. The way a runtime allows you to run the same app on win/mac/linux is by restricting you from doing some of the things that you could do with a native application.
As for Flex, whether you use Flex or not is a separate question. Flex is a framework within Flash - an AIR app can be made using Flex or not using it. Basically, if you expect your app to have a lot of controls, slider bars, charts, accordion panels, etc., you might look into Flex. If you expect it to have a lot of animations and pictures and sounds, plain-old-Flash may be better.
Apart from Flash, the other main choice for a runtime is Silverlight. The advantages there are, to be honest, basically the same. You use .NET instead of ActionScript, and the tooling integration is with MS' Expression suite instead of Adobe's creative suite, but the development process and the results are quite similar. The choice between AIR and Silverlight is really a choice between Adobe tools and MS tools, and between two programming languages of entirely comparable power. Most everyone simply uses the one they're more familiar with.
Finally, the other set of options is not to use a runtime, and to simply compile an app from any language/development environment you like - C, C++, .NET, Python, anything. The advantage here is you get (in general) full access to OS capabilities. The disadvantages are, you (in general) need to do extra development to run on multiple platforms, and also I don't think you'll find a language/environment that lets you work with multimedia as easily as you can in AIR and Silverlight.
Depends what programming languages are you proficient in. If you are .NET/C#/VB.NET guy go with SilverLight or WPF. If you know ActionScript, go with Adobe line of products.
My preference goes to the (slightly) most opened universe. Assumed that you know how to write Object-oriented programs, Adobe is using Eclipse as a base for his tools, using plugins.
Actionscript is just like Javascript syntax. You just have to learn the flex 4 libraries.
Then, publish you app as an Air desktop application that can run everywhere. Really everywhere
The only thing to know about MS tools and languages and libraries is that they are very well designed and usable. and it runs on Win and mac also. and Only.
If the main request is to have a rich UI the simplest approach is to build a Flex application running under Adobe AIR platform. The answer to the questions Flash or Flex is very simple: if you are a designer go with Flash, if you are a developer stay away from Flash and use Flex. The Flex framework was created for developers, and is really hard to replicate all its features in Flash (think only what you have to do in Flash if you want to resize your app).
On the other hand if you are coming from a .NET background it will make more sense to stick with Silverlight/C#
I'm not sure if this helps but I'm developing in Flex and now I have started to learn Silverlight and I can say that developing in Flex Builder is much more faster then developing in Silverlight( Visual Studios ) . For me Flex Builder is much better because you use only one IDE to develop both back and front end. And that's when it comes to web development. If you want to do desktop applications then you do the same thing and a plus is that you get everything in only one file. You also have a small SQL database that comes with it.
But on the other hand when you develop in Silverlight you have to use several IDE's or tools outside Visual Studios to make awesome graphics. But if you want to have more time for design then I would suggest to use Flex Builder and not Silverlight.

Resources