Monday, November 24, 2008

Flex: More Like HTML or More Like Java?

Joshua Partogi recently posted Why You Might Not Want to Use Flex on his blog. I found this blog entry particularly interesting because Joshua does not focus on the usual criticisms of Flex (which often are actually of the Flash Player) and because Joshua's experience is almost exactly opposite of mine. While I have generally found Flex to be significantly easier to use than any other web development frameworks that I have used, Joshua seems to have found both Tapestry and JavaServer Faces easier to use than Flex. As Joshua alludes to in both his blog entry and the linked-to presentation Switching Paradigms: From Regular Web to Flex, it is really a matter of experience and perspective.

I consider myself first and foremost an application developer with my primary interests, experience, and skillset focused on things like Java EE. I have, of course, written many web front-ends with JavaServer Pages, Struts, and several other web frameworks to a lesser degree. All of these web frameworks offered advantages and I appreciated the abstraction they provided me. However, the real problem was not the frameworks themselves. The one area that still felt like I was hacking stuff together was the implementation of dynamic behavior in the web browser via JavaScript and DOM manipulation. I also grew increasingly frustrated with the world's most popular web browser not fully supporting some of my favorite Cascading Style Sheet effects. For me, Flex was a breath of fresh air with its hiding of browser idiosyncrasies and the ease of implementing stunning new interfaces with highly dynamic behavior. I was hoping that Java would get a framework as compelling as Ruby on Rails and, for me, this was it.

This brings me back to perspective. While Flex itself is obviously not Java, it shares so may characteristics with Java and is so easy to integrate with Java that it almost feels like an extension to Java. Because I have always strongly preferred Java over JavaScript/DOM/CSS, it is no surprise that I found Flex and even ActionScript to be so refreshing and liberating.

I appreciate Joshua posting this blog entry because it reminds me that not everyone thinks the same or shares the same experiences. No framework or tool or product can be everything to everyone all the time. However, Flex has really left an impression on me, on the vast majority of my colleagues who have given it a shot, on and many others whose blogs I read. We all come from similar backgrounds with strong Java experience and have been spoiled by the ability to write code once and run it on virtually any operating system. For us, the idea of a web application written in Flex that can run on virtually any web browser is "how things should be done." Having to write code to take into account different browser vendors and even different versions of the same vendor's browser and having to test our applications every time on several different web browsers seems unnecessarily time-consuming.

I can appreciate how Flex/ActionScript's static typing, class-based object-orientation, and obvious Java-influenced characteristics can be foreign to someone who spends most of their web development in the HTML/CSS/DOM world. While Flex does offer support for these specifications to varying degrees, it certainly is not exactly like these and does require some learning and a new way of doing things.

I'm a strong believer in "to each his own." For me and for many people like me, Flex is the best thing to come to web development in a long time. For others, they may be perfectly happy with what they're using and have grown comfortable with. I have found that the best motivator for me to learn a new language, technology, toolkit, framework, or other product is some pain with my current language, technology, toolkit, framework, or product. The pain has to be consistent enough and of sufficient degree to motivate me to look at something new. While I have found some corner cases with Flex that are a little tricky and have found some things I'd prefer to see implemented another way, I have not experienced enough pain to really consider an alternative at this time unless something revolutionary comes along.

Joshua's last paragraph provides the advice that I'd reiterate to anyone who is unhappy with their current web development experience: don't take my word, the word of other Flex enthusiasts, or the word of people unhappy with Flex as the final word. Because we're all different, we have to find what we each like. I think most people who give Flex a fair try will like what they see.

Michael Martin, a fan of both Flex and Linux, informed me of the recent release of an alpha version of Flash Player 10 for 64-bit Linux. He is excited about this and has been happy with its performance so far.

8 comments:

Unknown said...

Finally. A positive response. :-)

Thank you very much for taking this from a positive perspective Dustin. I really appreciate it.

Cheers

Glamdring said...

You should've noticed Flex immaturity. (I'm a about to write a short post about it). It gets more mature as the time goes, but still has a pile of strange practices and stupid things in the core.
From what I read, you should try GWT - a real extension to Java (not 'almost'), browser independent, no flash player concerns. ;)

@DustinMarx said...

Glamdring,

Having used Flex off and on (whenever I have worked on a web application rather than back-end or JMX) for nearly two years now, I am somewhat familiar with its disadvantages. No tool is perfect, so I can only make decisions based on the the entire suite of advantages and disadvantages offered.

I have read about Google Web Toolkit, have attended David Geary's April 2007 DJUG presentation on GWT, attended Hermod Opstvedt's Colorado Software Summit 2008 presentation on GWT, and even tinkered with GWT after it first came out. I do think it has a lot to offer and would likely make it my first choice (other than OpenLaszlo) if I could not use Flex (for example, in a situation where dependence on the Flash Player was not allowed). That being said, GWT, like everything else, has its own set of disadvantages and limitations. It is actually pretty easy to find things wrong with any language or tool; for me, the most important thing is my overall experience and satisfaction with something. For me, Flex has hit this goal better than any other web framework that I have used.

Glamdring said...

Hi, here's what I managed to write:
http://bozhobg.wordpress.com/2008/11/27/why-i-might-not-want-tjavascript:void(0)o-use-flex/

@DustinMarx said...

Glamdring,

I read your post and did see several things on there that aren't my favorite features, but I believe that a similar list of issues and problems can be compiled for nearly any web framework. This goes back to why I think which framework is "better" is somewhat dependent on several factors such as the needs of the project, the skill set of the developers, and work-arounds available for the less desirable aspects all frameworks suffer.

I hope you will post some of your positive and negative findings when you work with Google Web Toolkit. I look forward to seeing how it compares. My guess is that it does some things better than Flex and some things not as well as Flex.

Glamdring said...

Hi,
Of course you are right that (almost) all framework has its drawbacks, especially on the RIA domain, where the framework itself is a kind of workaround.
My point was that the problems of Flex are too close to the core to be easily fixed. As for GWT (which I haven't used recently, but plan to in the near future) - it lacks good-looking and functional-rich components. But it is a matter of time for them to appear (as they might already have). GWT is allegedly slower than hand-written JavaScript for example - but it is a price one is willing to pay, in most cases. And finally it comes to this - is one willing to struggle coding/have preformance issues/etc.
But generally, in the Java world, the most popular frameworks - JDK included, Spring, Hibernate, etc. - these things are very close to perfect - that is, there is nothing wrong, just there are things to be added.

@DustinMarx said...

Glamdring,

Even though I really like several things about the Spring Framework, I don't think it or any other framework anyone can name is perfect. I can certainly list problems (or things I don't like) about Spring and Hibernate. In addition, the fact that frameworks like Guice and alternative ORM mapping solutions continue to rise is evidence that others have issues with Spring and Hibernate. My feelings about Spring are actually very similar to my feelings about Flex; both have things I don't like, but the positives of each outweigh their own negatives and their overall benefits are greater, in my view, than the alternatives provide.

Finally, I always feel just a little dirty when I am forced to do certain things to my once pristine POJO to make it work with Spring or Hibernate. I do it because I hope that the trade-off is worth it in the end, but "perfect" is not a word I'd use lightly to describe any framework that I've ever worked with including Hibernate, Spring, and Flex.

Glamdring said...

Certainly. I never use the word "perfect" alone. I said "close to perfect" :)