Tony Hillerson is a Software Architect for EffectiveUI. He graduated from Ambassador University with a BA in MIS. On any given day, he may be working with Flex, Java, Rails, Maven, Ant, Ruby, Rake, Capistrano, or shell scripts. Tony maintains RubyAMF, a Rails plug-in that allows Flex applications to pass AMF messages to and from Rails. Tony has been a speaker at 360Flex, Adobe MAX, and RailsConf, as well as local user groups. In his nonexistent free time, Tony enjoys playing the bass, playing World of Warcraft, making electronic music, brewing beer, learning Latin, and studying philosophy. Tony lives outside Denver, Colorado with his wife and son, Titus.
Daniel Wanja, a native of Switzerland, currently lives in Denver, Colorado. He has lived in Denver for more than six years with his wife and three children, ages 5, 3, and 5 months. Daniel is a dynamic, skilled enterprise software architect and developer with over 20 years’ experience. He has worked in the banking, insurance, and high-tech industries around the world delivering mission-critical software. Daniel is president and part owner of two Flex and Ruby on Rails consulting agencies, Nouvelles Solutions, Inc., in Denver, http://n-so.com, and ProDesign Sarl in Geneva, Switzerland, http://prodesign.ch. Daniel started the http://onrails.org blog on Ruby on Rails and related matters in 2005.
PrefacePreface
In 2004 yet another framework for making websites appeared. It was called Ruby on Rails, and when web and enterprise developers who had never heard of Ruby before started to work with it, they discovered that it wasn’t like all the others. Why?
Rails offers the promise of fewer configuration files, less boilerplate code, less red tape, and, most of all, the promise of having fun again while programming. Rails was designed to make development more about getting common development tasks done by following conventions, not offering endless flexibility for the remote possibility of connecting up with any number of hypothetical legacy back-ends sometime in the future. By taking away unnecessary choices and offering simple solutions for common problems, Rails lets developers focus on writing applications, and developers have paid Rails back in accolades and adoption.
Around the same time as Rails was emerging, Macromedia (later bought by Adobe) was bringing a product codenamed “Royale” to market as Flex—a server-side Flash compiler. Flash had been experiencing a groundswell of developers wanting to build rich interfaces for web applications, not just animations or “Punch the Monkey” ads. Flash developers loved that they could build interfaces that would be extremely hard, if not impossible, to produce in HTML and JavaScript, but the Flash IDE was more suited to timeline animations. Flex changed all that by offering an easy-to-understand XML language for developing Flash interfaces, as well as a component set that made it dead simple to build applications. Flex 2 made things even better by taking the Flex compiler off the server so that there was no requirement of building and deploying Flash movies (SWFs) using the Flex framework and compiler. Flex 3 is one step better by being open source!
The Flex language has come a long way too. Bruce Eckel, the author of such books as Thinking in C++, Second Edition (Prentice Hall, 2000) and Thinking in Java, Fourth Edition (Prentice Hall, 2006), said it best when he said, “Flex is a DSL for graphics, multimedia, and UIs” (http://www.artima.com/weblogs/viewpost.jsp?thread=193593). DSL, or Domain Specific Language, is a language with terms that match up well with a certain problem domain, and the term DSL should resonate with Rails developers. Flex, more than HTML with JavaScript, is a language for building rich interfaces quickly and easily.
Flex and Rails developers haven’t crossed paths that often, but more and more as the word gets out about each technology, developers want to know what these two are about. Having worked for years with both Flex and Rails, we believe that both have something powerful to offer developers who want to build desktop-like functionality into web apps quickly, in a team environment, with the ability to be agile and react to the ever-changing requirements of building and delivering an application to the web.
Audience for This Book
?Chances are you're reading this introduction to figure out if this book is for you. Have a look at these "stories" and see if any of them sound familiar.
Rick—Rails Guy
Background | ?Worked with Java for years: Struts, EJB, Spring, all that. Then discovered the joy of working with Rails and hasn’t looked back. |
Overheard | Edge Rails? Is there any other kind?” |
Goal | HTML/CSS/JavaScript is fine for simple interfaces, and I don’t mind how crufty it is as long as I don’t have to deal with it. I’d be interested in finding out how to build richer interfaces, though—interfaces that don’t just look better but also give users better tools and an overall better experience.” |
Jill—Java to Flex Convert
Background | Worked with Swing and understands desktop applications. Got into “The Web” and did lots of J2EE. Loves Flex for the ability to build desktop-like functionality on the web, usually in front of J2EE back-ends. |
Overheard | GridBagLayout? What were they thinking?” |
Goal | “I love working with Flex, but I’m getting a little tired of all the work it takes to set up the back-end with Java. Enterprise software is great when I need the flexibility of all that configuration, but what about when I have a straightforward model and I just want it to work? There’s got to be an easier way.” |
Pete—Flash/PHP guy
Background | Has done lots of design work and building of interfaces with Flash. Has built websites with PHP and also integrated PHP back-ends with Flash. |
Overheard | “I don’t skip intro, I make intro” |
Goal | “I know what I can do in Flash, and I know how to feed Flash UIs with data from PHP. I’d really like to see what this Flex thing is all about though, since I’m not always building timeline animations. I’ve also heard a lot about Rails and how easy it is to get a back-end up and running.” |
If any of these stories sound a bit like you, then this book is for you. Rails and Flex have both revolutionized the way we develop web applications on both the front- and the back-ends.
Developers who have found Rails and left the world of enterprise framework stacks behind would very rarely willingly go back to the slow development cycles and bloated boilerplate code they had to endure. Flex developers have found the declarative XML language much cleaner and less crufty than HTML and able to do things like 3D and video that would be impossible without Flex.
Of course, there are the normal disclaimers. Rails isn’t for every project and neither is Flex. David Heinemeier Hansson wrote about PHP in a blog post (http://www.loudthinking.com/posts/23-the-immediacy-of-php):
I’ve been writing a little bit of PHP again today. That platform has really received an unfair reputation. For the small things I’ve been using it for lately, it’s absolutely perfect. . . .
For the small chores, being quick and effective matters far more than long-term maintenance concerns. Or how pretty the code is. PHP scales down like no other package for the web and it deserves more credit for tackling that scope.
And the same goes for Flex. HTML doesn’t need to be compiled and needs no special tools besides the ubiquitous browser to view it, whereas Flex needs a compiler and the Flash Player. However, when you find yourself with a medium to large web project with a database back-end, working with a team on a set of complex forms, rich visual interactions, video integration, 3D features, or a very large set of views, then Flex and Rails make a great choice.
The Flex and Rails story has a lot to do with discovering the integration capabilities and learning the ins and outs of making them talk to each other. We’ve gone a bit beyond that, though, and tried to assemble enough information about the next steps, common tasks, and how-to’s that developers will want to know about sooner or later.
We thought that, for the most part, Flex developers who have never used Rails will want to learn some of the features that they’ll run into during integration, but also during daily work. Likewise, developers who are already familiar with Rails will want to know a bit more about how Flex works than just consuming Rails’ XML services.
Note - This book is not...