Monday, May 24, 2010

The Rise of HTML5 and the Doom of Flash

There has been much discussion on HTML5 and Flash lately, and I just want to put in my two cents on this matter.

First, let's make it clear that I am pro-Flash. It is not intended to be an unbiased evaluation of the pros and cons of HTML5 and Flash. I do try to compare the two technologies in an objective and logical manner, as best as I could.


One of the most important arguments for HTML5 is that it is an open standard, thus it is good and it should be promoted. The flaw in this argument is that just because a technology is based on an "open standard" doesn't mean it is good. From a developer's point-of-view, being an open standard is HTML5's biggest weakness. The SWF specification is freely obtainable from Adobe, and the Tamarin Engine, the Actionscript Virtual Machine, is open source. The main difference between HTML5 and Flash then is that Flash is controlled by one company, while HTML5 is controlled by many entities. Here is the important part, as an individual developer, you have just as little control over HTML5 as you have over Flash. Now, imagine what happen if you want to request a new feature or to submit a bug report for HTML5, instead of dealing with one company, you have to navigate your way through this multinational body.

Even if you manage to get your request adopted by the W3C, there is still no guarantee that all the browsers would support the feature. This brings us to the second problem with HTML5 - browser's quirks. Until we have found a way to kill of all the browsers in the world except one, we will always have to deal with incompatibilities between browsers. It is true that HTML5 is an open standard, and that all browsers are supposed to implement it faithfully according to the specification; but in reality, this will never happen. HTML4, CSS1, and CSS2 were open standards, and any web developers can tell you stories about the pain and the craziness of working with these technologies, why should HTML5 be any different? Even as we speak, we are already witnessing the argument between H.264, Ogg Theora, and VP8 codec. Nowadays, internet-connected devices come in various form-factors, capabilities, and processing power, and we are going to see more platform specific browsers that try to implement HTML5 differently. Yet with the advent of Flash Player 10.1, we will have a deployment platform that is truly uniform across Windows, Mac, Linux, and Android.

This brings us to the next issue - deployment. As of March 2010, Flash Player 10 penetration has reached over 97% and Flash Player 9 has reach over 99%. Data on HTML5 is a bit more complicated, since some browsers only implement a subset of the HTML5 specification, but I would put the number to about 60-75%. Of course, HTML5 advocates would argue that HTML5 penetration will continue to rise, and this is true. Yet, let's imagine what would happen if a user is visiting your brand new HTML5 website with an older browser. He/she would see parts of the content, and a whole lot of missing tags. Of course, you can use some clever Javascript to detect the user's browser version and fallback to HTML4, but this is just more browser's quirk craziness. You can provide instructions to the user to upgrade his/her browser, but how many user would do that just to view your website? Remember, to a novice computer user, upgrading a computer program can feel like a major undertaking. Should I uninstall the old version? Would the new version break any other program on the system? Would my settings, history be transferred together? How can I get the old version back if necessary? In contrast, installing and/or upgrading the Flash Player is a lot easier. First, the Flash Player is a lot smaller. Second, the browser would actually prompt the user to do the installation/upgrade automatically, which can be a lot more convincing and convenient than following the instructions on your website. Third, installing the Flash Player doesn't change the browser's UI, unlike upgrading from IE6 to IE8, which adds a new learning-curve. Since the installation is done on the browser, one layer remote from the operating system, many users would view the process as adding a new feature to their existing browsers, instead of changing the configuration of their entire computer system.

The next major argument for HTML5 is that Flash is too slow, or too power-hungry. It is true that the Flash Player can consume quite a bit of resources, but it is not fair to compare HTML5 with the Flash Player when the latter is clearly far more powerful than the former. All of the new features of HTML5 - video, audio, canvas, persistent storage, drag and drop, etc - can be done in Flash. Yet, that is not all that the Flash Player can do. The Flash Player supports filters, streaming, multi-casting, UDP-transport, runtime alpha-channel, binary data manipulation, context menu, etc. The question is, when HTML6, 7 or 8 finally arrives to support all the features of the Flash Player, do you think it is still going to be as "efficient" as HTML5? Or to put it in another way, do you think you can implement all the features of the Flash Player using HTML5 and Javascript as efficiently as the Flash Player does? Remember, the SWF files contain already-compiled bytecode instructions, whereas HTML and Javascript files exist as plain text.

Even if you manage to devise some clever hacks to implement all the features of the Flash Player using nothing but HTML5 and Javascript, there is still the problem of development. We have a whole array of tools for working with Flash, some are actually free (the Flex framework, for example). And since the SWF specification is open to public, anyone can write a tool that works with Flash. Most importantly, many of these tools are designed for people with little programming background. I can make a Flash animation, or convert a Powerpoint presentation to a self-contained SWF file without knowing or even seeing a single line of code. For developers working in a team, Flash offers tremendous advantages over HTML and Javascript. We have tools, like the Flash Builder and the Flash Catalyst, that allow the team to separate coding from designing. We have a mature framework and server technologies that help insulate business logic from client logic. We also have an object-oriented language with strongly typed variables, E4X, and powerful debuggers and profilers to facilitate the development of large-scale projects.

In summary, HTML5 is a long-overdue revision of HTML4. It addresses many weaknesses and shortcomings of HTML4, and it is academically brilliant invention. Unfortunately, at its current state, HTML5 offers nothing more to the web than playing catch-up with Flash. From a developer's point-of-view, Flash is still a far more superior technology, both in terms of development and deployment. We can either abandon this great technology and re-invent the wheel using HTML5, or we can use the resource to improve Flash. Google has recently introduced a very powerful V8 Javascript Engine, perhaps we could do the same for the Tamarin Engine? Instead of develop products that exclude the Flash Player, perhaps we can open up some of the graphics API to speed up the Flash Player? (Yes, I am referring to Apple)

No comments:

Post a Comment