Software Designers~The People Behind the Code~(英語)

#13Bruce Lawson, Opera Software Evangelist and Co-Author of Introducing HTML5

On his personal website, Bruce Lawson says that he’s so geeky, he recalls coding games in assembler―a move necessitated by the computer’s tiny 8KB of RAM. He also admits drinking a bit too much Guinness, admiring vegetarians, but loving the taste of meat too much to join them, and speaking good Thai, OK Turkish and pretty bad French.⁠⁠ And by the way, he was born in South Yemen and has a tattoo of Max from "Where the Wild Things Are" on his arm.

This eclectic biography caught my attention when I was looking to interview an expert on HTML5. Lawson is certainly that: he and his co-author, Remy Sharp, have written one of the first books on the specification. Introducing HTML5 debuts this June, published in the U.S. by New Riders Press. Lawson is also an open web standards evangelist on Opera’s developer relations team and a member of the Web Standards Project’s Accessibility Task Force. This combination of human concerns and geek sensibilities has given him a broader view of HTML5, which he sees not just as an important emerging standard, but as a better way for developers to communicate.

I spoke to Lawson by Skype from his home in Birmingham UK, the day before he flew across the ⁠puddle⁠⁠ to Austin, Texas to attend his first South by Southwest (SXSW) Festival.

I’m trying to connect the dots between South Yemen, where you were born, and Opera, where you now work.

My parents were working in Yemen, which is why I was born there. I started my geek career at school with a computer which ran assembler. In 1988, I applied to an English technology company, who were shocked that an English and drama graduate student would apply. I told them that it takes a scientist to make a TV, but it takes an artist to make the programs―and you can’t have one without the other. They hired me, and I was the guy they sent out to talk to customers about business problems. I passed what I learned to the developers in terms of code and modules. Even now, I think of the technical stuff as a vehicle to facilitate communication.

I worked every day for 18 months, including weekends, and had a lot of money in the bank, but no life. I threw it all away and traveled. I lived in Turkey for a couple of years, playing guitar in bars and reading Tarot cards. I lived in Thailand for four years, and helped set up an English language school. Back in the UK, I worked for a book publisher where I started up a brand of books for Web developers. After I joined the Web Standards Project, a friend of a friend suggested I apply to join Opera, and in one fell swoop I managed to combine my hobbies with my work.

How did you come to write a book on HTML5?

I’ve long been interested in the minutiae of HTML―and used it to redesign my own personal site way back in late 2008. And I noticed that while people who are writing the HTML5 spec are complete ⁠brainiacs.⁠⁠ They weren’t talking to rank and file developers. Their blogs said they would like developer feedback, but the level of writing had nothing that developers would easily be able to digest and react to. So I decided the world needed a book on HTML5 for people who are professional Web authors, not professional specification authors. Remy, who's a JavaScript whiz, and I decided to collaborate. We also collaborate along with a few other guys on a site called

The editor of HTML5, Ian Hickson, has given a timetable for the spec that stretches to 2022. Will that slow implementation?

What he was saying is that the spec won’t technically be finished until then, because they are combining about 20,000 test cases into the spec. The spec completely and totally defines what browsers should do with bad markup, hence all the test cases. But it’s more important to realize that many of the browsers already have many HTML5 features.

Spec implementation has always been an inexact science. Even now, relatively few websites properly conform to all the rules of HTML. So the browsers are very forgiving: they all make a best guess of what you meant if your HTML code is bad. They all guess slightly differently, of course, and that was fine back in 1998, but now we have multi-million dollar businesses on the Web, and we can no longer be so inconsistent. So one of the things HTML5 does is define exactly what every browser should do in the case of bad markup. Badly coded pages will still be rendered, but every browser that follows the spec will have exactly the same rendering, not visually, but at the level of the Document Object Model. The DOM underneath will be identical across all browsers. That means that you can reliably run JavaScript, whereas today, writing cross-browser JavaScript is a Voodoo art.

HTML5 has also gotten attention because it could replace Flash.

The press has picked up on that story because it’s a relatively simple headline to write. But developers should really be paying attention elsewhere―to all of the things that you can do so much easier in HTML5―things that currently require weird, elaborate hacks and hours of coding time.

That said, I don’t think HTML5 video will necessarily replace all Flash video, especially in cases where you want to protect intellectual property. If you don’t want people to download content, as opposed to just streaming it, you are not going to use HTML5 video because it is just like an HTML image: if you can show an image on the Web, you can copy it. Flash allows you to protect content, whereas HTML is an open spec, with no digital rights management provided. Most of us who want to put a video on the web will probably put it on YouTube―we don’t host it ourselves. And YouTube isn't quite ready for open HTML5 video.

But HTML5 support is available on YouTube on an experimental basis.

That’s true, but there’s a catch. One of the steps YouTube takes to transform the video uses the H.264 compression standard. But H.264 is a royalty-encumbered format. The people who own the codec said they wouldn’t collect any royalties from people publishing video using that codec until 2011, and they’ve just announced that they are extending that to 2016. But after 2016, they can charge whatever they like. More importantly, if you want to distribute an H.264 decoder in your software, you have to pay them. Safari supports H264, while Opera, Firefox and Chrome support a royalty-free codec called Ogg, which is incompatible. So how this will all play out long-term remains to be seen.

You said HTML5’s real significance for developers is in more efficient code. Can you give some examples?

Here’s an unglamorous one, but it comes up all the time: HTML forms―which provide those fields for user input. They’re ubiquitous on the Web, and they usually contain some JavaScript for data checking. For example, a webmail site will usually include some JavaScript code that checks for a properly formatted email address. In fact every day, some developer somewhere is writing bits of JavaScript to validate email addresses, credit card formats, you name it―and that’s a waste of time. With HTML5 you can just say in your markup: <input type=email> and the browser will use built-in validation routines.

Here’s another example. A bank wants to draw a graph on its Web page showing mortgage repayments. A customer might specify the size of the mortgage and the payback period, and the graph will show what it is going to cost over the period. In the old days, this was cumbersome and time consuming. HTML5 simplifies things with an element called ⁠Canvas⁠⁠ that essentially lets you mark out a blank area on the page, then draw an image or create an animation with JavaScript. Previously this was impossible. A user enters the details into a form, presses a button, and the JavaScript code draws the graph onto the page in real time. Change the form even slightly, and the graph will adjust accordingly without any trips back to the server. On a mobile phone especially, that saves an incredible amount of data and lots of time.

What about HTML5 video?

HTML5 video lets you do lots of clever stuff. For example, a big advantage of HTML5 is that you can use JavaScript to synchronize images with corresponding text. I have an example with two transcripts―one in English and one in Japanese. You press a button and midway through watching the video you can swap the subtitles. But the most important thing about HTML5 video is that no plugins are involved: the browser plays the video. This brings to video the ⁠hackability⁠⁠ that's always been the backbone of the Web―the ability to extract data from a page and manipulate it in new and exciting ways.

As HTML5 is being implemented in stages, are there concerns about inconsistent implementation between browsers?

You’re right: the browser developers aren’t formally coordinating their efforts. They don’t tell each other what they are planning to implement―even though they are all involved in the specification itself. But what you do realize is that people are reacting to developer demand. Remy and I speak at about two conferences a month and we hear what people are asking for. Two years ago, they were asking for canvas. Now we have it. A year ago, people started asking for video, and now that’s available in the four browsers―Opera, Firefox, Safari, and Chrome. Offline storage is something that people have been asking for a lot. In a year’s time they will be asking for something different. We are all commercial entities so we listen to what our customers are asking for, and try to give it to them. But everybody’s release cycles are different.

The saving grace is that HTML5 is designed to be, as far as possible, backwards compatible. My Web page that is written in HTML5 can still render in Internet Explorer 6. Internet Explorer 6 might not be able to extract all of the extra juicy stuff but it doesn’t refuse to show anything. Even with the video elements, a developer could write some code―it’s ugly code because it’s transitional―that will use the open Ogg codec in Opera, Firefox and Chrome, and will use the H.264 codec in Safari, but will fall back to showing the video in the Flash player in Internet Explorer and older browsers. And even if you are on a mobile phone, it will at least give you a link where you can download the video and hope that the phone’s native video player can show it to you. HTML5 is deliberately designed so that the transitional period doesn’t split the Web into people who use the latest and greatest browsers and the older ones.

As HTML5 makes its way from the specification to the Web, what’s its broader impact?

At its core, HTML is about better ways for people to communicate. That’s what interests me the most. The ability to show video without a plug-in matters, because videos are mostly about people talking to people. If you are dependent on Adobe’s Flash or Microsoft’s Silverlight, it doesn’t matter how much you might admire those companies―you are still dependent on one company for essential communications. The Web is the world’s best example of a global communications medium. It belongs to nobody, which means it belongs to everybody. So for me, HTML’s biggest advance is to keep the Web itself as open as possible.