Monday, January 16, 2012

Flash vs. HTML 5


Note: This article is about the Adobe Flex SDK, not Flex Rental Manager.

Adobe seems to be in a state of crisis: not along ago they announced a bold new initiative to compile Flex 4.5 to IOS and other mobile platforms, which to us signaled a long term commitment to Flex. Since our whole front end is built in Flex and runs on Flash, this was relevant to our interests.

Then, in a series of shocking announcements, they pulled their plans for mobile platform support and then announced they were thinking of donating Flex to the Apache Software Foundation, citing the upcoming release of HTML 5.  Needless to say, this led to some introspection around here and a close look at the HTML 5 draft specification.  More on that later.

Apple's never been a fan of Flash.  Steve Jobs has been very vocal about it and claimed it was a waning technology.  I think that's just another example of NIH syndrome running rampant at Apple and I think users of Google Analytics, YouTube, and FarmVille might disagree with Steve's assessment of Flash.

I hate to be disrespectful of the dead and Flash is a lot of things, but a waning technology isn't one of them.  In fact, there are few web technologies as ubiquitous as Flash.  It's everywhere.  Microsoft even launched their own project, Silverlight, to compete with Flex/Flash.  (Our friends at Production Exchange use Silverlight.)  And as of yet, there is no suitable replacement for it, not even HTML 5.

Flash does have it's problems, however.  The FlashBuilder development tools have memory leaks galore and the Flash runtime could do with some serious enhancements.  Moving the Flex SDK into the open source community could work wonders for these problems and perhaps make Flex even more useful.  If the Flash Player follows the Flex SDK into the OSS world, it could even lead to embedding the Flash Player into browsers since the Apache license allows incorporating open source software into closed source or commercial platforms.

What makes Flex useful for creating rich internet applications (like Flex Rental Manager) is that it provides a component/event style model for building user interfaces.  In many ways, it's like a long lineage of GUI API's developers are familiar with.  AJAX wizards will assert that you can do the same thing with HTML, DOM and JavaScript -- and they're right, just not as easily, and not without accounting for the subtle differences between browsers and how they process markup, apply CSS styles and interpret JavaScript code.  HTML 5 won't solve any of these problems.  It just adds a new pile of requirements for browser developers to release different interpretations of.

With that being said, I do like what I've seen so far of HTML 5.  It cleans up some of the loosy goosy formatting issues in HTML 4 and provides new API's for 2D drawing and video.  Much of the ubiquity of Flash is due to its video support and I do think HTML 5 will displace Flex/Flash when it comes to video and some of the simpler web based games.

In order for HTML 5 to truly displace Flex, however, it will require an ecosystem of third party libraries to get the same kind of rich UI components that come with Flex.  jQuery and other DOM/JavaScript frameworks have provided this for a long time.  HTML 5 does nothing new but clean up the syntax and provide better low level API's for drawing and multimedia - some new objects for us to manipulate using the same old DOM and the same old JavaScript.  Great for component developers, not that compelling for us. Not yet, anyway.

Another key issue for me with moving back to AJAX is the often obfuscated nature of DOM/JavaScript.  It's not often you can open up a piece of JavaScript that does something useful and easily understand it.  Flex, on the other hand, has a nice structure with classes and inheritance and interfaces and all the rest.  The HTML/DOM/CSS/JavaScript universe seems like a mish-mash of competing philosophies at present.  It can be powerful, but it's hard to access that power without the code getting ugly and rendering the relationships between different components unclear.  I know from experience that when code isn't clear and self documenting, we're afraid to touch it.  It becomes a black box and we get skittish about maintaining it.

Again, I do think HTML 5 is a great improvement over HTML 4.  I'm excited to work with it and it will simplify traditional web development.  But Flex Rental Manager is not a traditional web site -- it's a full screen RIA, rich even by Rich Internet Application standards.   It's not a typical use case, so judging HTML 5 by how it lends itself to our purposes isn't really a fair means to evaluate it. We prefer Flex over Ajax because our time is limited and we can't afford to spend our time building components or testing (and working around) browser idiosyncrasies.

In time, of course, these issues we're concerned about with HTML 5 will get resolved.  jQuery or libraries like it will work out the browser issues like they already have with HTML 4 and a whole universe of third party components will spring up.  I think of HTML 5 and the other standards that complement it as a transition step from the old way to a more elegant way that may emerge down the road.  For Rich Internet Applications, I don't think it offers much beyond HTML 4 -- the power all comes from third party JavaScript libraries.

I liken HTML 5 as it applies to rich internet apps to SOAP in the web service realm.  When SOAP first hit, we all thought it was going to be the best thing since sliced bread.  Object serialization interoperability between platforms and longer lasting light bulbs.  SOAP didn't quite work out that way, did it?  We developers started working with it and it didn't take long for us to realize how much it sucked.  Then came REST.  Finally.  REST is much better: simpler, cleaner.  Then JSON came along and helped us serialize our objects in a clear, elegant way, and (gasp), without XML.

It takes time to get things right.  I see HTML 5 as a step along the way to cleaning up and simplifying web development, but just the first of many.  But it's easy for me to sit here in my glass house and throw stones at standards working groups.  It's not an easy job to mediate all the competing visions for what the web should be, for what web development should be.  But unless we're forced to do something drastic by a sudden disappearance of the Flash player, we're content to let the working groups duke it out for a few more years.  Our early adopter days are over.

What really confuses me in all this is Adobe's sudden rush to jettison Flex for a standard the WC3 hasn't even approved yet.  Seems pretty rash.  Most of the reasons developers picked Flex over AJAX in the first place haven't changed and HTML 5 won't change them much either.  I think it comes down to a problem that's plagued a lot of companies in the business of making developer tools and Internet technology: their engineering teams produce something wonderful and useful, but the business folks can't figure out how to sell it.  Adobe is scapegoating HTML 5 because it can't figure out how to make money off of Flex, even though lots of big players use it.  Adobe had the same problem with Acrobat, the ubiquitous PDF.  The PDF has changed the way we share and access "printable" documents on the web, but how many of us remember paying for the right to use it?  And my beloved Sun invented Java -- and Java was undeniably a huge success in terms of developer and business adoption.  But where is Sun, now?  Gone.  Absorbed into the pitiless borg that is Oracle, just like MySQL and Peoplesoft.

I guess we should be thankful that Larry Ellison has, as of yet, left Adobe alone.  I'd rather see Flex go the Apache route than get sucked up into Oracle.  Either way, Flex isn't going away any time soon, no matter what anyone says.  It's way too useful.

No comments:

Post a Comment